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

  • 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?

  • Stefan,

    Thanks for answering my questions. I have some follow up questions based on your responses.

    1. How stable is the flash data storage? Should it be used in production products since it is marked as experimental, correct?
  • Yes, flash data storage is still experimental state in nRF5 SDK 11.0.0. This means the module has not been fully tested. We are however very commited to development of the new flash modules and I expect them to be production ready sooner than later. So if you are not going into production in the next couple of months, and the additional implementation of the flash data storage is needed for your scenario, then I would definately recommend the new flash modules instead of pstorage. Of course, you can use pstorage, but then you would need to implement yourself any needed feature that pstorage does not implement.

Related