Skip to main content

Types of USB packets

Short answer

USB packets start with SYNC, PID and end with EOP. Four groups: token (OUT, IN, SETUP, SOF), data (DATA0/DATA1 with payload and CRC16), handshake (ACK, NAK, STALL, NYET) and special (PRE, ERR, SPLIT, PING). They control transactions between host and device.

The fundamental elements of communication on the USB data bus is a packet. Discuss various types of packets used in USB protocol.

Data on the USB bus is sent as packets. Every packet begins with a SYNC field (8 bits, to synchronise the receiver clock), then a PID (Packet Identifier, 4 bits + its 4-bit complement) and ends with an EOP (end of packet). The PID defines the packet type. There are four groups.

1. Token packets

Sent by the host to start a transaction. Format: SYNC, PID, address (7 bits), endpoint (4 bits), CRC5, EOP.

TokenMeaning
OUTHost will send data to the device
INHost requests data from the device
SETUPStarts a control transfer (command to the device)
SOFStart of Frame, sent every 1 ms (125 us in high speed) with an 11-bit frame number

2. Data packets

Carry the payload: SYNC, PID, data (0-1023 bytes; 8/64/512/1024 bytes by speed and transfer type), CRC16, EOP.

  • DATA0 and DATA1 alternate for data toggle synchronisation (error recovery); DATA2, MDATA are used in high speed.

3. Handshake packets

Only a PID; report the status of a transaction.

  • ACK: data received correctly.
  • NAK: device cannot accept or has no data now; try later.
  • STALL: endpoint halted or request not supported.
  • NYET: data accepted but not ready for the next (high speed).

4. Special packets

  • PRE: preamble that enables low-speed traffic through a hub.
  • ERR: error indication from a hub (split transaction).
  • SPLIT: split transaction for high-speed hub to full/low speed device.
  • PING: asks whether a high-speed endpoint can accept data.
 IN transaction : Host -> [IN token]  Device -> [DATA0] Host -> [ACK]
 OUT transaction: Host -> [OUT token][DATA1]  Device -> [ACK]

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 3 questions →