Introduction To USB Part V
Introduction To USB Part V
Part I
Part II
Part III
Part IV
A transfer is the largest unit of communication in USB, and consists of one or more transactions
that can carry data to or from an endpoint. A transaction is made up of a sequence of three packets:
token, data, and (in most cases) a handshake packet.
For IN and OUT transactions used for isochronous transfers, there are only two packets. The
handshake packet on the end is omitted. This is because error-checking is not required for IN and
OUT transactions.
To ensure that the host and devices remain synchronized, bus timing is broken down into segments
of a fixed duration. For low- or full-speed buses, the bus time is divided into 1-millisecond units,
called frames. For a high-speed bus, the bus time is divided into 125 microsecond units, called
microframes.
The first packet of each frame is the Start-Of-Frame packet (SOF). In low and full speed, a frame is
transmitted every 1 ms.
At high speed the 1 ms frame is divided into eight microframes. A SOF packet is sent at the start of
each of these eight microframes, each having the same frame number, which then increments every
1 ms.
On a low speed link, to preserve bandwidth, a Keep Alive signal is sent every millisecond, instead of
a Start of Frame packet. In fact Keep Alives may be sent by a hub on a low speed link whenever the
hub sees a full speed token packet.
At high speed it is possible to specify up to three isochronous or interrupt transfers per microframe,
rather than the 1 transfer per frame of full speed; giving a maximum possible isochronous or
interrupt transfer rate of 192 Mb/s.
No more than 90% of any frame to be allocated for periodic transfers (Interrupt and Isochronous) on
a full speed bus (80% in high speed).
In a highly saturated bus with periodic transfers, the remaining 10% is left for control transfers and
once those have been allocated, bulk transfers will get its slice of what is left.
Note: It is important when designing an embedded system to determine which transfer mode will be
used as it can have a high impact on the product performance. For example, using the Interrupt
transfer can guarantee a good bandwidth usage. And, it also allows the vendor to use HID drivers
from the General Purpose Operating Systems (GPOS) for its product. Using a Bulk transfer requires
a custom driver on the GPOS.
All USB transactions are performed in 1mSec frames (LS and FS) or 125 μsec frames (HS) initiated
by the Host. Time Division Multiplexing is used to separate packets or transactions from different
sources within each frame.
1-11 USB'S ACTUAL THROUGHPUT
● The target device’s ability to send or receive data (processor clock, DMA support)
● The bandwidth consumption of other devices on the bus
● The efficiency of the host's USB software stack
Assuming that only the device endpoint consumes bus bandwidth, and that both the device and the
host are able to send or receive data as fast as USB can move it, then the maximum attainable
bandwidth is a function of the transfer type and signaling rate.
Each transfer type determines various characteristics of the communication flow, including the
following:
A transaction of a particular transfer type typically requires multiple packets. The protocol overhead
for each packet includes:
● An 8-bits (FS/LS) or 32-bits (HS) SYNC field
● A PID byte
● A 3-bit (FS/LS) or 8-bit (HS) EOP
● In a token packet: endpoint number + device address + CRC5 = 16 bits
● In a data packet: 16-bits CRC16 + any data field (8 bits per byte)
● For transaction with multiple packets, the inter packet gap or bus turnaround time required.
Next: Enumeration
µC/USB Device: Universal Serial Bus Device Stack for the Renesas RX63N, Chapter 2, by
Christian Legare, is excerpted with permission. The text is available at Micrium.