USB Transactions
13-74
The data stage of a control read transfer consists of one or more IN transac-
tions. Transaction handshaking and interrupt generation apply as for non-
isochronous, non-control IN endpoints; the local host can cause NAK, STALL,
or ACK signaling for the data stage transactions. At endpoint 0 TX general
USB interrupts, local host code must move more data to the endpoint 0 FIFO
until the last bytes of the requested data has been provided. Although SETUP
packets have a defined payload length, the USB host can cancel the transac-
tion at any time, without the status stage, and resend another SETUP com-
mand. The local host code must be able to operate correctly in this situation.
After completion of the data stage, a status stage OUT transaction occurs. The
USB host sends a 0-length data packet, and the local host code must return
its completion status for the control read standard request via standard hand-
shaking mechanisms.
In the case of returning exactly what the host requested when the request was
a multiple of the maximum packet size, no zero length packet is required. A
zero-length packet is required only when the amount of data the device has
to return is less than the amount requested by the host and the amount
returned is a multiple of the maximum packet size.
Non-Autodecoded Control Read Transfer Handshaking
Handshaking for the setup stage of non-autodecoded control read transfers
is forced by the USB module to always be ACK, unless there is a data error
in the packet, in which case the USB module ignores the transaction. If the set-
up packet has a DATA1 PID instead of a DATA0 PID, setup transaction is
ignored (error).
Data stage handshaking for non-autodecoded control read transfers is depen-
dant on the endpoint 0 FIFO_En, EP_Halted, and Stall_Cmd bits. The hand-
shaking information is used during the data phase of the data stage trans-
action. The USB specification requires that once STALL is signaled in a control
transfer, it must be signaled until the next setup token is received. The
Stall_Cmd and the Set_Halt (reflected through the EP_Halted register bit) reg-
ister bits provide this functionality. The EP_Halted does not reflect the forced
STALL caused by the Stall_Cmd bit; it retains its previous value.
Status stage is controlled by the FIFO_En and the Stall_Cmd bits.