Home > Articles > USB One Minute Course
USB One Minute Course
Every USB communication is between a host and a device. The host manages traffic on the bus, and the device responds to communications from the host. USB 2.0 supports three bus speeds: 480 Mbps (high speed), 12 Mbps (full speed), and 1.5 Mbps (low speed).
A device endpoint is a buffer that stores received data or data to transmit. Each endpoint has a number, a direction, and wMaxPacketSize, which is the maximum number of data bytes the endpoint can send or receive in a transaction.
Each USB transfer consists of one or more transactions that can carry data to or from an endpoint. A transaction begins with a token packet that specifies an endpoint number and direction. An IN token packet requests a data packet from the endpoint. An OUT token packet precedes a data packet from the host. In addition to data, each data packet contains error-checking bits and a packet ID (PID) with a data-sequencing value. Many transactions also have a handshake packet where the receiver of the data reports success or failure of the transaction.
USB supports four transfer types: control, bulk, interrupt, and isochronous. In a control transfer, the host sends a defined request to the device. On device attachment, the host uses control transfers to request a series of data structures called descriptors from the device. The descriptors provide information about the device’s capabilities and help the host decide what driver to assign to the device. A class specification or vendor can also define requests.
Control transfers have up to three stages: Setup, Data (optional), and Status. The Setup stage contains the request. The Data stage contains data from the host or device, depending on the request. The Status stage contains information about the success of the transfer.
The other transfer types don’t have defined stages. Instead, higher-level software defines how to use the data.
Bulk transfers are the fastest on an otherwise idle bus but have no guaranteed timing. Printers and USB virtual COM-port data use bulk transfers.
Interrupt transfers have guaranteed maximum latency, or time between transaction attempts. Mice, keyboards, and virtual COM-port status notifications use interrupt transfers.
Isochronous transfers have guaranteed timing but no error correcting. Streaming audio and video use isochronous transfers.