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.
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.
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.
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
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?
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```