arduinoflash-memoryarduino-due

How to Write/Read arduino flash memory with a selected address on arduino-due


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.


Solution

  • 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.

    Related:

    1. Arduino Stack Exchange: How to read/write variables persistenly on Arduino Due (no EEPROM/shield)?
    2. AN4894 Application note: EEPROM emulation techniques and software for STM32 microcontrollers
    3. [my question and answer] Arduino Stack Exchange: Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?