easy flash memory access (to store simple bytes)

05 May 2010

There is the EEPROM read/write library for Arduino to store/restore data after power-off.

For mbed, is it simply an array pointer to the flash memory? Then what is the safe address to use? What is the minimum size (bytes) of erase/write?

char * p = (char *) [some_flash_address];

Sorry for my laziness not reading manual.

P.S.

I understand that I can always store data in a file in the localfilesystem. Is this the recommended approach?

 

 

 

 

05 May 2010

You can check the sample from Tedd OKANO on how to write into the internal flash. However, the IAP interface allows erasing only complete sectors, so it's not very well suited for cases where you need just a few bytes. For that, it might indeed be better to use the local FS.

Another choice is the RTC block which is powered separately. If you can provide independent power for the VB pin, you can then store up to 20 bytes in the RTC registers, and those values will persist between resets and powerdowns.