This software implements a Low Speed (1.5 Mbps) USB 2.0–compliant Host Controller on the Atmel Mega32 microcontroller.
This project has yielded a library that can be included from any program written for the Mega32. Using this library, a user can implement USB functionality within their application. The library has a high level asynchronous I/O interface with transparent layering that also allows library users to perform low-level operations on the bus.
Documentation supplied by the USB Implementer's Forum and various summary articles allowed for the development and implementation of the USB protocol stack for the Atmel Mega32.
The prominence of microcontroller-based embedded design and a steadily increasing base of USB peripherals provided the impetus for this project. Previous implementations of USB software solutions have been successfully implemented on more powerful microcontrollers[1], and it was hypothesized that a scaled down version of such an implementation would be possible using Atmel's 8-bit ISA. A fully functional Low Speed (1.5 Mbps) USB Host Controller was created for the Atmel Mega32 using an ANSI C99 code base using with a processor option for optimized Atmel 8-bit assembly. From this code base, USB communication was established, and an API was created for peripheral utilization. These results demonstrate the propensity for a Low Speed device's use in the 8-bit AVR programming environment. This project was also notably successful in achieving goals of hardware simplicity, unobtrusiveness when used as a software library, complete originality of code, and production of solely open source software.
1. Jungo Software extended its USB software stack implementation to include Atmel's ARM7 and ARM9 microcontrollers, which use a 32-bit ISA. This implementation runs at Full Speed (12 Mbps).
This project was started as an ECE476 final project in Cornell's College of Engineering by Ben Hutton, Chris Leary and Devrin Talen. Chris and Devrin undertook an independent study (ECE491) in which the code library, hardware schema, and documentation were vastly improved.
Does the SIAM32 library work with flash drives/card readers/802.11abg adapters?
No. There are three speeds defined in the USB protocol: low, full, and high speed. Our library only implements the low speed USB protocol. This speed allows communication with interactive devices; e.g. mice and keyboards. Our library does not (and cannot possibly) support devices in question, since they require a full or high speed implementation of the protocol.
Why is only low speed supported?
The Mega32 is not fast enough to support the full or high speed USB protocols. The full speed protocol requires the bus to operate at 12 MHz, while the Mega32 has a maximum clock rate of 16 MHz. A 12 MHz bus speed requires a bit transfer every 1.5 cycles from a 16 MHz SoC, which we have found to be impossible to do (for buffers on the order of 100 bytes) using Atmel's 8-bit assembly. A further explanation of encountered limitations is given in our documentation. If you have found a way to do the impossible, be sure to let us know!
How do I begin using the library?
Download the documentation and begin reading the chapter titled “Using SIAM32”.
How do I contribute to the project?
Feel free to send us code or documentation patches at any of our above contact locations. Community contribution is part of the beauty of OSS!
What USB references do you recommend?
We realize that understanding the USB protocol is not simple. There is a lack of beginner-oriented information on the web, but we've done our best to document which sites and papers made our life easier in the reference section. Additionally, we've included some protocol synopses in our documentation; however, the USB Specification is always the most definitive (and hopefully the most unambiguous) resource.
Below are some pictures taken during various stages of the project.
This code is released under the GNU Public License.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
All of our code is original. Our CRC5 algorithm was inspired by Ron Hemphill's CRC5 code and our CRC16 algorithm was greatly assisted by instructions in a USB.org CRC whitepaper.
The USB2.0 Specification is provided at http://www.usb.org/developers/docs/ with the following disclaimer:
LEGAL DISCLAIMER
THIS SPECIFICATION IS PROVIDED "AS IS" AND WITHOUT ANY WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED. WITHOUT LIMITATION, THERE IS NO WARRANTY OF NON-INFRINGEMENT, NO WARRANTY OF MERCHANTABILITY, AND NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. ALL WARRANTIES ARE EXPRESSLY DISCLAIMED.
USER ASSUMES THE FULL RISK OF USING THIS SPECIFICATION. IN NO EVENT SHALL USB-IF BE LIABLE FOR ANY ACTUAL, DIRECT, INDIRECT, PUNITIVE, OR CONSEQUENTIAL DAMAGES ARISING FROM SUCH USE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
An adopter's agreement is available at http://www.usb.org/developers/docs/adopters.pdf, used to enter into a crosslicensing agreement with other USB implementers. We did NOT fill out this agreement.
We are not using any code or specification that requires licensing. For us to legally use the USB logo on any of our material, we would need to either pay a $2000 fee or join the USB Implementers Forum. We haven't, so we aren't using the logo.
We are licensing our code under the GPL (see License section). You may feel free to use it, modify it, and distribute it, according to the terms and conditions of the license.
Release: siam32-0.2a.tar.bz2 [80K]
Docs: siam32-0.2a.pdf [376K]
Latest build: SIAM32 [launchpad]
Old website: download [1.3M]
Got bug patches? Questions? We try our best to answer email, but the FAQ is your best bet for quick answers.
Christopher D. Leary
Devrin Talen