Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: USB host driver without an OS
PostPosted: Wed Jul 16, 2008 3:38 pm 
Offline

Joined: Thu May 29, 2008 11:30 pm
Posts: 13
I have a very simple embedded application I am building, for which having an OS would be overkill (not worth adding and dont have space for flash memory for filesystem). I will just be using the interrupts inherent to the AT91SAM9261 to run the system.

The problem is that I need to attach a USB device to this board. This device is a custom class type of device, where the host's application code will simply want to call 'read/write' functions that send/receive certain amounts of data.

My question is this: The AT91SAM9261 has a USB Host Controller that is OHCI compliant. What is the best way to write a driver to do this without using, e.g. Linux (or any OS). Is it possible to just take standard OHCI driver source code and just compile it for this processor? If so, is there free OHCI driver code available anywhere?

I'm a USB and embedded micro newbie, so any help would be appreciated. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 9:20 pm 
Offline

Joined: Thu Mar 23, 2006 4:37 pm
Posts: 13
I would also like to find a "free" OHCI driver.

I have found several commercial products (SMC, Jungo, thesyscom)
Most seemed to be derived from BSD.

If you find a promising package please post

Good Luck,

Larry


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 10:16 pm 
Offline

Joined: Thu May 29, 2008 11:30 pm
Posts: 13
I have actually decided to just write my own driver. Since I am only interfacing to a single device, which will be plugged in at all times, I have decided that it won't be too difficult to just write a simple driver.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2008 10:19 am 
It sounds good !


Top
  
 
 Post subject: USB host functionality unusable?
PostPosted: Tue Aug 19, 2008 1:01 pm 
Offline

Joined: Tue Aug 19, 2008 11:41 am
Posts: 3
I also intend to use the USB host port from a simple OS less application on the AT91SAM9263. I am having trouble finding relevant information of how to access the USB host port however. Of the >800 pages in the Atmels AT91SAM9263 Preliminary document only three pages are dedicated to the USB host ports, and those pages does not say much either... Not a single USB host/ OHCI memory/register location is mentioned.

The .h files in the software framework (AT91lib & USB framework) has no USB host related definitions what so ever. From what I can tell the USB host functionality on the Atmel AT91SAM9263 is totally unsupported/undocumented.

Have I missed something? Is there any other place where I can find relevant information?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 19, 2008 4:59 pm 
Offline

Joined: Thu May 29, 2008 11:30 pm
Posts: 13
The host controller follows the OHCI spec, so all of the registers correspond directly to what is in that spec. I haven't gotten around to writing code yet, but from reading the spec and matching it up with what's in the datasheet, it looks like the USB Host Port (UHP) registers start at address 0x500000, where the registers are defined as in Section 7 of the OHCI spec, 'Operational Registers'. You can download the OHCI spec from here:

ftp://ftp.compaq.com/pub/supportinformation/papers/hcir1_0a.pdf


Top
 Profile  
 
 Post subject: Re: USB host driver without an OS
PostPosted: Sat Oct 04, 2008 4:58 pm 
Offline

Joined: Thu May 29, 2008 11:30 pm
Posts: 13
I finally got around to starting this code, and I am having trouble figuring out the appropriate UHP startup sequence. What I am doing so far is:

1. Enable the UHP peripheral by enabling the clocks.
2. Check revision of UHP in HcRevision register.
3. Reset Host Controller (HC)
4. Initialize the HCCA, Control, and Bulk Endpoint Descriptors.
5. Enable the interrupts I want on the UHP.

Is this correct? The ohci spec says that the HC reads the address of the HCCA (that the Host Controller Driver inits, step 4 above) upon initialization. When does that initialization of the HC occur? Do I have to change the status of the HC from UsbSuspend to UsbOperational in the HcCommandStatus register?

The other question I have is I do not understand what the Function Address and Endpoint Number fields are supposed to be in the Endpoint Descriptor structure.

Thanks.


Top
 Profile  
 
 Post subject: Re: USB host driver without an OS
PostPosted: Wed Aug 05, 2009 7:53 pm 
Offline

Joined: Tue Jul 07, 2009 4:20 pm
Posts: 11
If you have not figured out an answer to your question, the following may help.

Sun Microsystems developed a platform called SunSpot based on the AT91RM9200 processor. For it they have developed a library for controlling USB. If you are interested, you can download their source code from svn:

https://spots-core-libraries.dev.java.n ... ries/trunk

username: guest
password: guest

Look into the trunk/arm-bootloader/src/usb directory to see the USB code.

Although the processor they use is a little different, hopefully this example will be helpful.


Top
 Profile  
 
 Post subject: Re: USB host driver without an OS
PostPosted: Wed Aug 05, 2009 8:01 pm 
Offline

Joined: Thu May 29, 2008 11:30 pm
Posts: 13
Thanks exvagabond,

I will take a look at this, but unfortunately this is for a device side driver and not host side.

I have actually made a fair amount of progress on this recently. I can do control transfers. Bulk transfers however hang because for some reason the bus enters the SUSPEND state. I'm trying to figure out whether it is the device or my host that is causing this.

Thanks again.


Top
 Profile  
 
 Post subject: Re: USB host driver without an OS
PostPosted: Tue Sep 01, 2009 7:33 pm 
Offline

Joined: Tue Sep 01, 2009 7:18 pm
Posts: 1
Location: England
Would you be willing to share here some of your initialisation code?

I too am struggling to find any documentation on the USB Host Controller functions. All the examples are for the USB device ports!


Top
 Profile  
 
 Post subject: Re: USB host driver without an OS
PostPosted: Sat Dec 19, 2009 9:20 am 
Offline

Joined: Sat Dec 19, 2009 4:23 am
Posts: 1
I have tried to port a USB host drive from the uboot1.1.5 to drive a storage in my board, it seemed like working well, but is not so stable for that which capacity is more than 2GB.
In the uboot code, you can fine the host side code to drive an USB.


Top
 Profile  
 
 Post subject: Re: USB host driver without an OS
PostPosted: Mon Sep 26, 2011 10:35 am 
Offline

Joined: Fri Sep 23, 2011 12:01 pm
Posts: 5
Hello budhe888,
I'm working with at91sam9g45.Can you please help me in the same regard.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: