• Controlling the data exchange
• Data exchange in the form of actual payload
USB Packet Fields
In USB the LSB of the packet is transmitted first. An USB packet contains different fields. They are:
• Sync: It is a mandatory field occurring at starting of the packet. This field synchronizes the clock of the receiver with the transmitter. For low and full speed mode, this field is 8 bytes long and for high speed mode it is 32 bytes long.
• PID: PID means Packet ID. It indicates the packet type that is being sent. This field is of 8 bits long. The upper four bits identifies the type of packet and lower four bits are bit-wise compliment of upper four bits. The lower four bits helps in detecting errors.
• ADDR: This field contains the designation address of the USB device. It is of 7 bits, this means it can supports 27 ¬ = 127 devices.
• ENDP: This field specifies the endpoint number. It is of 4 bits, this means it can indicate 2¬¬4¬¬ ¬¬= 16 possible endpoints.
For token packets, 5-bit CRC is used and for data packets 16-bit CRC is used
• EOP: EOP stands for End of Packet. This field signals the data lines for Single Ended Zero(SE0) for approximately 2 bit times, followed by J state(idle state) for 1 bit time
Types of USB packets
Basically there are four types of data packets:
1. Token packets: These packets are only sent by host. The packet structure contains a PID byte, 11 bits of address and a 5-bit CRC. Types of token packets :
2. Data packets: Two types of data packets are there, Data0 and Data1. The packet structure contains a PID byte, data field and 16-bit CRC. The data field can carry 0- 1023 bytes of data. Data must be always sent in multiple of bytes.
After USB2.0, two more types were added Data2 and MData. They are only used in high speed transfer high bandwidth isochronous transfer when there is a need to transfer more than 1024 bytes at 8192 kB/s.
3. Handshake Packets: These packets are mostly sent in response to data packets. They simply consist of a PID byte. There are three types of handshake packets :

Transactions
A successful transaction consists of up-to three phases that occur in sequence. They are Token phase, Data phase and Handshake phase.
These phases ensured secure transfer of data. There are three types of transactions :
Types of USB Transfer
Types of USB Transfers
USB currently supports four types of transfer modes. Each of them is designed to solve different purposes. They are :
1. Control Transfers
Control transfers are used to carry information related to configuration of the peripheral device. The host learns about the peripheral through this transfer. It also supports command and status type communication flow. The default control endpoint is always zero. It is the control endpoint which responds to host queries like Device Description through control transfer.
There are three stages in control transfer and each stage is made up of one or more transactions. They are:
• Setup stage – The control transfer always begin with this stage. In this, the host sends the query/request to the USB device (peripheral).
• Data stage – In this stage, several IN or OUT transactions are made. The Data packet contains the information related to request made in previous stage.
Control Transfers are supported by all speed modes. The maximum data payload size for data packet in data stage is different for each speed mode. For low speed devices, it is 8 bytes. For full speed devices it may be 8, 16, 32 or 64 bytes. For high speed devices, it is 64 bytes. These bytes do not include PID and CRC bit.
Bulk Transfers are used to transfer large amount of data sequentially. They have no guaranteed bandwidth. The transfer takes place when there is some bandwidth left after allocating bandwidth to Control, Interrupt and Isochronous transfer. If there is no bandwidth available or the bus is busy, the transfer may take very long to complete.
3. Isochronous Transfers
They are unidirectional and uses either IN or OUT transaction. A special feature of Isochronous Transfer is that, there is no handshake packet in transaction. These are only supported by Full and High Speed devices.
4. Interrupt Transfers
In this type of transfer, IN and OUT transactions are performed on regular scheduled basis. The maximum data payload size for Interrupt transfer is different for each speed mode. For low speed devices, it is up to 8 bytes. For full speed devices it is up to 64 bytes. For high speed devices, it is up to 1024 bytes. These bytes do not include PID and CRC bits.
Filed Under: Articles
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.