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

Bonded peer cannot reconnect - PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED

Hi, I am using the ble_app_cscs_pca10056_s140 example application from nRF5_SDK_15.0.0_a53641a and I have made a single-line change (see below) to force the bonding process to run. This works flawlessly for a new device; I get a bond succeeded and can subscribe to the NOTIFY characteristic. However it fails whenever I disconnect and then try to reconnect.

To try and debug I've added log statements for all Peer Manager events and have included this below. I get a PM_EVT_STORAGE_FULL as part of the initial bond, then a lot of PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED. I think this is suggesting the bond information cannot be stored &/or retrieved correctly from the flash?

I tried running: nrfprog --qspieraseall and nrfprog --eraseall but that doesn't seem to help.

The single change I made to the basic example in services_init() function is:

//BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cscs_init.csc_meas_attr_md.cccd_write_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cscs_init.csc_meas_attr_md.cccd_write_perm);

Log output:

<info> app: Fast advertising
<info> app: Connected
<info> app: PM_EVT_CONN_SEC_START
<info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<info> app: PM_EVT_PEER_DELETE_SUCCEEDED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLIED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED
<info> app: PM_EVT_SERVICE_CHANGED_IND_SENT
<info> app: PM_EVT_SERVICE_CHANGED_IND_CONFIRMED
<info> app: PM_EVT_SLAVE_SECURITY_REQ
<info> app: PM_EVT_FLASH_GARBAGE_COLLECTED
<info> app: PM_EVT_CONN_SEC_PARAMS_REQ
<info> app: PM_EVT_STORAGE_FULL
<info> app: PM_EVT_FLASH_GARBAGE_COLLECTED
<info> app: Connection secured: role: 1, conn_handle: 0x0, procedure: 1.
<info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<info> app: PM_EVT_PEER_DELETE_SUCCEEDED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLIED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED
<info> app: PM_EVT_SERVICE_CHANGED_IND_SENT
<info> app: PM_EVT_SERVICE_CHANGED_IND_CONFIRMED
<info> app: PM_EVT_SLAVE_SECURITY_REQ
<info> app: PM_EVT_FLASH_GARBAGE_COLLECTED
<info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<info> app: PM_EVT_PEER_DELETE_SUCCEEDED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLIED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED
<info> app: PM_EVT_SERVICE_CHANGED_IND_SENT
<info> app: PM_EVT_SERVICE_CHANGED_IND_CONFIRMED
<info> app: PM_EVT_SLAVE_SECURITY_REQ
<info> app: PM_EVT_FLASH_GARBAGE_COLLECTED
<info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<info> app: PM_EVT_PEER_DELETE_SUCCEEDED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLIED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED
<info> app: PM_EVT_SERVICE_CHANGED_IND_SENT
<info> app: PM_EVT_SERVICE_CHANGED_IND_CONFIRMED
<info> app: PM_EVT_SLAVE_SECURITY_REQ
<info> app: PM_EVT_FLASH_GARBAGE_COLLECTED
<info> app: Fast advertising
<info> app: Disconnected
<info> app: Connected to a previously bonded device.
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLIED
<info> app: PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED
<info> app: PM_EVT_SERVICE_CHANGED_IND_SENT
<info> app: PM_EVT_SERVICE_CHANGED_IND_CONFIRMED
<info> app: PM_EVT_SLAVE_SECURITY_REQ
<info> app: PM_EVT_FLASH_GARBAGE_COLLECTED
<info> app: Connected
<error> app: Fatal error
<warning> app: System reset

I'm not sure what to try next to be honest...any help or suggestions appreciated!

Many thanks.

Related