Product manual

Spinpoint M9TU-USB 3.0 Product Manual REV 1.0
46
USB INTERFACE AND USB COMMANDS
6.3.5.1 Control Transaction
Control transfers are typically used for command and status operations. They are essential to set up a USB
device with all enumeration functions being performed using control transfers. They are typically bursty,
random packets which are initiated by the host and use best effort delivery. The packet length of control
transfers in low speed devices must be 8 bytes, high speed devices allow a packet size of 8, 16, 32 or 64 bytes
and full speed devices must have a packet size of 64 bytes.
A control transfer can have up to three stages, and each stage made up of three phases.
Figure 6-22 shows control transaction concept.
Figure 6-22: Control Transaction Model
The Setup Stage (Figure 6-23) is where the request is sent. This consists of three packets. The setup token is
sent first which contains the address and endpoint number. The data packet is sent next and always has a PID
type of data0 and includes a setup packet which details the type of request. We detail the setup packet later. The
last packet is a handshake used for acknowledging successful receipt or to indicate an error. If the function
successfully receives the setup data (CRC and PID etc OK) it responds with ACK, otherwise it ignores the data
and doesn’t send a handshake packet. Functions cannot issue a STALL or NAK packet in response
to a setup
packet.
Figure 6-23: Setup Stage
The optional Data Stage (Figure 6-24) consists of one or multiple IN or OUT transfers. The setup request
indicates the amount of data to be transmitted in this stage. If it exceeds the maximum packet size, data will be
sent in multiple transfers each being the maximum packet length except for the last packet. The data stage has
two different scenarios depending upon the direction of data transfer.
IN: When the host is ready to receive control data it issues an IN Token. If the function receives the IN token
with an error e.g. the PID doesn't match the inverted PID bits, then it ignores the packet. If the token was
received correctly, the device can either reply with a DATA packet containing the control data to be sent, a stall
packet indicating the endpoint has had a error or a NAK packet indicating to the host that the endpoint is
working, but temporary has no data to send.
OUT: When the host needs to send the device a control data packet, it issues an OUT token followed by a data
packet containing the control data as the payload. If any part of the OUT token or data packet is corrupt then the
function ignores the packet. If the function's endpoint buffer was empty and it has clocked the data into the
endpoint buffer it issues an ACK informing the host it has successfully received the data. If the endpoint buffer is
not empty due to processing of the previous packet, then the function returns a NAK. However if the endpoint
has had an error and its halt bit has
been set, it returns a STALL.