tags:

views:

1127

answers:

3

I am trying to connect to a single USB device using the USB host port on an Atmel processor. I have an embedded system with limited memory and no OS. I want to implement a simple dedicated host to interface to a single USB slave device.

Can anyone guide me to a simple USB host implementation?

The processor is the Atmel AT91SAM9261S.

+1  A: 

First of all if i remember correctly AT91SAM9261S have OHCI usb controller on board and you need to implement at least simple host controller driver (you can take a look on Linux implementation) . Depending on the transfer types your device will be using it might be not very hard - to very hard :) There is no trivial way to implement usb stack. After implementing a controller driver you will need to take care usb device enumeration part take a look at Chapter 9 of USB spec. And only after this you can start implementing your device logic.

For simplified use case there is a lot of code that could be omitted, but without good usb background is hard to decide what is relevant and what is not.

Any way if you are looking for commercial solution my company can provide one.

Ilya
A: 

This would be so much easier if your device didn't have to be a host :-P, because Atmel provides example source code for USB devices. If I were you, I'd look into using one of the USB-loving RTOSs on Atmel's AT91SAM third party page which might entail the USB stack from jungo as suggested by Ilya.

If you do write your own OHCI driver, libusb could be helpful as an implementation of the upper layers of the USB stack.

joeforker
+1  A: 

I've used the RTUSB-32 stack from On-Time. It is a small foot print stack and was easy to integrate into our environment and the documentation is good. They abstract out nicely the needed support so that it is completely platform and OS neutral and has a relatively small number of hooks you need to provide to it - ie: It is well encapsulated.

Since you get all the source, you'll see that the code is not the most well constructed code in the world, certainly, but it can be deciphered without a whole lot of work if needed. In any case, it basically "just works" without issue. We have had it running in some products for a few years now and have only run into one compatibility problem with the stack where it wasn't quite doing auto-discovery quite right with a certain type of USB 2.0 hub. We sent them a sample of the hub and they had a patch for it within a few days. Hard to beat that. Overall, I consider it a good value and certainly beats sitting down to write the thing from scratch.

Tall Jeff