I need to keep track of an integer array in an nRF51822 BLE peripheral (SoftDevice 8.0.0) between power cycles, and I try to use persistent storage manager for this task. The goal is quite simple: if a data space in non-volatile memory is invalid (happens when the device is powered on for the first time), initialize the non-volatile memory space and write some initial values; if the data space is valid, then update the content. I read the SDK API documentation here, and have a couple of questions:
-
In the SDK, I can use pstorage_register() to get the reference handle of the requested non-volatile memory space, and use pstorage_block_identifier_get() to further get the reference of data blocks. But how do I keep these handle information between power cycles? Or is it better to access with hard coded address? (and how?)
-
What is the difference between pstorage_store() and pstorage_update()? It seems I can just use pstorage_store() to overwrite old data if I need a data update.