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

Confused about persisting characteristic values written by a central

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:

  1. Keep the value in RAM and use RAM retention. There's an example app for this: ram_retention_example.

  2. Keep the value in flash and use the pstorage module.

  3. 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?

Parents
  • Hi Eliot,

    You are responsible for persisting the values written to the characteristics over resets and system off modes. If you do not need to have them survive power reset then RAM retention is a viable option. If they do need to survive power reset then I would be using NVRAM and pstorage. I'm not familiar with the Device Manager so I can't help with addressing it's usage.

    There are power considerations for RAM vs. NVRAM. According to the nRF51822 product specification NVRAM erase/write operations typically take 21-22 mS so you will be burning more power than a RAM write. I suspect NVRAM erase/write operations also consume additional current but I didn't see any mention of it in the product spec. The product specification also indicates that the endurance of the flash is 20,000 write/erase cycles.

    Regards, John

Reply
  • Hi Eliot,

    You are responsible for persisting the values written to the characteristics over resets and system off modes. If you do not need to have them survive power reset then RAM retention is a viable option. If they do need to survive power reset then I would be using NVRAM and pstorage. I'm not familiar with the Device Manager so I can't help with addressing it's usage.

    There are power considerations for RAM vs. NVRAM. According to the nRF51822 product specification NVRAM erase/write operations typically take 21-22 mS so you will be burning more power than a RAM write. I suspect NVRAM erase/write operations also consume additional current but I didn't see any mention of it in the product spec. The product specification also indicates that the endurance of the flash is 20,000 write/erase cycles.

    Regards, John

Children
No Data
Related