Peripheral Control Module

11.8.1.4Packet Formats

USB supports four packet types: token, data, handshake, and special. A token packet is placed at the beginning of a frame and is used to identify OUT, IN, SOF, and SETUP transactions. OUT and IN frames are used to transfer data, SOF packets are used to time isochronous transactions, and SETUP packets are used for control transfers to configure endpoints. A token packet consists of a sync, a PID, an address, an endpoint, and a CRC5 field (see Figure 11-16). For OUT and SETUP transactions, the address and endpoint fields are used to select which UDC endpoint is to receive the data, and for an IN transaction, which endpoint must transmit data.

Figure 11-16. IN, OUT, and SETUP Token Packet Format

8 bits

8 bits

7 bits

4 bits

5 bits

Sync

PID

Address

Endpoint

CRC5

 

 

 

 

 

A start of frame (SOP) is a special type of token packet that is issued by the host once every 1 ms. SOF packets consist of a sync, a PID, a frame number (which is incremented after each frame is transmitted), and a CRC5 field, as shown in Figure 11-17. Even though the UDC on the SA-1100 does not make use of the frame number field, the presence of SOF packets every 1ms will prevent the UDC from going into suspend mode.

Figure 11-17. SOF Token Packet Format

8 bits

8 bits

11 bits

5 bits

Sync

PID

Frame Number

CRC5

 

 

 

 

Data packets follow token packets, and are used to transmit data between the host and UDC. There are two types of data packets as specified by the PID: DATA0 and DATA1. These two types are used to provide a mechanism to guarantee data sequence synchronization between the transmitter and receiver across multiple transactions. During the handshake phase, both communicate and agree which data token type to transmit first. For each subsequent packet transmitted, the data packet type is toggled ( DATA0, DATA1, DATA0, and so on). A data packet consists of a sync, a PID, from 0 to 1023 bytes of data, and a CRC16 field, as shown in Figure 11-18.

Figure 11-18. Data Packet Format

8 bits

8 bits

0–1023 bytes

16 bits

Sync

PID

Data

CRC16

 

 

 

 

Handshake packets consist of only a sync and a PID. Handshake packets do not contain a CRC because the PID contains its own check field. They are used to report data transaction status, including whether data was successfully received, flow control, and stall conditions. Only transactions that support flow control can return handshakes. The three types of handshake packets are: ACK, NAK, and STALL. ACK indicates that a data packet was received without bit stuffing, CRC, or PID check errors. NAK indicates that the UDC was unable to accept data from the host or it has no data to transmit. NAK is also used by endpoint 1 to indicate no interrupts are pending. STALL indicates that the UDC is unable to transmit or receive data, and requires host intervention to clear the stall condition. Bit stuffing, CRC, and PID errors are signalled by the receiving unit by omitting a handshake packet. Figure 11-19shows the format of a handshake packet.

Figure 11-19. Handshake Packet Format

8 bits

8 bits

Sync

PID

 

 

11-60

SA-1100 Developer’s Manual

Page 210
Image 210
Intel SA-1100 manual Packet Formats, Pid, CRC5, CRC16