Chapter 4 Software Development
Figure 4.1.2. Two USB Transactions
All bus transactions begin with a token packet from the host. Devices never initiate data transfers on their own.
The host controller is in charge of scheduling all traffic on the bus. It schedules the appropriate transactions for the four data flow types at
Token packet types include data request (IN), data transfer notification (OUT), and command transfer notification (SETUP).
4-1-6. Packets
A packet is a continuous bit stream starting with the synchronization pattern and flowing in one direction.
Table 4.1.3. lists the USB packet types.
PID Type | PID Name | Transmitter | Description |
Token | OUT | Host | Data transfer notification |
| IN | Host | Data request |
| SOF | Host | Start of frame |
| SETUP | Host | Data transfer notification for control pipe |
|
|
|
|
Data | DATA0 | Host/Device | Data packet PID even |
| DATA1 | Host/Device | Data packet PID odd |
|
|
|
|
Handshake | ACK | Host/Device | Receiver accepts |
| NAK | Device | Transmitter cannot send data |
|
|
| Receiver cannot accept data |
| STALL | Device | Control pipe request not supported |
|
|
| Endpoint halted |
|
|
|
|
Special | PRE | Host | Preamble enabling downstream bus traffic to |
|
|
|
|
4-1-7. Endpoints
The USB provides separate logical communication flows, called pipes, between the host and a USB function. The function end of a pipe is called the endpoint. This endpoint must provide buffer space (FIFO) capable of holding at least one data packet (a.k.a. the maximum payload size).
Endpoints and pipes are characterized, at creation, by the direction (from or to host) and by the data flow type (control, bulk, interrupt, or isochronous). There are provisions for up to 16 pipes in each direction, for a total of 32 endpoints per function. The token packet that the host transmits to initiate a transaction specifies the endpoint buffer with the endpoint address made up of the device address and the endpoint number.
USB device controller capacity is expressed by the number of endpoints it has and such endpoint specifications as supported data flow types and endpoint buffer sizes. Examining these endpoint specifications thus reveals whether the USB device controller is suitable for the intended application.
page