Arduino_UnifiedStorage for GIGA

I'm very interested in using Arduino_UnifiedStorage on the GIGA. It's already available on the Portenta and this blog post says it will be coming to more platforms. When?

Has anyone tried to get it to work on the GIGA? Any successes or roadblocks?

Logger example does not compile ...
Libraries are compatible with renesas_portenta, mbed_portenta, mbed_opta,
but seemingly not mbed_giga

Yes I tried several of the Arduino_UnifiedStorage Examples on the GIGA and none of them compiled, usually saying the GIGA is not a supported board.

This library seems very very useful so I'd like to figure out if it's feasible to get it to work on the GIGA, and what the main roadblocks might be.

hello again @JoeHuber , had a quick look at the issue open/closed and pulls for the libs and I suspect either Arduino nailed it or it's little used. As Arduino have extended their sale I may buy another giga and have play with this. I'd be interested to know which facilities have sparked your interest

Hi Steve
So good to hear from you again. Hope you've been well.

I'm thinking this lib would be interesting for several reasons. The most immediate reason is that I'd like to use a USB stick to export a CSV file from the RTC-NTP app. And I realized how nice it would be to have a uniform library for flash, USB stick and even SD card someday.

I also like that the library has a nice clean set of calls that handle things all the way from partitioning, formatting, mount, open, read/write and even move and copy. Plus the demo programs are intriguing for logging and backing up data from my main SpeedTrap app.

I know there is the USB MSD library that I could use to write the CSV file and I may start with that, but having a unified library with a nice clean POSIX interface feels really appealing.

I'm currently at the stage where I know just enough c++ to be dangerous. Converting my .ino files to proper .h/.cpp files had some roadblocks harder than I'd expected. This library is currently blocked simply because it doesn't pass the board check switch. "Hey I can fix that and make it accept GIGA too" :wink: But obviously the real issues are what comes after that.... so I thought I'd ask if anyone explored this before and hoping to share what they learned.

Hey Steve

Just wanted to let you know that I'm making pretty good progress on this (I think). Yesterday I got Arduino_POSIXStorage to compile and run the USB HotPlug demo program which includes basic mounting, writing and reading plus call backs for plug and unplug .

I'm making progress getting Arduino_UnifiedStorage to compile too. I've added an ARDUINO_GIGA case to the conditional compilation and it mostly compiles now. The major holdup seems to be getting some modules to recognize some types that are in a separate .h file.

I really like the POSIX nature of the demo programs so I'm excited and hopeful this can be made to work and isn't too big to easily fit the GIGA.

EDIT: Got it to compile and run! The issue was one of the includes in their original code was of the <> style when it should have been "". Now the demo runs fine and it can be switched to use the Internal Flash or a USB drive by changing one line of code. (Or create two storage devices and talk to both at the same time)

Hi Steve,
I posted also my progress on this topic in github see
https://github.com/arduino-libraries/Arduino_UnifiedStorage/issues/47
are you able to mount USB device after a disconnection, seems that begin() function in arduino_UnifiedStorage dosen't work outside setup() function or maybe I did something wrong. Any Idea from your side ?
exemple_Giga_USBCallbacks.ino.txt (1.7 KB)

I got a pretty decent version of the Arduino_UnifiedStorage library running on my GIGA. I've mostly used it for logger type purposes where I can dynamically insert and remove the USB stick to offload ever increasing CSV log files. I also used it to write GIGA Display screen captures to BMP files.

I don't claim it to be bug free but I only needed to change the build and include lines to get it to work with the GIGA. I didn't change any of the actual library code.

Here's a zip of my updated version in case anyone wants to give it a try too.

AdventureLabsUnifiedStorage 2.zip (104.1 KB)

And here's the code that does the BMP screen capture and the CSV logging.
AdventureLabsFileTools.zip (5.1 KB)

I haven't created Examples yet but hopefully the code is easy enough to follow.
There's a single function for the BMP screen capture. It creates a new uniquely numbered BMP file and then just captures the whole GIGA Display screen into it.

The CSV logger class intentionally works more incrementally so that it can continuously add to the CSV file. Call Begin once, AddHeader once and then call AddData each time you have more CSV data. These will accumulate until you call Update which attempts to mount the USB filesystem if the drive is plugged in and then writes all pending CSV data to the end of the CSV file. It immediately unmounts the file system so it's safe to remove the USB drive anytime the LED is not illuminated.

1 Like