Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Potential bug in SDK nRF5 17.0.0 example code for /ble_peripheral/ble_app_hts

After compiling, loading and running the example code for "ble_app_hts", on an nRF52 DK board, I connected to it using the nRF BLE Toolbox app "HTM" on an Android phone. The first time connecting worked as expected. However, upon initiating a disconnect on the central device, the connection LED1 on the board remained lit. Deleting the bonding information on the central resulted in LED1 turning off. However, subsequent attempts to connect resulted in "Bonding failed and Pairing rejected by Nordic HTS" error messages. Resetting the board and clearing the cache on the BLE Toolbox app did not resolve the problem. Neither did re-flashing the binary to the board. Eventually I found the following code in file "security_dispatcher.c" and after commenting out the last line "sec_status = BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP" the board will again pair and connect to the central device. Disconnecting on the central now causes LED1 to turn off without having to delete the bonding information and subsequent attempts to reconnect are successful. I have been unable to recreate the initial steps (with the last line of code included), since the "bond" information on the peripheral board must be stored in non-volatile memory and not get erased upon re-flashing, so all attempts to reconnect fail unless the last line of code is commented out..

#ifdef BLE_GAP_ROLE_PERIPH
if ((im_peer_id_get_by_conn_handle(conn_handle) != PM_PEER_ID_INVALID) &&
(role == BLE_GAP_ROLE_PERIPH) &&
!allow_repairing(conn_handle))
{
// Bond already exists. Reject the pairing request if the user doesn't intervene.
send_config_req(conn_handle);
if (!allow_repairing(conn_handle))
{
// Reject pairing.
////sec_status = BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP;
}
}
#endif // BLE_GAP_ROLE_PERIPH

Parents Reply Children
No Data
Related