Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12599 Discussions

USB Mass storage without uClinux

Altera_Forum
Honored Contributor II
1,190 Views

Hi, 

 

I develop on DE2-70 board. My project use an usb key to store any data. 

For now, I use uClinux. But I want to remove it, and develop directly on nios2. 

 

I only found FAT implementation which work with SD Card, not USB Key. 

 

On SLS example, I found an usb massstorage example. But I don't found code, and he use uClinux too. 

 

Do you have an idea ? 

 

Regards, 

Steph.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
385 Views

You will need to find a USB protocol stack - these are usualy large and complicated beasts! 

Once you've got that you'll be able to do sector read/write and then the FAT filesystem is trivial. 

I've not done an SD card driver, but I suspect it is a simple (well relatively simple) interface rather like the ATA disk one - so suitable for a simple PIO + interrupt driver.
0 Kudos
Altera_Forum
Honored Contributor II
385 Views

Thank you for your response. 

 

It's the problem. USB Mass storage is very complicated. In the first version of my project, I use linux for use its implementation of USB Mass storage. 

 

With SD Card, we have directly function to read/write bloc with IP.
0 Kudos
Altera_Forum
Honored Contributor II
385 Views

USB is logically (but not quite physically) polled, multi-drop hdlc. The standard requires very tight timing control for the poll loop (so that fixed speed targets can put fixed amounts of data into each poll cycle). 

The poll cycle is normally controlled by the uhci hardware module (or maybe the older ocpi??) which is what the linux driver is probably accessing. 

I've never looked at that hardware interface :-) it may not be that complicated if you have limited requirements. 

 

I'd actually guess that most slaves don't actual verify the poll rate, and that, a simple single target host interface could actually be done with a simple hdlc controller....
0 Kudos
Altera_Forum
Honored Contributor II
385 Views

Thank you for this response. 

 

Isp1362, the USB controller on DE2 board, takes cares the communication with USB pheripherals, include poll cycle. 

 

I found an example to etablish communication with a computer over USB(slave USB), but I found nothing for write on USB key (host USB).
0 Kudos
Altera_Forum
Honored Contributor II
385 Views

You'll need to extract a fair amount of code from various places, although you can probably rip out a lot of the functionality you don't need. 

 

A quick google search finds things like: 

 

http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=umass 

 

Which tend to show what you are up against!
0 Kudos
Reply