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

after bonding, when try reconnect, Failed to authenticate happen. how can I fix?

I try to bonding.

Using SDK 15.3. 0 and S332 Softdevice.

I successed bonding procedure used Peer manager.

after bonding, If I try to connect one more, nRF Connect app show Failed to authenticate (NRF_ERROR_INVALID_STATE).

however connection is still working.

1. If I use Peer Managere Module, which ble_gat_evt don't need to reply?(where is it in document that Info)

2.  

that is log.

<00> info> app: SoftDevice init END
00> 
<00> info> app: Timer INIT done
00> 
<00> info> app: Timer START done
00> 
<00> info> app: GAP PARAM INIT END
00> 
<00> info> app: GATT INIT END
00> 
<00> info> app: BLE ADVERTISING INIT END
00> 
<00> info> app: SERVICE INIT END
00> 
<00> info> app: CONN PARAM INIT END
00> 
<00> info> app: PEER MANAGER INIT END
00> 
<00> info> peer_manager_handler: All peers deleted.
<00> info> app: PM_EVT_PEERS_DELETE_SUCCEEDED 
00> 
<00> info> app: BLE_ADV_EVT_FAST
00> 
<00> info> app: BLE ADVERTISING START
00> 
<00> info> app: PEER DELETE END
00> 
<00> info> app: INIT SET END
00> 
<00> info> app: BLE_GAP_EVT_CONNECTED
00> 
<00> info> app: DEFUALT 13
00> 
<00> info> app: PM_EVT_CONN_SEC_START 
00> 
<00> info> app: PM_EVT_CONN_SEC_PARAMS_REQ 
00> 
<00> info> app: BLE_GAP_EVT_CONN_SEC_UPDATE   
00> 
<00> info> app: DEFUALT 19
00> 
<00> info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
<00> info> app: PM_EVT_CONN_SEC_SUCCEEDED 
00> 
<00> info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 
00> 
<00> info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 
00> 
<00> info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 
00> 
<00> info> app: DEFUALT 35
00> 
<00> info> app: DEFUALT 36
00> 
<00> info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 
00> 
<00> info> app: BLE_GAP_EVT_DISCONNECTED
00> 
<00> info> app: BLE_ADV_EVT_FAST
00> 
<00> info> app: BLE ADVERTISING START
00> 
<00> info> app: BLE_GAP_EVT_CONNECTED
00> 
<00> info> app: PM_EVT_CONN_SEC_PARAMS_REQ 
00> 
<00> info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 
00> 
<00> info> app: PM_EVT_BONDED_PEER_CONNECTED 
00> 
<00> info> app: PM_EVT_LOCAL_DB_CACHE_APPLIED 
00> 
<00> info> app: BLE_GAP_EVT_SEC_INFO_REQUEST
00> 
<00> info> app: PM_EVT_CONN_SEC_START 
00> 
<00> warning> peer_manager_smd: sd_ble_gap_sec_info_reply() returned NRF_EROR_INVALID_STATE, which is anerror unless the link is disconnecting.
<00> info> app: BLE_GAP_EVT_CONN_SEC_UPDATE   
00> 
<00> info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Encryption
<00> info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED 
00> 
<00> info> app: PM_EVT_CONN_SEC_SUCCEEDED 
00> 

I think 

BLE_GAP_EVT_SEC_INFO_REQUEST is occurred my code is

 case BLE_GAP_EVT_SEC_INFO_REQUEST:
            NRF_LOG_INFO("BLE_GAP_EVT_SEC_INFO_REQUEST\n");

            pm_peer_id_t peer_id;
            err_code = pm_peer_id_get(p_ble_evt->evt.gap_evt.conn_handle, &peer_id);
            APP_ERROR_CHECK(err_code);

            pm_peer_data_bonding_t bonding_data;
            err_code = pm_peer_data_bonding_load(peer_id, &bonding_data);
            APP_ERROR_CHECK(err_code);

            err_code = sd_ble_gap_sec_info_reply(p_ble_evt->evt.gap_evt.conn_handle, &bonding_data.own_ltk.enc_info, &bonding_data.peer_ble_id.id_info, NULL);
            APP_ERROR_CHECK(err_code);
            break;

I load data and reply sd_ble_gap_sec_info_reply.

Don't I need reply that?

Thank you in advance.

 

Parents Reply Children
No Data
Related