ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

IMPLEMENTING A SIMPLE USB INTERFACE FOR AN EMBEDDED PROCESSOR


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

IMPLEMENTING A SIMPLE USB INTERFACE

Lessons from the Trenches 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

FOLLOWING THE RULES

There are a number of rules that the device must follow that are not immediately obvious for a peripheral to be USB compliant, and often these cause a great deal of forehead bruising for the first-time developer. If these tasks are taken care of by the CY7C64013 microcontroller, then the embedded processor doesnýt even need to know that itýs connected to the USB.

Luckily for you (and your sanity), that piece of firmware has already been written and comes with the design package for this article. Enumerating the bus is nearly a standard procedure, so the CY7C64013 firmware can become a black box in your design. All you will need to specify are a few parameters for the enumeration to be technically correct for your particular device. I have specified default parameters to get you up and running, but obviously these will change during your development process. The parameters are defined as constants in the embedinf.h file and include VID, PID, power source, and current draw.

Vendor ID is a two-byte value assigned by the USBIF (http://www.usb.org) when you join. I have set this to 0x04B4, the Cypress Semiconductor VID.

Product ID is a two-byte value assigned by you to identify your USB products. This default value of this parameter is arbitrarily set to 0x6401. Assign this parameter however you wish, as long as it doesnýt conflict with another product with the same VID.

This value can be bus-powered or self-powered so the host knows if you are going to draw current from it. By default this value is set to self-powered. One of the advantages of USB over RS-232 is that the USB host can provide up to 100 mA for a standard bus-powered device and up to 500 mA for a high-power device. See the USB specification for more details on power limits.

If it is bus-powered, then the host needs to know how much current you plan to draw. By default, the current draw is zero because the device is self-powered.

Besides the physical connections to the USB, this is all you need to know. If you can write to memory without hurting yourself, you can get on the bus.

When you change these parameters, you need to recompile the embedinf.c microcontroller firmware using the ByteCraft M8 Series C compiler and program a microcontroller. Unfortunately, the microcontrollers are OTP, so plan on having a few on hand if you intend to test different products using this interface.

PREVIOUSNEXT


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.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ