Saving data to memory on the Giga

Hi everyone,

I had a working project on a Mega2560 and am moving it to the Giga so I can connect with it through the cloud.

In the Mega I had a few values saved to EEPROM to make sure the schedule would not be affected by outside influence or power interuptions.

As far as I can tell the Giga does not have EEPROM memory but flash memory. From the datasheet I tried to find out how to use it, but I only got as far as similarities between the Giga and Portenta that both use STM32H747XI.

In this Portenta thread I found a sketch detailing how to write memory to flash, But I'm afraid it's workings are a bit to complicated for me.

My goal is to save about 20-30 2-digit values. Is it really neccesary to create a block in the flash memory to be able to use it?

You can always use external EEPROM or FLASH to save your data in.

In the Giga cheat sheet, it tells us " The GIGA R1 has 2MB of internal, and 16MB of external Flash storage. The external Flash storage on the GIGA R1 is QSPI and can be accessed and used to store data."

So you potentially have 16MB to play with.

Thus when looking at that Portenta thread link, the part that's relevant to you is the section on QSPI: https://docs.arduino.cc/tutorials/portenta-h7/reading-writing-flash-memory#programming-the-qspi-flash

As that section tells you, to initialize you use the QSPIFBlockDevice class which is a block device driver for NOR-based QSPI Flash devices.

But if you're not really interested in all the technical detail, all you need to do to get going is seek out the sentence "The full QSPI version of the sketch is as follows:" and then copy that code.

After I found this QSPI thread I thought messing with it would be a mistake. But I'll look into it, thanks

Interesting post. The last comment makes sense, but I suspect it only becomes an issue if you want to run a web server and require plenty of data stored on this memory.

You could probably look at how ESP32 SPIFFS memory is managed too as plenty of users would have grappled with similar issues...

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spiffs.html

It's worth a try ....

I've also ordered a little EEPROM chip just in case.

I found these two samples:
QSPIFormat.ino
WiFiFirmwareUpdater.ino

It seems that a part of this 16MB external flash memory (1MB for wifi firmware) is already used by default.

image
So practically usable flash memory is the rest of 15MB, as if I want to use wifi module, I should keep wifi firmware in the flash memory. Is it correct?

ps: not related to this topic, but can I update sketch by OTA in GIGA? As in the sample code, I see that there's a partition for OTA data.
I found this lib: Arduino_Portenta_OTA . It added the support for Giga in 1.1.3