-
-
Notifications
You must be signed in to change notification settings - Fork 470
Description
Describe the problem
I use NVS to my project a lot and used a custom partition just for the sketch and the nvs.
factory,app,factory,0x10000,0x140000,
nvs,data,nvs,0x150000,0x2B0000,
Even tough i maxed out the nvs i still get crashes when i try to save data to nvs. the data i try to save are long strings split into chunks due to the limitation size per key but with no result. it keeps crashing when it comes to saving.
02:19:07.427 -> abort() was called at PC 0x400849b3 on core 1
02:19:07.427 -> Backtrace: 0x40082900:0x3ffc097c |<-CORRUPTED
02:19:07.427 -> ELF file SHA256: ea6e33af6
02:19:07.427 -> E (13880) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
02:19:07.637 -> E (13888) esp_core_dump_elf: Elf write init failed!
02:19:07.637 -> E (13893) esp_core_dump_common: Core dump write failed with error=-1
Using an addon exception decoder from the 1.8 version ide did not help me as well
Decoding stack results
0x40082900: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c line 469
I save many types of smaller variables to nvs but even with smalled chunks it cannot be handled
To reproduce
======================To write data======================
const size_t chunkSize = 1900;
int totalChunks = (DataLog.length() + chunkSize - 1) / chunkSize;
preferences.begin("my-app", false);
preferences.putInt("DataLog_chunks", totalChunks); // Store how many parts
for (int i = 0; i < totalChunks; i++) {
String chunk = DataLog.substring(i * chunkSize, (i + 1) * chunkSize);
String key = "DataLog_" + String(i);
preferences.putString(key.c_str(), chunk);
}
preferences.end();
Serial.println("DONE");
====================To read data=============================
preferences.begin("my-app", true); // true = read-only mode
int totalChunks = preferences.getInt("DataLog_chunks", 0);
if (totalChunks == 0) {
Serial.println("No chunks found. Using default DataLog.");
DataLog = "looooooooooooooong string..... about 1kb "; // Optional fallback
} else {
DataLog = ""; // Clear previous content
for (int i = 0; i < totalChunks; i++) {
String key = "DataLog_" + String(i);
String chunk = preferences.getString(key.c_str(), "");
DataLog += chunk;
}
}
preferences.end();
Expected behavior
Expected to save the data with no issue. Also how to handle panic events? to be able to halt or not on crash?
Arduino IDE version
2.3.6
Operating system
Windows
Operating system version
Windows 10
Additional context
No response
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest nightly build
- My report contains all necessary details