Persistent Data (eeprom) - RTL8720DN

Hi!

Is there a way in the arduino SDK to read and write to eeprom or save data (persistant) in the memory? I only need a single byte (uint8_t value) to write to as identifier of the chipset. Thanks!

Do you mean how to use FlashMemory ? or Real EEPROM such as AT24LC01?

The below two functions is use in the our product…
you can write any number of data into flash

#include <FlashMemory.h>

uint8_t readEERPOM(uint8_t *buf,uint8_t sz) {

FlashMemory.begin(FLASH_MEMORY_APP_BASE, sz);

FlashMemory.read();
memcpy(buf, &FlashMemory.buf[0],sz);

return 0;
}

uint8_t writeEEPROM(uint8_t *buf, uint8_t sz) {

FlashMemory.begin(FLASH_MEMORY_APP_BASE, sz);

memcpy(&FlashMemory.buf[0], buf, sz);

FlashMemory.update(true); //write before ease flash

return 0;
}

2 Likes

Perfect! That’s where i was looking for. But is this included in the SDK from realtek? If so, could you provide me the headers you’re linking (FlashMemory)?

you only have include as blew header file
#include <FlashMemory.h>

FlashMemory is an official API, found in the Arduino example. I just create read/write function based on the FlashMemory

1 Like

Amazing, got it! Thanks a lot :grin:

1 Like

you can refer to FlashMemory Example
Image 5

2 Likes

Thanks! Just tested, and works like a charm.
Have a good day! :slight_smile:

1 Like