USB is the de facto interconnection standard for low- to mid-range PC peripherals. The latest version, USB 2.0 moves USB from a 12-Mb/s peak bandwidth to a 480-Mb/s peak. USB 2.0 allows engineers to interconnect peripherals with rates of up to 50 MB/s, such as disk drives and multimedia devices. USB 2.0 is downward-compatible with the older low-speed, low-power mode (1.5-Mb/s) and full-speed mode (12-Mb/s). For the host, the older USB modes are implemented separately. For hubs, USB 2.0 implements a split-transaction for the older modes running on high-speed lines.
This is a host-oriented bus—that is, all USB transactions are initiated by the host. But on configuration, called enumeration, the devices provide the host with USB program scripts for host-to-peripheral operations. The host executes these scripts when interacting with the devices. Periodically, the devices are polled by the host for interrupts and other conditions that require host action.
Protocol LayersFunction Layer—interconnects the host client software to a device interface, which can have multiple endpoints. Each endpoint connection is a pipe, a defined transfer mechanism.USB Device Layer—links the USB system software in the host to the USB logical device. It provides a default pipe connection to endpoint 0, the main configuration and control point for the device.
USB Bus Interface Layer—provides the physical wire connection between the host's USB Serial Interconnect Engine (SIE) and the USB Device's SIE. This is the basic USB serial connection between the two hardware engines. The USB host controller at this level interchanges USB frames and USB transaction packets with the SIE.
PERFORMANCE |
|
FUNCTION |
|
USB defines 4 types of data transfers. These are transfers between the host and an addressed device. USB uses the mechanism of pipes to assign connections between the host software and a given device and its interface functions. A device can have multiple interfaces. Each interface supports multiple connections, which are referred to as pipes. A pipe explicitly connects the host software to a defined "endpoint," or device interface connector.
These pipes can be explicitly managed. Bandwidth capacity can be assigned to these pipes by the USB host software. This strategy ensures adequate available bandwidth for USB operations such as isochronous and bulk data transfers. It additionally provides an easy mapping from the application software to a specific device function interface.
These pipes connect through the second and third layers of the USB protocol. Each device has a control endpoint (endpoint 0) linked through a pipe at the device level (second layer). All other endpoint connections are at the highest layer (third layer). There are 2 kinds of pipes: message and stream. Message pipes are two-way structured. Stream pipes are uni-directional and unstructured to pass data streams.
Applications start USB operations by generating an Interrupt Request Packet (IRP). This IRP is converted by the operating-system USB software into one or more USB transactions of the same transfer type—bulk, control, interrupt, or isochronous transfers. Each transfer is defined as a set of up to 3 sequential packets. (The only exception is a split-transaction, added to support slow- or full-speed USB on a high-speed USB connection, and that has 4 packets. They separate the token packet request from the downstream response packets). Transactions can consist of only 1 packet. However, all transactions start with a token packet.
Transfer Type Comments: | |
Bulk | Transfers large amounts of data. Has sequential delivery with error detection to insure reliable delivery. |
Control | Used by the host to configure devices when first attached. Also employed by the host to control transfers and configurations. |
Interrupt | A limited latency delivery mechanism for device transfers to the host. The device specifies the delivery rate and latency, which is implemented by the host. These tend to be periodic transfers. |
Isochronous | Transfer mechanism for continuous, real-time transfers. Defines delivery rate for receiving and transferring the isochronous data, as well as scheduling the transfers. Used for data like voice or audio that must have continuous, real-time delivery. |
Bulk Transactions—provide guaranteed error-free delivery of data using error-detection and retry capabilities. The bulk transaction consists of 3 packets: In/Out token packet, a Data packet, and an ACK handshake packet. To read data in, the host issues the In token packet. If the device is temporarily unable to respond, it issues a NAK data packet; if it's permanently halted, it issues a Stall data packet.
Control Transactions—have a minimum of 2 transaction stages: Setup and Status. The control transfer may also have a data stage between the Setup and Status stages with one or more In/Out data transactions. The basic control transfer consists of a Setup token packet, a Data token packet, and a Handshake (ACK) packet. A no-data control transaction is made up of a Setup token packet, followed by a Status In packet.
Interrupt Transactions—move data to or from the device endpoint. They consist of In or Out transfers. The sequence is started by the In token packet, followed by a Data packet, and ended by a handshake (ACK) packet. If problems occur, the In or Out token may be followed by a NAK or Stall packet, depending on the terminating condition.
Isochronous Transactions (ISO)—consist of a token phase and a data phase. There's no final handshake packet to close out the transaction. The host will issue an In or Out token packet. This is then followed by the Data packet, which transmits data to or from the addressed endpoint. ISO transactions have no retry capability.
PacketsTransfer Type Comments: | ||
Type | Name | Comment |
Token | OUT IN SOF SETUP |
Address + endpoint number in host-to-function transaction Address + endpoint number in function-to-host transaction Start-of-frame marker and frame number Address + endpoint number in host-to-function transaction for SETUP to a control pipe |
Data | DATA0 DATA1 DATA2 |
Data packet PID even Data packet PID odd Data packet PID high-speed, high-bandwidth isochronous transaction in a microframe |
Handshake | ACK NAK STALL NYET |
Receiver accepts error-free data packet Receiving device cannot accept data or transmitting device can't send data Endpoint is halted or a control pipe request isn't supported No response yet from receiver |
Special | PRE ERR SPLIT PING |
(Token) Host-issued preamble. Enables downstream bus traffic to low-speed devices (Handshake) Split Transaction Error Handshake (reuses PRE value) (Token) High-speed Split Transaction Token (Token) High-speed flow-control probe for a bulk/control endpoint |
Reserved | Reserved PID |