I need to know if we can write to or read from an Arduino Due's Flash memory, without EEPROM, at a selected address. I know we have PROGMEM, but I am unable to write two strings at two different addresses.
When I write Hello
into the Flash memory at address IFLASH0_ADDR
, and Hi
into address IFLASH0_ADDR
.
I am unable to read these strings back out because the library DueFlashStorage
doesn't work with those selected addresses.
Please, I really want to know how can i do this.
Try this library: https://github.com/sebnil/DueFlashStorage.
Most basic use (copied from the above library's readme):
// write the value 123 to address 0
dueFlashStorage.write(0,123);
// read byte at address 0
byte b = dueFlashStorage.read(0);
It emulates EEPROM using Flash memory pages.
Here's the concept of EEPROM emulation explained in Application Note AN2594, for STM32 microcontrollers, for instance. It explains the concept of how to use two flash memory pages for EEPROM emulation. A similar paper may exist for the AT91SAM3X8E microcontroller (1459 pg. datasheet here) used by the Arduino Due.