• Control data exchange
• Data exchange in the form of actual payload
USB packet fields
In USB, the LSB of the packet is transmitted first. A USB packet contains different fields. They are:
• Synchronize : It is a mandatory field that occurs at the beginning of the package. This field synchronizes the receiver's clock with the transmitter. For low and maximum speed mode, this field is 8 bytes and for high speed mode it is 32 bytes.
• PID : PID stands for packet ID. Indicates the type of packet being sent. This field is 8 bits long. The upper four bits identify the packet type and the lower four bits are a bitwise complement of the upper four bits. The bottom four bits help with error detection.

Fig. 1: Table listing USB packet fields
• ADDR : This field contains the designation address of the USB device. It is 7-bit, which means it can support 27¬=127 devices.
• PEND : This field specifies the terminal number. It is 4 bits, which 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.
• POE : EOP means End of Packet. This field signals the data lines to Single Ended Zero (SE0) for approximately 2 bit times, followed by the J state (idle state) for 1 bit time.
Types of USB packages
Basically, there are four types of data packages:
1. Token Packets : These packets are sent by the host only. The packet structure contains a PID byte, 11 address bits, and a 5-bit CRC. Types of token packages:

Fig. 2: Image showing the data format of token packets
2. Data packets: There are two types of data packets, Data0 and Data1. The packet structure contains a PID byte, data field, and 16-bit CRC. The data field can carry 0 to 1023 bytes of data. Data must always be sent in multiples of bytes.

Fig. 3: Image showing the data format of the data packets
After USB2.0, two more types were added, Data2 and MData. They are only used in high-speed transfer and 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 mainly sent in response to data packets. They simply consist of a PID byte. There are three types of handshake packets:

Fig. 4: Image showing the data format of the 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.

Fig. 6: USB transaction block diagram
These phases ensured secure data transfer. There are three types of transactions:

Fig. 7: Table listing USB transaction types
USB transfer types
Types of USB Transfers

Fig. 8: Table listing 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 peripheral device configuration. 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 that responds to host queries such as Device Description through control transfer.
There are three steps in the transfer of control and each step is made up of one or more transactions. They are:
• Configuration stage – Control transfer always begins at this stage. In this, the host sends the query/request to the USB device (peripheral).
• Data stage – In this phase, several IN or OUT transactions are carried out. The Data package contains information related to the request made in the previous step.
Control transfers are supported for all speed modes. The maximum data payload size for data packets in the data stage is different for each speed mode. For low-speed devices, it is 8 bytes. For full-speed devices, it can be 8, 16, 32, or 64 bytes. For high-speed devices, it is 64 bytes. These bytes do not include PID and CRC bits.
Bulk transfers are used to transfer large amounts of data sequentially. They are not guaranteed bandwidth. Handoff occurs when some bandwidth remains after allocating bandwidth for control, interrupt, and isochronous handoff. If there is no bandwidth available or the bus is busy, the transfer may take a long time to complete.
3. Isochronous transfers
They are one-way and use IN or OUT transactions. A special feature of Isochronous Transfer is that there is no packet handshake in the transaction. They are only supported by Full and High Speed devices.
4. Stop transfers
In this type of transfer, IN and OUT transactions are carried out regularly. 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.

Fig. 9: Table comparing types of USB transfers

Fig. 10: Table comparing types of USB transfers

Fig. 11: Table listing transactions for different USB transfers