
The possible values of the data can be zero which indicates success, NAK (busy), or STALL (endpoint halted). It is used to specify the status of the entire transfer. The value of PID will be IN if the transactions in Data Stage were OUT and vice versa.ĭata Packet: This packet uses Data1 PID. Token Packet: This packet contains PID that specifies whether the transaction is IN or OUT, device address, endpoint and CRC. Each transaction contains three packets, Token, Data and Handshake. The status transaction provides feedback or status of the completion of the above mentioned stages.

The only difference is the Handshake packet provides status or completion information for a single transaction whereas the Status transaction provides status about success or failure of the entire transfer. The purpose of the Status Stage is same as a Handshake Packet. 4: Image showing In and Out Transaction Packets 3. 3: Image showing data format of Data Transactionįig. This packet can return ACK (valid data received), NAK (busy), STALL (request not supported or endpoint is halted) or NYET (the current transaction data has been accepted but not yet ready for another data packet). The packet provides the status of the data packet received. The device sends this packet in case of OUT transaction. Handshake Packet: This packet is sent by Host if there is an IN transaction. For IN transaction, the device sends the data and for OUT transaction, the Host sends the data. It used Data1 PID for the first packet and additional alternate Data0/Data1. The data may be sent in more than one packet if the data length exceeds the maximum value of packet length. The length of the data is already specified by the wLength field. This packet is sent by host.ĭata Packet: This packet is used to transfer the requested data. It contains various IN or OUT transactions. In this stage the requested data is transferred. This is the second and an optional stage in Control Transfer. 2: Image showing Data Format of Setup Transaction 2. For interface, bit 7-0 represents the interface number.įig. For endpoint, bit 3-0 represents the endpoint number and bit 7 represents the direction 0 : OUT 1 : IN. The typical use includes passing the endpoint or interface number.

The default endpoint and device address 0 is used. Token Packet: It contains Setup PID (Packet Identifier), device address, endpoint and CRC. The transaction consists of three packets – Token, Data and Handshake. The setup transaction is used in this stage. The Control Transfer starts with a Setup Stage. As discussed before while discussing USB protocol, the Control Transfer consists of three transactions – Setup transaction, Data transaction (optional) and Status transaction.

Therefore, the first request that is prompted by the host to the peripheral just involves a control transfer. The default endpoint is endpoint 0 which is bidirectional and used for control transfers. That is the reason, it is used for sending requests and obtaining the descriptors. The Control Transfer is the only transfer type which is supported even when the device is yet not configured. The subsequent descriptors implements the functioning, the peripheral is meant for. The device descriptor is the first descriptor sent to the host and it helps configuring the peripheral with respect to the host. The Descriptors contain the information required for identifying and configuring the peripheral device, implementing the interfaces and setting endpoints. The peripheral responds by sending Descriptors.

When a USB peripheral is connected to a host device, the host sends queries in the form of requests. In the previous article of this series, USB Descriptors were discussed.
