Eeprom problem after power loss

Dear Forum and particle,

I am facing a problem on reading the values of the eeprom after power loss.

I can manage to write and read from the eeprom , but when a power loss happens then all the data that were saved are lost .

Shouldn’t be saved ?

Is there any solution to fix this?

Regards
John

I wrote a very simple test sketch and the EEPROM values are working for me. Value is saved across removing power. Photon, 0.4.9 system firmware. You’ll probably have to provide more info (hardware, software versions, your code).

uint8_t lastVal = 0;


void setup() {
    Serial.begin(9600);
}

void loop() {
    uint8_t val = EEPROM.read(0);
    if (val != lastVal) {
        Serial.printlnf("EEPROM value=%02x", val);
        lastVal = val;
    }
    
    val = (uint8_t) (analogRead(A0) >> 4);
    EEPROM.update(0, val);
    
    delay(10000);
}

The Eeprom code has had a major overhaul for the upcoming 0.5.0 release which addresses a number of corner cases where the eeprom could be corrupted during power failure.

The 0.5.0 release will be made available as a pre-release soon - I hope you’ll be able to help us test the new eeprom implementation.

2 Likes

Dear Particle ,

Thank you for your reply. I will have to wait for the version 0.5.0

Regards
Ioannis