ESP32 EEPROM not persisting across resets.
Posted: Tue Feb 22, 2022 11:49 pm
I have the exact same problem as here:
https://github.com/espressif/arduino-esp32/issues/5159
Reading from EEPROM after reboot results in 0xFF
Reading after a write works.
platformio.ini:
My code:
My results:
https://github.com/espressif/arduino-esp32/issues/5159
Reading from EEPROM after reboot results in 0xFF
Reading after a write works.
platformio.ini:
Code: Select all
[env:esp32-s2-saola-1]
platform = espressif32
board = esp32-s2-saola-1
framework = arduino
lib_deps = EEPROM
build_flags =
-DCORE_DEBUG_LEVEL=5
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
Code: Select all
#include <EEPROM.h>
void setup() {
Serial.begin(115200);
EEPROM.begin(100);
Serial.printf("At boot: %d\n", EEPROM.readInt(1));
EEPROM.writeInt(1,42);
EEPROM.commit();
Serial.printf("After write: %d\n", EEPROM.readInt(1));
}
void loop() {delay(-1);}
Code: Select all
--- Miniterm on /dev/ttyUSB0 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x484
load:0x4004c000,len:0x82c
load:0x40050000,len:0x2760
entry 0x4004c174
[ 601][I][EEPROM.cpp:119] begin(): New EEPROM of 100 bytes
At boot: -1
After write: 42
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x484
load:0x4004c000,len:0x82c
load:0x40050000,len:0x2760
entry 0x4004c174
[ 618][I][EEPROM.cpp:119] begin(): New EEPROM of 100 bytes
At boot: -1
After write: 42