I have an nRF51822-based device, which is a peripheral running the Soft Device s110. It has some vendor specific (custom) characteristics that are read/write. A mobile app (central) reads and writes them.
I'm confused about how I should be persisting the values for these characteristics. They need to be persisted across a reset or system off.
Firstly, is it my responsibility to persist the value or do I get that for free somehow? Having a look at the source for the Immediate Alert Service implementation in the SDK, there's no persistence going on, so it seems like the responsibility of the application.
If I must persist the values myself, it seems I have these options:
-
Keep the value in RAM and use RAM retention. There's an example app for this: ram_retention_example.
-
Keep the value in flash and use the pstorage module.
-
The new Device Manager has an application context which looks like it might be a suitable place to write the values. I can see no examples that use it, however. If I write some data to it, does the Device Manager use pstorage to write this to flash for me?
If #3 is not suitable, what are the power consumption considerations for choosing between #1 and #2? Does my flash "wear out" over thousands of read/write operations?