|
Taking a Look at the USB
by Don Powrie
Start ı Speed
Limit ı The Mechanics ı Destination
ı Sources and PDF
SPEED LIMIT
Version 1.1 of the USB specification
outlines two data ratesılow speed, which transfers data at 1.5 Mbps,
and full speed, which transfers data at 12 Mbps. The FT8U245AM transfers
data at a maximum of 8 Mbps, somewhat slower than full speed but still
much faster than the RS-232. In order to achieve the 8-Mb data rate,
the target microcontroller must be able to read and write data every
125 ns. This is a tall order for most microcontrollers unless they
are running at high clock speeds.
Another limiting factor for most USB
devices is the 1-ms frame. USB devices transfer data in packets. If
data is to be sent from the PC, a packet is built up by the application
program and sent via the device driver to the USB scheduler. This
scheduler puts a request to the list of tasks for the USB host controller
to perform. This will typically take at least 1 ms to execute because
it will not pick up the new request until the next 1-ms USB frame.
Therefore, there is a sizable overhead,
depending on your required throughput, associated with moving the
data from the application to the USB device. If data is sent one byte
at a time by an application, the overall throughput of the whole system
will be severely limited. The message here is that, if speed is critical,
always send data in packets.
The specification for USB 2.0 is a good
example of just how complicated a communications protocol can be.
[1] Itıs easy to get lost in the myriad of details that outline USB
communications. Thankfully, FTDIıs drivers hide most of these details
and provide an easy to use interface.
With some programming languages, you
can communicate via RS-232 ports (including the VCPs) by using a statically-linked
communications library that handles the interrupts and provides an
easy programming interface (open, read, write, etc.). Using this type
of communications library presents an extra step, which you, purely
for simplicityıs sake, might like to avoid.
FTDI recently released a new version
of their drivers that is based on a dynamically-linked library (DLL).
The application program simply requests the operating system to load
the DLL at runtime, calls the open function to connect to the FT8U245AM
device, and starts reading and writing data to and from the FT8U245AMıs
FIFO memory. No other statically-linked communications library is
required. Programming examples for how to use the DLL with various
compilers are available for download from FTDIıs web site.
PREVIOUS NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ıCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |