GIGA R1 USB Mass Storage examples : has anyone managed to run an example project ?

Hi everybody,

I've been trying to run the USB Mass Storage examples from this page for several days:

without success.

I have read several threads about issues like this. I paid attention to the USB designation without success.

So my question is if anyone was able to run any of the USB mass storage examples for GIGA R1: file read, file write, data logger.

none of the examples work for me...

THANKS !

Hi formulanay, I can't help on that, but consider to use a microSD card through the SPI instead.

Hey @formulanay , I just tested out the examples you mentioned and they are working for me. There are some considerations when working with USB drives, and unfortunately it can be tricky to troubleshoot. But here are some things you can check:

  • Check that your USB drive is uses FAT32 as a file system, and has the MBR partitioning scheme.
  • USB designation needs to be addressed both when creating the object, but also later on when working with a file, e.g. when using fopen("/usb/Arduino.txt", "r+").

I'm attaching a screenshot so you can see the specifications of my USB drive that I am using successfully. Hopefully this can be of help. The drive I am using is a SanDisk 32GB, a very common accessory.

Thank you for your answer.

I finally was able to managed an example when downgrading Arduino_USBHostMbed5 from 0.04 to 0.03.

What could be the reason the example works with 0.03, but not with 0.04 ?

Thanks !

I can concur that no version other than 0.03 works.

1 Like

Thanks,
I downgraded from the 0.2.0 version back to the 0.0.3 and it now runs!

I used the SDFormatter app on a Windows 11 machine to format the drive and I verified it was Fat32. And it now works (on 0.0.3)

One time today with 0.2.0 running under debug (Ozone) I set a break point at the Serial.print before the loop for msd.connect, and then stepped it and one time it actually run through and gave me the directory listing. Not sure if it was timing or just blind luck. Will experiment more later.

Wondering if there are plans to extend the Disk Support to not be so limited. On another board, we added support for multiple partitions, both MBR and some limited GPT, and using a slightly modified version of SDFat, it supports, Fat16, Fat32, ExFat.

Now back to trying things out.

2 Likes

I don't know if this helps anyone but I'm using Arduino_USBHostMbed5 directly from the main branch on GitHub and it all seems to work on my Giga R1.

That is strange, as at least on my machine, the sources are the same as 0.2.0.

At least WinMerge compare of them does not show any differences.

1 Like

mmm, I'm using platformio and so far seems fine.

Can you post some example code that fails on yours and I will try it...

Just try running the directory example. It fails for me with 0.2.0 but works with 0.0.3

EDIT: we are talking about the USB example for a memory stick.

The directory example works fine for me here, both in platformio with version from GitHub and in Arduino with 0.2.0 installed.

Reconnecting to /dev/cu.usbmodem146101 ....      Connected!
Mounting USB device... done.
Opening the root directory... Done
done.
Root directory:
    Helix_OM_Chinese_A.pdf
    Helix_OM_English_A.pdf
    Helix_OM_French_A.pdf
    Helix_OM_German_A.pdf
    Helix_OM_Japan_A.pdf
    Helix_OM_Spanish_A.pdf
    ._.Trashes
    ROLAND
    .Trashes
    .Spotlight-V100
    presets
    ._Helix_OM_English_A.pdf
    ._ROLAND
    poly-frontend_3.17.deb
    ._poly-frontend_3.17.deb
    poly-modules_2.42.deb
    ._poly-modules_2.42.deb
    poly-ingen_2.2.deb
    ._poly-ingen_2.2.deb
    poly-extra-content_2.3.deb
    ._poly-extra-content_2.3.deb
    .fseventsd
    cabs
    presetssafe
    reverbs
    FMish_Guitar.instr
    ._FMish_Guitar.instr
    logs
28 files found!
Closing the root directory... OK

Edit: just tried another usb stick and that worked as well!

sketch_oct18b.ino.bin.zip (107.3 KB)

That's the bin of the example working here built with the Arduino IDE.

Noticed that you are running on a Linux computer so decided to give it a try on my RPI4 and guess what. The directory example works with 0.2.0 as you said.

The issues myself and @KurtE (at least) are running on a Windows 11 pc. Looks like there might be a compatibility issue with usbhost and windows.

1 Like

I will have to try it again.

Note as I mentioned earlier, there was one time where 0.2.0 worked on my Windows 11 machine, and that is where I setup to run using the debugger. And I set a break point by the Serial.print before the call that failed. I then stepped or continued, and it worked.

So my guess is there could be something like a race condition, or the like. Will have to try it again.

Did you then try to run the same board on your Windows machine?

If I hook the giga up that I programmed from sources on the PI4 to windows 11 it now works:

Mounting USB device... done.
Opening the root directory... Done
done.
Root directory:
    System Volume Information
    1-Ground_SAI2016.pdf
2 files found!
Closing the root directory... OK

but if I update the usbhost library to 0.2.0 and reload the same sketch it gets as far as this:

Starting USB Dir List example...

and then the red light starts flashing indicating a mbed os crash.

Seems to be crashing in usbhost when trying to do a

msd.connect()

The best way to see if it is something to do with the development environments machine (when building) is I guess is to try the zip of the bin that I posted?

If you flash that from windows 11 does it work?

Going to try that next. Stayed tuned

Sorry for the delay but the short answer is yes. If I flash your post bin file to the giga it works:

Mounting USB device... done.
Opening the root directory... Done
done.
Root directory:
    System Volume Information
    1-Ground_SAI2016.pdf
2 files found!
Closing the root directory... OK```
1 Like

Now if you flash it with the one generated on your Windows machine does it work...
Probably not. But...

The compiler being used by Arduino on this Mac is:

arm-none-eabi-g++ (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]

The bin I posted was compiled with debug off by this compiler, Is the windows version different?

Edit: Platformio is using a more modern version:

arm-none-eabi-g++ (xPack GNU Arm Embedded GCC x86_64) 12.3.1 20230626