Shopping Cart

Posts

Mass Storage Support for USB Host Library 2.0 released!

Mass Storage

Mass Storage

The code supporting USB Mass Storage Class of devices has been added to USB Host Shield 2.0 library and is available to download on GitHub. Mass storage devices include USB Flash drives, memory card readers, external hard drives/CD-ROMs, smartphones/tablets, and some others – almost anything that shows as a drive while connected to a PC (exceptions are digital cameras as well as some phones pretending to be digital cameras). Andrew Kroll (who made this release possible) – thank you very much!

At present, the code example, also featuring Andrew’s FAT and extended memory implementation, can only be run on “big” Arduinos such as Mega and Mega 2560. Another FAT implementation, developed by Alex Glushchenko, is being tested – there is a slight possibility that at least some functionality can be demonstrated on a regular UNO board. On the other hand, the mass storage component can be used without a file system by simply reading/writing physical sectors; this approach can save a lot of memory. The documentation for the mass storage class code is available here.

Many hours has been spent testing the code; it should work with any device which claims to support “mass storage bulk only” transport. While newer (less than 5 years old) won’t cause any problems, older ones could be finicky. If your device shows odd behaviour with this code, please let me know – I will trade it for the good working one.

Enjoy!

Oleg.

Related posts:

  1. HID support for USB Host Shield Library 2.0 released
  2. Bluetooth RFCOMM/SPP service support for USB Host 2.0 Library released!
  3. USB Host Shield library Version 2.0 released.
  4. Sony PS3 Controller support added to USB Host library
  5. Wireless Xbox360 controller support for USB Host 2.0 library
  6. Arduino 1.0-compatible USB Host Library released
  7. Google Open Accessory Interface for USB Host Shield Library 2.0 released
  8. Andriod ADK-compatible USB Host Library release.
  9. USGlobalsat ND-100S GPS receiver works with USB Host library
  10. A documentation project for USB Host Library 2.0 has begun!

105 comments to Mass Storage Support for USB Host Library 2.0 released!

  • OK so I figured out my own error. When you have not installed the library correctly you get this sort of error. Make sure to place the library folder in “libraries” and remove all dots and dashes from the folder name.

  • DENIS

    Hi,

    I folow the implementation directive but …
    (AVR MEGA2560 and ide 1.0.6)
    Please Help me…

    testusbhostFAT:80: error: variable or field ‘die’ declared void
    testusbhostFAT:80: error: ‘FRESULT’ was not declared in this scope
    testusbhostFAT:92: error: expected constructor, destructor, or type conversion before ‘*’ token
    testusbhostFAT:99: error: expected initializer before ‘*’ token
    testusbhostFAT:100: error: ‘part_t’ does not name a type
    testusbhostFAT:101: error: ‘storage_t’ does not name a type
    testusbhostFAT.ino: In function ‘void setup()’:
    testusbhostFAT:182: error: ‘_VOLUMES’ was not declared in this scope
    testusbhostFAT:183: error: ‘Fats’ was not declared in this scope
    testusbhostFAT:184: error: ‘sto’ was not declared in this scope
    testusbhostFAT:184: error: expected type-specifier before ‘pvt_t’
    testusbhostFAT:184: error: expected `;’ before ‘pvt_t’
    testusbhostFAT:185: error: ‘pvt_t’ was not declared in this scope
    testusbhostFAT:185: error: expected primary-expression before ‘)’ token
    testusbhostFAT:185: error: expected `)’ before ‘sto’
    testusbhostFAT:291: error: ‘Init_Generic_Storage’ was not declared in this scope
    testusbhostFAT.ino: At global scope:
    testusbhostFAT:384: error: variable or field ‘die’ declared void
    testusbhostFAT:384: error: ‘FRESULT’ was not declared in this scope

  • Daniel

    Hello,

    I downloaded the code and updated with:

    "Git clone https://github.com/felis/USB_Host_Shield_2.0 recursive" and "git submodule foreach recursive git pull origin master"

    When I Make the example testusbhostFAT get the following message:


    make
    Gathering build parameters...

    Building "build/mega/Wire_/twi_c.o"...
    Building "build/mega/Wire_/Wire_cpp.o"...
    Building "build/mega/core_/WInterrupts_c.o"...
    Building "build/mega/core_/wiring_analog_c.o"...
    Building "build/mega/core_/wiring_c.o"...
    Building "build/mega/core_/wiring_digital_c.o"...
    Building "build/mega/core_/wiring_pulse_c.o"...
    Building "build/mega/core_/wiring_shift_c.o"...
    Building "build/mega/core_/malloc_c.o"...
    Building "build/mega/core_/realloc_c.o"...
    Building "build/mega/core_/CDC_cpp.o"...
    Building "build/mega/core_/HardwareSerial_cpp.o"...
    Building "build/mega/core_/HID_cpp.o"...
    Building "build/mega/core_/IPAddress_cpp.o"...
    Building "build/mega/core_/main_cpp.o"...
    Building "build/mega/core_/new_cpp.o"...
    Building "build/mega/core_/Print_cpp.o"...
    Building "build/mega/core_/Stream_cpp.o"...
    Building "build/mega/core_/Tone_cpp.o"...
    Building "build/mega/core_/USBCore_cpp.o"...
    Building "build/mega/core_/WMath_cpp.o"...
    Building "build/mega/core_/WString_cpp.o"...
    Building "build/mega/core_/libAcore_.a"...
    Building "build/mega/libAuser_.a"...
    Building "build/mega/Wire_/libAWire_.a"...
    build/mega/testusbhostFAT_ino.o: In function `setup':
    /home/dani/Escritorio/arduino-1.0.6/libraries/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino:301: undefined reference to `freeHeap'
    /home/dani/Escritorio/arduino-1.0.6/libraries/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino:248: undefined reference to `freeHeap'
    /home/dani/Escritorio/arduino-1.0.6/libraries/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino:275: undefined reference to `freeHeap'
    build/mega/libAuser_.a(generic_storage_cpp.o): In function `RTClock()':
    /home/dani/Escritorio/arduino-1.0.6/libraries/USB_Host_Shield_2.0/examples/testusbhostFAT/../testusbhostFAT/generic_storage/FAT/FAT.cpp:31: undefined reference to `RTCnow()'
    /home/dani/Escritorio/arduino-1.0.6/libraries/USB_Host_Shield_2.0/examples/testusbhostFAT/../testusbhostFAT/generic_storage/FAT/FAT.cpp:31: undefined reference to `DateTime::FatPacked()'
    make: *** [build/mega/testusbhostFAT.hex] Error 1

    I also tested a version of several months and this problem doesn’t exist.
    How can I solve it?

    Thanks you.
    Regards,
    Daniel.

  • Ziv

    Hi,
    I’m trying to compile the “testusbhostfat.ino on arduino 1.0.6 on linux on teensy 3.1 (installed with teensyduino)

    When I try to verify i get this message:
    testusbhostFAT.ino:63:21: fatal error: Storage.h: No such file or directory
    compilation terminated.

    needless to say I have added these 3 libraries into ~/sketchbook/libraries/USB_Host_Shield_20/examples/testusbhostFAT folder:
    generic_storage
    xmem2
    RTClib

    I’ve also tried using the make file but i get this error:
    ~/sketchbook/libraries/USB_Host_Shield_20/examples/testusbhostFAT $ make
    Gathering build parameters...
    find: `/usr/bin/hardware': No such file or directory

    anything familiar?
    Thanks,
    Ziv

  • ArduMan

    Hi at all, one question, this library also can be used on boards with integrated usb host like arduino due or arduino mega without using usb host shield?

  • duino

    Hi,
    I am newish to Arduinos and I just got a project that requires a larger data logger. I purchased a USB host shield. I am wondering what file types these points will be saved as. Ideally i would love a text file or an excel spreadsheet that is propagated with data. is this possible or does the data need to be manipulated post removal by a computer?

  • Jerry

    Where are you saving the files ‘too’? an SD card? a USB thumb drive/stick?

    I havent looked into the USB Mass Storage drive stuff with the USB Host shield or anything.. but I know you can read/write to .txt file using the most/all of the SD libraries..

    That being said.. most programming languages should be able to parse the data in a readable format (like a quick & dirty .php script or something)

  • duino

    Idea: I would like to save digital values to a long term data logger ( basically a counter). I would like to use a USB that is easy for others to check the logged data. (just a plug and manipulate situation)

    Hardware: I have an Arduino UNO and the Arduino USB host Shield

    Problems: I have read that I may need the Arduino mega board for mass storage of files but I am hesitant to purchase new hardware. The reason Im hesitant is I am not sure if the reason they suggest this is because their is hardware limitations with the UNO or if its just a code functionality problem. Ideally i would like some idea of if this is even feasible for the scope of my project. I feel like my idea is simple enough and wont require that much thought once i have some direction.

    Any suggestions are welcome.
    -Thanks-

  • duino

    Ok so i bough the Mega Board and im running the test bulk IDE and get this on the serial monitor..
    go!

    Plug in a storage device now…
    FSM state: 0×01
    FSM state: 0×02
    FSM state: 0x0A
    FSM state: 0×03
    FSM state: 0×04
    FSM state: 0×05
    FSM state: 0x0C
    FSM state: 0x0D
    Storage is polling…
    FSM state: 0×60
    Waiting for device to become ready…
    Testing LUN 0
    Read passed, Read 2048 sectors (1024K) in 11020ms

    I feel like this means that the arduino recognizes that there is an attached USB but how do i write files to the usb?
    -Thanks

Leave a Reply

  

  

  



You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">