Hi,
I'm working on an application that implements both the Central and Peripheral role.
I would like to use the Just Works bonding (I have confifgured the Security Parameters as described in https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v11.0.0%2Flib_pm_usage.html ).
The problem is when my application (as Central) connects with an already bonded Peripheral witch has delated the Bonding information (or probably doesn't use the bonding).
In particular I receive the PM_EVT_CONN_SEC_FAILED event from the peer_manager module, please see the following log of a wrong connection.
00> [00:01:59.117,797] <info> app: CENTRAL: Trying to Connect with, peripheral with service ID: 2. 00> 00> [00:01:59.118,164] <info> app: CENTRAL EVT: 29. 00> 00> [00:01:59.232,604] <debug> peer_manager_handler: Event PM_EVT_BONDED_PEER_CONNECTED 00> 00> [00:01:59.232,604] <debug> peer_manager_handler: Previously bonded peer connected: role: Central, conn_handle: 0, peer_id: 0 00> 00> [00:01:59.232,666] <debug> peer_manager_handler: Event PM_EVT_CONN_SEC_PARAMS_REQ 00> 00> [00:01:59.232,666] <debug> peer_manager_handler: Security parameter request 00> 00> [00:01:59.232,727] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ 00> 00> 00> 00> [00:01:59.232,971] <debug> peer_manager_handler: Event PM_EVT_CONN_SEC_START 00> 00> [00:01:59.232,971] <debug> peer_manager_handler: Connection security procedure started: role: Central, conn_handle: 0, procedure: Encryption 00> 00> [00:01:59.232,971] <info> app: BleSettings_PmEvtHandler id 1 00> 00> 00> 00> [00:01:59.233,032] <debug> peer_manager_handler: Event PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 00> 00> [00:01:59.233,032] <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Peer rank, action: Update, no change 00> 00> [00:01:59.233,337] <info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 00> 00> 00> 00> [00:01:59.233,337] <info> app: PM_EVT_BONDED_PEER_CONNECTED 00> 00> 00> 00> [00:01:59.233,886] <debug> peer_manager_handler: Event PM_EVT_LOCAL_DB_CACHE_APPLIED 00> 00> [00:01:59.233,886] <debug> peer_manager_handler: Previously stored local DB applied: conn_handle: 0, peer_id: 0 00> 00> [00:01:59.233,947] <info> app: BleSettings_PmEvtHandler id 14 00> 00> 00> 00> [00:01:59.234,130] <debug> nrf_ble_gatt: Requesting to update ATT MTU to 251 bytes on connection 0x0. 00> 00> [00:01:59.234,130] <debug> nrf_ble_gatt: sd_ble_gattc_exchange_mtu_request() on connection 0x0 returned busy, will retry. 00> 00> [00:01:59.234,252] <debug> peer_manager_handler: Connected, securing connection. conn_handle: 0 00> 00> [00:01:59.234,252] <debug> peer_manager_handler: Event PM_EVT_CONN_SEC_PARAMS_REQ 00> 00> [00:01:59.234,313] <debug> peer_manager_handler: Security parameter request 00> 00> [00:01:59.234,313] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ 00> 00> 00> 00> [00:01:59.234,497] <debug> peer_manager_handler: Event PM_EVT_CONN_SEC_START 00> 00> [00:01:59.234,497] <debug> peer_manager_handler: Connection security procedure started: role: Central, conn_handle: 0, procedure: Encryption 00> 00> [00:01:59.234,558] <info> app: BleSettings_PmEvtHandler id 1 00> 00> 00> 00> [00:01:59.234,741] <info> app: BleSettings_BleStateNotify. Err 0 00> 00> [00:01:59.234,741] <info> app: CENTRAL EVT: 16. 00> 00> [00:01:59.234,741] <info> app: CENTRAL: Connected, handle: 0. 00> 00> [00:02:00.433,715] <debug> peer_manager_handler: Event PM_EVT_CONN_SEC_FAILED 00> 00> [00:02:00.433,715] <info> peer_manager_handler: Connection security failed: role: Central, conn_handle: 0x0, procedure: Encryption, error: 4102 00> 00> [00:02:00.433,776] <debug> peer_manager_handler: Error (decoded): PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING 00> 00> [00:02:00.433,776] <warning> peer_manager_handler: Disconnecting conn_handle 0.
I have handled the PM_EVT_CONN_SEC_CONFIG_REQ event but seem that it works only when my application connects with a Central device.
Is there a way to allow the a new pairing of an already bonded Peripheral?
Please help me...