I would like to store a few integer and bool values on a SD card or anywhere using the portenta H7. This needs to happen about once per hour. This is just for when the power goes out and I do not want to loose these values. These value are not data I will have to use in any other way as to be a non volatile storage of a number of variables.
Do I need to create a special file on a SD card to save these values into? Or can I allocate memory in the SD card for these values using the malloc() function like one would do for SDRAM?
Would I be correct in saying that writing and reading once every hour should not dramatically shorten my flash memory to much? As I understand the flash is good for around a 100 000.
Reading has no effect on the flash memory lifetime. Only writing reduces it.
How often does the data you want to save actually change? If you use the right library, and use it correctly, the flash will not get written to unless the values have actually changed.
Even if the library does not perform that check, it's easy enough to do the check in your code before writing to the flash memory.
Tip: create a struct to hold all the parameters you want to save. This will make it easier to check if anything has changed and the flash needs to be updated.
That’s correct. I prefer using FRAM because it’s much faster and doesn’t require additional time for writing or reading. In most cases, I simply replace the EEPROM chip on the RTC module with an FRAM chip for better performance.
@PaulRB The variables do change but maybe once a minute sometimes more.
I have a machine that runs 24/7. There are two shifts. They are 12 hours shifts. In each shift there is 10 x int variables and 8 bool values I would like to store in non volatile memory. So that if the power is interrupted the data of the shift is not lost. When the power turn back on and my code has determined there was a power outage. It will load the last known values of the variables and continue to update them from there on. The update rate is slow because the machine is rather slow. I was thinking of an update rate of between 1 to 5 minutes.
To me the correct place to store my data is in the QSPI flash. Looking at the above summary. would the QSPI Flash be the right place to perform this?