如何在 arduino-due 上使用选定地址 Write/Read arduino 闪存

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

我需要知道我们是否可以在没有 EEPROM 的情况下在选定地址写入或读取 Arduino Due 的闪存。我知道我们有 PROGMEM,但我无法在两个不同的地址写入两个字符串。当我将 Hello 写入地址 IFLASH0_ADDR 的闪存并将 Hi 写入地址 IFLASH0_ADDR 时,我无法读回这些字符串,因为库 DueFlashStorage 不适用于那些选定的地址。

拜托,我真的很想知道我该怎么做。

试试这个库:https://github.com/sebnil/DueFlashStorage

最基本的使用(从上述库的自述文件中复制):

// write the value 123 to address 0
dueFlashStorage.write(0,123);

// read byte at address 0
byte b = dueFlashStorage.read(0);

它使用闪存页面模拟 EEPROM。

这是 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 中解释的 EEPROM 仿真的概念。

相关:

  1. Arduino Stack Exchange: How to read/write variables persistenly on Arduino Due (no EEPROM/shield)?
  2. AN4894 应用笔记:EEPROM 仿真技术和软件 STM32微控制器
  3. [我的问答]Arduino Stack Exchange: Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?