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

Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)

Hi,

I have an issue with bonding and resetting my BLE Peripheral device (NRF52832) after the bonding process is complete. Currently I press a button that initiates the bonding procedure, after that the central device (e.g my smartphone) bonds with the the peripheral device. When the bonding is complete I tell the BLE Peripheral to reset itself and update the whitelist and advertise using the whitelist by fetching the bonding information from flash. That part works fine, however when I connect with the central device after the reset i get the error: PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED event inside the peer manager event handler. The central device can still connect though.

I dont get the error PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED if I: connect -> bond -> reconnect (without restart of BLE Peripheral). But if I do connect-> bond -> disconnect -> connect -> reset -> connect the error shows up again.

I've tried using timers to delay the reset since writing to flash is done asynchronously (thinking maybe the reset was done too quickly) but it did not help.

Quick Edit:

Im using SDK V15.0

Softdevice: S132 6.0

Hardware: nRF52832

Parents
  • Hi Anton, 

    Please clarify, you mentioned this sequence "connect-> bond -> disconnect -> connect -> reset -> connect " showed the error. But when exactly you trigger the reset ? On the first connection after bond or on the second ? In the sequence above, it's the second re-connection after bonding. 

    Do you see the same problem if you test using ble_app_proximity (adding code to do a reset) ? Which phone did you use for testing ? 

    The PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED error happens when we try to apply the system attribute (CCCD value) on a saved connection but it doesn't match with the attribute table. Suspecting corrupted flash operation. We need to find the place where we store the system attribute and try to avoid resetting before it's finished flashing. 

  • I do the reset of the nRF52832 inside the PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event with the two following preconditions

    p_evt->params.peer_data_update_succeeded.flash_changed
    && p_evt->params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_BONDING
    

Reply Children
Related