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

sd_ble_gap_disconnect returns 0x08, BLE_GAP_EVT_DISCONNECTED never arrives, further attempts to disconnect fail, unable to reconnect - advertising stops.

Hey

I am working on nRF51822 SDK12, S130

I have encountered a problem when connecting and disconnecting from the device at a fast rate, occasionally comes an event in which the sd_ble_gap_disconnect() command fails (the error received is 0x08.), the BLE_GAP_EVT_DISCONNECTED never arrives, the device stops advertising and no longer available to reconnection. the device is gone. 

I have tried to disconnect again after a small interval, that does not help.

I have tried to wait for a long time for the BLE_GAP_EVT_DISCONNECTED to arrive, it never arrives.

I have tried to set m_conn_handle = BLE_CONN_HANDLE_INVALID as seen in some thread on the forum. that doesn't help.

nothing works 

Any advice will be much appreciated

Thanks!

Parents
  • Hi,

    Can you add debugging to ensure that if BLE_GAP_EVT_DISCONNECTED event occurs for instance before sd_ble_gap_disconnect() is called, then it is handled already. Error code 8 means: 

    Disconnection in progress or link has not been established.

    So either you have already disconnected (BLE_GAP_EVT_DISCONNECTED already occurred), or that you are calling sd_ble_gap_disconnect() before BLE_GAP_EVT_CONNECTED event has occurred. I can't really think of any other suggestion as long as the conn_handle is valid.

    Best regards,
    Kenneth

  • Hi Kenneth,

    Thanks for your help,

    I don't call sd_ble_gap_disconnect() after the event BLE_GAP_EVT_DISCONNECTED and I only call sd_ble_gap_disconnect() after BLE_GAP_EVT_CONNECTED, I use a simple 'connected' flag which I set at I set at BLE_GAP_EVT_CONNECTED event and reset at BLE_GAP_EVT_DISCONNECTED event, The flag being set is a condition to call sd_ble_gap_disconnect() 

    The central definitely might disconnects before I have disconnected actively, can it be that the soft-device considered the link to be Disconnected before issuing the event?

    Best regards

Reply
  • Hi Kenneth,

    Thanks for your help,

    I don't call sd_ble_gap_disconnect() after the event BLE_GAP_EVT_DISCONNECTED and I only call sd_ble_gap_disconnect() after BLE_GAP_EVT_CONNECTED, I use a simple 'connected' flag which I set at I set at BLE_GAP_EVT_CONNECTED event and reset at BLE_GAP_EVT_DISCONNECTED event, The flag being set is a condition to call sd_ble_gap_disconnect() 

    The central definitely might disconnects before I have disconnected actively, can it be that the soft-device considered the link to be Disconnected before issuing the event?

    Best regards

Children
No Data
Related