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

Is there a way to reduce the link loss detection time?

ble_gap.hHi, At the moment, when a link loss is detected (in a connected mode), it takes around 3 seconds for it to be identified (with DISCONNECTED event). Is there a way to reduce this link loss detection time from 3 seconds to less than a second? Thanks.

  • No, you've misunderstood. Indeed your ble_gap.h file is intact, otherwise (most probably) Soft Device API calls stop working. You should SEARCH for Supervision Timeout and READ what is explained there. Moreover what you write in your original question isn't precise: if link timeouts because there are no answers from the peer (being Slave or Master, doesn't matter) then you should get different event then DISCONNECTED.

  • Thanks for the reply, endnode. You are correct. Found this in ble_gap.h : "The Supervision_Timeout in milliseconds shall be larger than (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds." .

    My max conn interval is 30msec and conn latency is 0.

    hash define MAX_CONNECTION_INTERVAL MSEC_TO_UNITS(30, UNIT_1_25_MS)
    hash define SLAVE_LATENCY 0
    hash define SUPERVISION_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS)

    Hence, I can reduce my supervision timeout from 4 seconds to 1 second. This works! Now, I get link loss indication after 1 second the link is actually lost. Thanks, again Endnode!

Related