USB Transactions
13-71
USB Function Module
13.3.5.3
Non-Autodecoded Control Write Transfers
Non-autodecoded control write transfers include the set/clear endpoint
feature, set configuration, set interface, set descriptor, and class- or vendor-
specific control write transfers. Non-autodecoded control write transfers
consist of two or three stages (setup, data (optional), and status).
The setup stage of a valid non-autodecoded control write transfer consists of
one SETUP transaction from USB host to USB device. At the end of the setup
stage handshake, the USB module generates a local host general USB inter-
rupt with the setup flag set. The local host must respond to this general USB
interrupt by setting the Setup_Sel bit, which clears the setup interrupt flag. The
local host must then read 8 bytes from the setup FIFO via the DATA register,
clear EP_Sel bit, and check the setup flag. If the setup flag is set, the local host
must discard the setup data it has just read and handle the new setup data
packet following the same scheme. If the setup flag is cleared, the local host
code must interpret this request information and performs any application-
specific activity needed due to the setup stage request (see Figure 13–8). If
there is one or more data stages for the transfer, the local host must set the
Set_FIFO_en bit for endpoint 0 to allow the core to accept RX data from the
coming OUT transaction.
The data stage for non-autodecoded control writes consists of zero or more
OUT transactions. Transaction handshaking and interrupt generation apply as
for non-isochronous, non-control OUT endpoints. The local host can cause
NAK, STALL, or ACK signaling for the data stage transactions. If ACK was
signaled on a given general USB interrupt, the local host must respond by
reading the data from the endpoint 0 RX FIFO and saving it for processing.
After completion of the data stage, a status stage IN transaction occurs. The
USB module provides handshaking to the USB host based on the endpoint 0
handshaking control bit FIFO_En. The local host may delay signaling comple-
tion of the control write transfer by forcing NAK handshaking to the host during
the status stage (by holding the FIFO_En bit equal to 0), or by causing ACK
handshaking by setting the Set_FIFO_En bit to 1 (with an empty endpoint 0
FIFO). An endpoint 0 TX general USB interrupt is sent to the local host at
completion of the status stage.
After a SET_CONFIGURATION request, the device moves into addressed or
configured state as soon as the local host sets the Dev_Cfg or the Clr_Cfg bits.