This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Pstorage as EEPROM Replacement

I have an application that we have ported to the nRF52 that used an EEPROM to manage configuration values. This application doesn't update these values often but when they are updated there are normal updated as a group of between 4 and 5 values during a BLE connection.

My questions are:

  1. Given that these parameters get updated in groups is it better to keep all the parameters in RAM and update them all at once or use the pstoarge builtin queue mechanism?
  2. How can I protect against corruption in the event that power is removed during a write operation?
  3. What is the best way to determine if the flash has been initialized on boot?

Thanks, Darren

Parents
  • Hi Darren

    1. I suspect that if you want to update either all of the values in flash or none, then you should store the values in RAM and update them in flash with a single pstorage/fstorage operation. That way you will not end up with e.g. two of the values to have new values and three to have old values, if flash operation starts to fail after two successful operations.

    2. The pstorage has drawbacks, two of the main drawbacks are that it does not handle sudden power failures gracefully, and it does not handle limitations in flash durability (10.000 write/erase cycles for nRF52). This is handled by the new and flash data storage module.

    3. To see if the pstorage/fstorage module has been initialized, isn´t it sufficient to set a variable when you successfully initialize the pstorage/fstorage module?

Reply
  • Hi Darren

    1. I suspect that if you want to update either all of the values in flash or none, then you should store the values in RAM and update them in flash with a single pstorage/fstorage operation. That way you will not end up with e.g. two of the values to have new values and three to have old values, if flash operation starts to fail after two successful operations.

    2. The pstorage has drawbacks, two of the main drawbacks are that it does not handle sudden power failures gracefully, and it does not handle limitations in flash durability (10.000 write/erase cycles for nRF52). This is handled by the new and flash data storage module.

    3. To see if the pstorage/fstorage module has been initialized, isn´t it sufficient to set a variable when you successfully initialize the pstorage/fstorage module?

Children
Related