QuickUSB and the Big USB Picture
I/O Subsystem Latency and Throughput
The period of time between the start of a transfer and the time that it actually
occurs is the
transfer latency
. USB transfer latency is the result of several
factors. First is the fact that the USB is a frame oriented bus and that all
packets must be scheduled to a timebase of either 1ms (full speed) or 125us
(Hi-Speed). Secondly, the operating system generally assesses a software
latency penalty when switching from user mode to kernel mode.
Throughput
is a measure of data transfer speed and is generally expressed in
megabytes per second (MB/s). Transfer latency affects throughput because it
increases the amount of time a transfer takes regardless of the connection
speed.
However, as the data transfer size becomes larger, the transfer latency
becomes a smaller fraction of the total transfer time thereby diminishing its
effect. When the transfer size is small, the transfer latency will seriously
degrade throughput.
Therefore, for applications that require the highest throughput, transfer sizes of
at least 64KB are recommended.
Another way to mitigate transfer latency issues is to minimize the amount of
time that the USB subsystem waits to schedule USB packets. You can
accomplish this using asynchronous function calls. With asynchronous function
calls, the transfer is scheduled when the function is called, but the function
returns without waiting for the transfer to complete. Using this mechanism, one
can concurrently schedule enough USB transfers to assure that the USB will not
idle waiting for data to be transferred to or from your device.
The simplest and most reliable technique for this is to employ multiple transfer
buffers and rotate them on an as-needed basis.
USB Interpacket Delay
In certain circumstances, the USB target interface bandwidth is greater than the
USB bus bandwidth. This is the case with the Cypress EZ-USB FX2LP
microcontroller. In word-wide mode, the FX2LP can transfer data at up to
96MB/sec. The maximum theoretical throughput of a Hi-Speed USB 2.0 pipe is
54MB/sec. Because the FX2LP can go faster than the USB pipe, the target
interface is subject to periods of bus inactivity (‘gaps’) between data packets.
Your system design should take into consideration the strong that there will be
gaps between data packets and deal with them accordingly.
2
I/O Subsystem Latency and Throughput