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

BLE_GAP_SEC_STATUS_TIMEOUT issue


IPhoneX sometimes goes into the ble_evt_handler auth_status event, and then p_ble_evt->evt.gap_evt.params. Auth_status.auth_status!= BLE_GAP_SEC_STATUS_SUCCESS, other iPhone no issue. I don't know why like this. Thanks!

p_ble_evt->evt.gap_evt.params. Auth_status.auth_status value is BLE_GAP_SEC_STATUS_TIMEOUT 

p_ble_evt->evt.gap_evt.params.auth_status.error_src value is 0

if (p_ble_evt->evt.gap_evt.params.auth_status.auth_status == BLE_GAP_SEC_STATUS_SUCCESS)
{
    NRF_LOG_INFO("\r\nBonding success on device side!\n\r");
}
else
{
    sd_ble_gap_disconnect(p_ble_evt->evt.gap_evt.conn_handle,BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    NRF_LOG_INFO("\r\nBonding fail on device side due to: 0x%02x and %d \n\r",p_ble_evt->evt.gap_evt.params.auth_status.auth_status,p_ble_evt->evt.gap_evt.params.auth_status.error_src)
}

Parents
  • I think the best would be to create an sniffer log to find root cause:
    https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Sniffer 

    You may also try to call 'nrfjprog --eraseall' and re-program the nRF52840 to see if that helps in case bonding data is corrupted during development and prototyping.

    You may try to just increment the random static address, e.g. add the following after calling advertising_init().

    sd_ble_gap_addr_get(&m_ble_device_address); 
    m_ble_device_address.addr[2]++;
    sd_ble_gap_addr_set(&m_ble_device_address);

    Also, you may allow re-pairing by adding the following in pm_evt_handler() in main.c

    case PM_EVT_CONN_SEC_CONFIG_REQ:
    {
    // Allow or reject pairing request from an already bonded peer.
    pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true};
    pm_conn_sec_config_reply(p_evt->conn_handle, &conn_sec_config);
    } break;

Reply
  • I think the best would be to create an sniffer log to find root cause:
    https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Sniffer 

    You may also try to call 'nrfjprog --eraseall' and re-program the nRF52840 to see if that helps in case bonding data is corrupted during development and prototyping.

    You may try to just increment the random static address, e.g. add the following after calling advertising_init().

    sd_ble_gap_addr_get(&m_ble_device_address); 
    m_ble_device_address.addr[2]++;
    sd_ble_gap_addr_set(&m_ble_device_address);

    Also, you may allow re-pairing by adding the following in pm_evt_handler() in main.c

    case PM_EVT_CONN_SEC_CONFIG_REQ:
    {
    // Allow or reject pairing request from an already bonded peer.
    pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true};
    pm_conn_sec_config_reply(p_evt->conn_handle, &conn_sec_config);
    } break;

Children
No Data
Related