|
FOR AN EMBEDDED PROCESSOR
by Stuart Allman
Start ý Typical
USB Solutions ý Required Components
ý An Easier Solution ý Following
the Rules ý Firmware ý Vendor-Specific
Requests ý Host Transfer Mechanisms
ý USB Transfers ý How
Does It Work? ý The Grand Conclusion
ý Sources and PDF
FIRMWARE
Typically, the CY7C64013 HAPI will be connected
to a microprocessor data bus. For demonstration purposes, I have written
firmware for an MC68331, AT91M63200 (ARM7DTMI) processor, and ADSP-21065L
DSP to interface to the USB. Connection diagrams for each of these
processors are shown in Figures
2, 3, and 4,
respectively. The MC68331 code was developed on a proprietary system,
the ARM7TDMI code was developed on an AT91EB63 evaluation kit, and
the SHARC code was developed using a SHARC 21065L EZ-LAB. Because
the processor interface is generic, I wonýt spend time discussing
the specifics of these processors.
The USB driver that comes with the design
package for this article is a generic device driver that currently
comes with the Cypress EZ-USB development kit. Before you plug in
the device, you need to install the ezusb.sys driver using
the ezusbw2k.inf file. In the ezusbw2k.inf file, you
will find a list of device names and their associated VID and PID.
Anytime you modify the VID and PID of your peripheral, you need to
reinstall this device driver so the main USB driver can associate
your device driver with the peripheral.
Automatic driver creation tools for the
Microsoft Windows platform are also available from companies such
as Jungo, BSQUARE, and NuMega. Some of these tools are wizard-driven,
and others allow you to just plug in your device and the software
configures a driver for you. This software can help you avoid the
nightmare of developing a WDM driver and will probably equal the cost
of hiring a consultant to create a custom driver for you. The driver
creation tools will also require that you have a Windows compiler
such as Visual C++ along with the Microsoft DDK.
There is also the possibility that, with
a little modification of the USB descriptors in embedinf.h,
you can use the Microsoft Point of Sale (POSUSB) driver. This driver
effectively allows you to interface your USB device like a RS-232
port on your USB host. For more details, check out the Resources at
the end of the article.
The drawback of using this driver is
that you lose the ability to form your own vendor-specific requests.
You also may need to investigate throughput with this driver because
it was designed to emulate serial port connectivity to point-of-sale
devices.
In order to test your new, fabulous USB
interface, I have written a test application that connects to the
ezusb.sys device driver. The host application is shown in Photo
1, and a number of vendor-specific
requests are shown in Tables
1 and 2. Included are GET_IO,
SET_IO, SET_TIMEOUT, and SEND_IMMEDIATE.
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. |