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

NRF51822: Bonds not saving with SDK5.1.0

I am finding that bonds are not saved to flash when using the latest SDK and S110 SoftDevice.

To test this, I am using the HTS example code, and the Master Dongle. I open Master Control Panel, and [Start Discovery] to list the advertising device.

First, I [select device], then do [Service discovery], [Bond], and [Enable services]. The temperature service starts notifying.

I then click [Disconnect] and [Back] and repeat the process. The bond is still in nRF51822 RAM, so temperature notifies fine.

I then click [Disconnect] and [Back], CYCLE POWER, and repeat the process. Temperature does not notify, the bond is not made since the nRF51822 looses it on power cycle.

I then click [Disconnect] and [Back] and then click [Delete bond info] and repeat. A new bond is created, and temperature is notifying again.

I am using: SDK 5.1.0 S110 6.0.0 production

When using old SDK and S110 (prior to pstorage) the Bond persists over power cycle.

Parents
  • Hi Krishna,

    The problem is not that flash operations are incomplete before system turn off. I wait several seconds after they have started before cycling the power.

    After further investigation, it seems that pstorage_store is not working correctly when called twice in close succession, and that is why the CRC, the second store, is not written.

    When i put the following (hacky) code after the first pstorage_store in bond_info_store (write bonding informatin), it works perfectly. The CRC (and bond manager data signature) are written to the first 32-bytes of the flash page.

    volatile int t;
    for (t = 0; t < 100000; t++){}
    

    Without this forced delay, the second pstorage_store does not write the CRC (and bond manager data signature).

    No idea why this is, but I'd guess it's something to do with adding an operation the queue at the same time as the handler is removing an operation. It could be something completely different though, I haven't investigated the internals of pstorage.

Reply
  • Hi Krishna,

    The problem is not that flash operations are incomplete before system turn off. I wait several seconds after they have started before cycling the power.

    After further investigation, it seems that pstorage_store is not working correctly when called twice in close succession, and that is why the CRC, the second store, is not written.

    When i put the following (hacky) code after the first pstorage_store in bond_info_store (write bonding informatin), it works perfectly. The CRC (and bond manager data signature) are written to the first 32-bytes of the flash page.

    volatile int t;
    for (t = 0; t < 100000; t++){}
    

    Without this forced delay, the second pstorage_store does not write the CRC (and bond manager data signature).

    No idea why this is, but I'd guess it's something to do with adding an operation the queue at the same time as the handler is removing an operation. It could be something completely different though, I haven't investigated the internals of pstorage.

Children
No Data
Related