Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esp32 C3 Arduino EEPROM.writeInt Failure! #9

Open
dorry3 opened this issue Jun 19, 2022 · 1 comment
Open

Esp32 C3 Arduino EEPROM.writeInt Failure! #9

dorry3 opened this issue Jun 19, 2022 · 1 comment

Comments

@dorry3
Copy link

dorry3 commented Jun 19, 2022

Arduino 1.8.19 esp32 SDK2.03

  • Chip used: [ESP32C3|none]
  • SDK 2.03(run git describe --tags to find it):

EEPROM.begin(2048)
EEPROM.writeInt(1,val);
EEPROM.commit();

Unable to write internal NVS, reset, restart or power off, data loss

but With esp32 is normal!

`#include <EEPROM.h>
void setup() {
Serial.begin(115200);

if (!EEPROM.begin(2048))
{
delay(1000);
Serial.println("Restarting...");
ESP.restart();
}
Serial.println("");
Serial.println("
");
Serial.println("******************");
Serial.println("setup() begin....");
Serial.println(".................");
Serial.println(".................");
Serial.println("Begin Reading...");
Serial.printf("Read At 1 boot: %d\n", EEPROM.readInt(1));
Serial.printf("Read At 5 boot: %d\n", EEPROM.readInt(5));
Serial.printf("Read At 9 boot: %d\n", EEPROM.readInt(9));
delay(1000);
Serial.println(".................");
Serial.println(".................");
Serial.println(".................");
Serial.println("Begin Writing...");

int val = byte(random(10020));
EEPROM.writeInt(1,val);
EEPROM.commit(); Serial.print("Write at 1 .......");Serial.println(val);
EEPROM.writeInt(5,val+5);
EEPROM.commit(); Serial.print("Write at 5 .......");Serial.println(val+5);
EEPROM.writeInt(9,val+8);
EEPROM.commit(); Serial.print("Write at 9 .......");Serial.println(val+8);
Serial.printf("After write: %d\n", EEPROM.readInt(1));
}
void loop() {
delay(-1);
}`

@zztiger123
Copy link

Hi @dorry3 sorry for the late reply.

About esp32-arduino issue, you can ask it on esp32-arduino github : https://github.com/espressif/arduino-esp32/issues, thanks for your kind guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants