Go Down

Topic: Code for mass Storage Device (Read 1 time) previous topic - next topic


So I got my Arduino and my USB host shield the other day and it's great stuff. :)

For a project I needed to save a lot of data during a long period of time so I figured I'd save it down to a USB flash drive through the USB Host Shield.

I got writing and reading sectors working but I won't be needing more than this so I'll probably not develop it an further. I couldn't find much information about this anywhere (regarding USB Host Shield and Arduino) so I figured I'll share my code as pointers for someone else doing something similar. It's not much but maybe it will help someone? (In all it's spaghetti-ness):

Sample setup() and loop() is at the bottom of the file. The code currently clears the first 500 sectors, writes "Hello, world!" to the first sector, reads that in and prints it over serial. (DO NOT use this on a flash drive with data you want to keep :))

The code has hardcoded Vendor ID/Product ID/Endpoint addresses and also 512 byte LBA/Sectors are hardcoded. Should be easy enough to change for another USB drive.


Jul 12, 2010, 09:34 am Last Edit: Jul 12, 2010, 09:34 am by danielkarling Reason: 1
I couldn't include the link in my previous post? Trying again...



Great work.
You might also share on circuitsathome and Sparkfun, so others may develop further.

Go Up