
Chapter 2. Endpoint Zero Page 2-9
Endpoint zero is a CONTROL endpoint, which by USB definition is
bi-directional
. Therefore, it has
only one stall bit.
Get Status/Interface is easy: the firmware returns two zero bytes through EP0BUF and clears the
HSNAK bit (by writing 1 to it). The requested bytes are shown as “Reserved (reset to zero)” in the
USB Specification.
About STALL
The USB STALL handshake indicates that something unexpected has happened. For
instance, if the host requests an invalid alternate setting or attempts to send data to a non-
existent endpoint, the device responds with a STALL handshake over endpoint zero instead
of ACK or NAK.
Stalls are defined for all endpoint types except ISOCHRONOUS, which does not employ
handshakes. Every FX2 bulk endpoint has its own stall bit. The firmware sets the stall condi-
tion for an endpoint by setting the STALL bit in the endpoint’s EPxCS register. The host tells
the firmware to set or clear the stall condition for an endpoint using the Set Feature/Stall and
Clear Feature/Stall Requests.
The device might decide to set the stall condition on its own, too. In a routine that handles
endpoint zero device requests, for example, when an undefined or non-supported request is
decoded, the firmware should stall EP0.
Once the firmware stalls an endpoint, it should not remove the stall until the host issues a
Clear Feature/Stall
Request. An exception to this rule is endpoint 0, which reports a stall con-
dition only for the current transaction and then automatically clears the stall condition. This
prevents endpoint 0, the default CONTROL endpoint, from locking out device requests.
Table 2-5. Get Status-Interface
Byte Field Value Meaning Firmware Response
0 bmRequestType 0x81 IN, Endpoint
Load two bytes into EP0BUF:
1 bRequest
0x00
“Get Status”
Byte 0 : zero
2 wValueL 0x00
Byte 1 : zero
3 wValueH 0x00
4 wIndexL 0x00
5 wIndexH 0x00
6 wLengthL 0x02 Two bytes requested
7 wLengthH
0x00
Comentarios a estos manuales