Pages: [1]   Go Down
Author Topic: Code for mass Storage Device  (Read 911 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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 smiley)

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I couldn't include the link in my previous post? Trying again...

http://robinnilsson.cust.ipeer.se/~danne/usb_msd.cpp
« Last Edit: July 12, 2010, 02:34:45 am by danielkarling » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: