UsbAvrUsb
Monday, April 21st, 2008
UsbAvrUsb is a easy-to-use device-only USB library for Atmel AVR USB series microcontroller, it handles all the network layer logics like initialization basics and the control endpoint, and that will enable you to develop and focus the real core logic.
With the introduction of Atmel AVR USB series microcontroller, USB, after being invented for 12 years since 2006, finally becomes as cost competitive as, as easy to implment and program as RS-232. A feasible solution to enable communication between a PC and a microcontroller device.
With that MCU, like AT90USB162 which is the one I am using, implementing USB protocol in MCU project couldn’t be easier. Hardware-wise, it basically drill down to some passive components like the terminal resistors and two caps, as all other transceiver logic is embedded in the MCU. You saved the “max232″ transceiver and even an power voltage regulator in most gadget projects.
Background
Even though the AT90USB162 MCU is so called a USB series, the MCU only handles the hardware and datalink layer. The basic network link layer is still left as an homework for the developer!
I was trying to develop one simple HID, I found the sample provided by the Atmel too hard to understand and be customized, and I cannot find related “driver” for this “USB controller”. So I decided to reinvent-the-wheel, sort of.
I have gone through the pain to read the documents, understand the the control endpoint and emulation, the quirks of the MCU registers. Now, you don’t have to! Because I am releasing the code.
Through a simple editing of the usbconfig.h file, you can configure the basics of the device. Then the application logics can be done with a few hooks and logic.
I will finish writing up this page if I have more time. At the mean while, please feel free drop your question in the comment box or to my email directly :).
Features
- All network level logic is handled. Developer can focus at the application logic.
- Supports USB HID (Human Interface Device).
Devices that conform with HID profile needs no addition driver to work under Microsoft Windows, Linux, MacOS X and other major OS. Only userspace application is needed. - Simple usbconfig.h to config the behavior of the library.
- Clean interface to play with. Sufficient for mini to moderated size of project. Support Interrupt IN/OUT and Bulk Endpoints.
Usage
Currently this can only compiled by avr-gcc. Windows user might want to check out WinAVR.
Under your project folder, extract the usbavrusb.zip under it so that it will be in the sub-folder of your project. Copy <base>/usbavrusb/usbconfig-prototype.h to <base>/usbconfig.h. Then you should customize the usbconfig.h to fits your need, and reading usbavrusb/usbdrv.h to learn how to call the functions.
Please also refer to the my hColorLED project, an implementation using this library. Also UsbHid, an C# program for controlling USB-HID device in Windows.
Source Access
Subversion Repository: http://svn.hellosam.net/usbavrusb/trunk
Change Log
- v1.0.0.0
Initial release
License
UsbAvrUsb by Sam Wong is licensed under a GNU General Public License 2.0.
































































English