Hello,
I am using Preferences.h
to store data on my M5 Stack Paper
, such as Wi-Fi credentials, during my application's setup. It was working fine.
During development and testing, I have rewritten the data in Preferences
multiple times on this device. However, I recently noticed that new data is no longer being stored in Preferences
, even though there is still available space, as confirmed by running the following code.
#include <Preferences.h>
.
.
.
void checkWifiCredentialsAndDecide(){
preferences.begin("wifiCredentials", false);
if(debugFlag){
size_t whatsLeft = preferences.freeEntries();
Serial.printf("Available enteries in the namespace table.\n" );
Serial.println(whatsLeft);
preferences.putString("test1", "test 1 value");
Serial.println("preferences.getString(test1): " + String(preferences.getString("test1", "Default value")));
}
.
.
.
}
Output
Available enteries in the namespace table.
127
preferences.getString(test1): Default value // I am expecting to see "test 1 value"
I have read that the NVS (Non-Volatile Storage) has a write cycle limitation of approximately 10,000 to 100,000 cycles.
I have a few questions:
Is there a way to check how many write cycles are remaining?
Can I check if my flash memory is healthy or corrupted?
Is it possible that the flash memory of my M5 Stack Paper has worn out?
Thank you