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

BLE_GAP_EVT_DISCONNECTED never triggers

I have a peripheral that pairs to a central and establishes a connection (without bonding) without any trouble. When I disconnect the central (e.g. cutting power to the central), the peripheral never sees a BLE_GAP_EVT_DISCONNECTED event. I am checking for the event in on_ble_evt() just as the Nordic example code does.

Is this normal? How can the peripheral detect that link loss? I would like to be able to detect this so that I can resume advertising.

I'm using the nRF51822 S110 v8.0.0.

  • Hi Sagha,

    It's strange. Could you send your code ? Which SDK version you are using? Do you experience the same with the SDK's examples ?

  • I'm not sure which parts of my code I should provide an example of. I can say that the peripheral I'm using is a customized version of the Nordic DFU code and that the central is also a modified version of the DFU code. In the case of this strange behavior, the peripheral is updating the central. I did some more testing with the SDK examples, and it looks like the problem is the central instead of the peripheral. This is what I'm seeing:

    1. As a baseline, the Nordic DFU example in the SDK v8.0.0 examples works fine with the dongle/Master Control Panel interface. The Nordic DFU example sees the DISCONNECT event.

    2. The peripheral is nRF51822 S110 v8.0.0 with SDK v8.0.0. When I connect the peripheral to a dongle using the Master Control Panel and then disconnect it, the peripheral sees the DISCONNECT event. I can either disconnect by selecting the "Disconnect" button on the MCP or unplugging the dongle.

    3. The central is nRF51822 S120 v2.0.0 with SDK v8.0.0. I can connect the Nordic DFU example in the SDK v8.0.0 examples to the central. When I unplug the central (cut power to it), the Nordic DFU example code does not see a DISCONNECT event.

    It looks like the problem is with my central code. Why would turning off the central not adequately register as a disconnect event to the peripheral? Is that normal? How can I get the peripheral to know the central is no longer there?

  • I found my problem: I was setting the Connection Supervision Timeout too high compared to my system timeouts.

Related