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

sd_ble_gap_disconnect causes nRf52 freezes

Dear Nordic expert,

I'm using nRF52840 as central with SDK 16.0.0. 

I establish a connection with a peripheral (phone) and then I need to drop the connection. I set a timer to drop the connection after a certain time.Once I call sd_ble_gap_disconnect, it returns success but I never receive the disconnect event and the CPU gets frozen with absolutely no report. 

Here's my code. It actually prints out NRF_LOG_INFO("disconnect") and then gets frozen. I'd appreciate any help.

static void Disconnect_Timer_handler(void * p_context)
{
ret_code_t err_code;

if (mylist[new_id].conn_handle != BLE_CONN_HANDLE_INVALID)
{
err_code = sd_ble_gap_disconnect(mylist[new_id].conn_handle,
BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
APP_ERROR_CHECK(err_code);
}
pairing_in_progress = 0;
pairing_status = PAIRING_IDLE;
NRF_LOG_INFO("disconnect");
}

Thanks

Parents
  • Hi,

    Thanks for your prompt reply. 

    I mean that the CPU is not responding at all. Please have a look at the attached call stack. It's got stocked in the highlighted line which is:

    HardFault_Handler:
    0x34bae: 0xe7fe B.N HardFault_Handler ; 0x34bae

    Once I receive a command (our own command) from the peripheral to drop, I start a timer to drop the connection on the timer timeout. But I never get any other event (not even the disconnect event) and the CPU is stopped. 

    If I just comment out the  sd_ble_gap_disconnect line, the app works fine. That's why I think the problem is with dropping the connection.

    Thanks

  • Hi,

    I'm sorry I had forgotten to attach the screenshot and I am terribly sorry the problem was from our code not related to the sd_ble_gap_disconnect. It's now resolved.

    Thanks

Reply Children
No Data
Related