
Cypress Semiconductor Corporation
SL811HS and SL811HST: Application Notes
©2001 Cypress Semiconductor Corporation. All rights reserved. The information
and specifications contained in this document are subject to change without
notice.
Date: 07/26/01
Revision: 1.21
Page: 26
The short Data Packet occurs when the host does not know the transfer length of the USB
device during the IN transaction. This can cause a Bus Time-out or a Babble condition.
Program Sample 10: Short Data Packet
... // check PID IN ... // check PID IN
if (pid == PID_IN) if (pid == PID_IN)
rem = (BYTE)SL11Read(EP0Counter); rem = (BYTE)SL11Read(EP0Counter);
len len --= rLen; // rLen = actual read/write= rLen; // rLen = actual read/write
if (bLen && len > 0) if (bLen && len > 0)
{ {
SL11Write(EP0XferLen, (BYTE)(bLen)); SL11Write(EP0XferLen, (BYTE)(bLen));
SL11W SL11Write(EP0Address, addr); // data addressrite(EP0Address, addr); // data address
// Clear the Interrupt Status // Clear the Interrupt Status
SL11Write(IntStatus, 0xff); SL11Write(IntStatus, 0xff);
if (pid == PID_IN && rem == 0) // Check to arm if (pid == PID_IN && rem == 0) // Check to arm
SL11Write(EP0Control, (DATA0_RD)); SL11Write(EP0Control, (DATA0_RD));
}}
if (pid == PID_IN) if (pid == PID_IN)
{ {
SL11BufRead((short)((Cmd & 0x40) ? data0: data1), buf, rLen); SL11BufRead((short)((Cmd & 0x40) ? data0: data1), buf, rLen);
//Short packet detection //Short packet detection
if (rem > 0) // Remainder Packet if (rem > 0) // Remainder Packet
{ {
printf(" printf("\\nShort packet detection %xnShort packet detection %x\\n", rem);n", rem);
return len; // return Length return len; // return Length
} }
} }
... ...
4.1.11 USB Device Detection
USB device attachment and the speed of the attached device can be determined by monitoring
the SL811HS Interrupt status register bits -5 and bit-7 (IntStatus =0x0d). When a full-speed
device is attached, both bits -5 and bit-7 will be set =’1’. If a low speed device is attached, then
bit- 5 = ‘1’ and bit- 7=0.
SL811HS detects HUB as a full-speed USB device. After Enumeration process, SL811HS
software is able to determine the devices attached downstream of the HUB.
4.1.12 Full/Low Speed Detect
The SL811HS is able to detect attachment of full or low speed devices by monitoring bit-5, bit-
6, and bit-7 of register 0x0d. The speed_detect () function detects full/low speed device
attachment to the USB port. Also, this function generates the SOF/EOP for low/full speed
within 1ms.
When the SL811H is connected to a hub, the software must perform the following to avoid a
babble problem. This software implementation is a requirement for our chip. The developer
must follow this code so they will not have a missing packet problem. Initialization is required
for the interrupt.
Kommentare zu diesen Handbüchern