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.
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.
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.
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....
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).
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!