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

Unable to change SUPERVISION_TIMEOUT to quickly disconnect

Hi,

When I call  sd_ble_gap_disconnect( m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION), it usually takes about 100 msec, and come back with event BLE_GAP_EVT_DISCONNECTED, and with reason BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION. Occasionally, it will take 4 seconds, and I get reason BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT.

After searching through, I thought I could change the supervision timeout from 4 seconds to 2 seconds and speed up that process. However, it is still 4 seconds after the change. Below are the parameters.

#define MIN_CONNECTION_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) 
#define MAX_CONNECTION_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS)
#define SLAVE_LATENCY 0 
#define SUPERVISION_TIMEOUT MSEC_TO_UNITS(2000, UNIT_10_MS)

Initially, it uses sd_ble_gap_ppcp_set() to set up the values. I also tried adding sd_ble_gap_conn_param_update() before the disconnect call. The new supervision timeout value has no effect.

Both sides have the same parameters. Using SDK15.3.0 and nRF52832, s132_nrf52_6.1.1_softdevice.hex.

Any ideas? Thanks.

Parents
  • Hi. 

    That sounds strange. 

    Note that it is the central that will decide the connection parameters. Do you call the sd_ble_gap_conn_param_update() from the central or the peripheral?

    However, if both the central and the peripheral have the desired conn params defined from the start, the conn_param_update shouldn't be necessary. 

    From ble_gap.h: 
    NOTE:
    If both conn_sup_timeout and max_conn_interval are specified, then the following constraint applies:
    * conn_sup_timeout * 4 > (1 + slave_latency) * max_conn_interval
    * that corresponds to the following Bluetooth Spec requirement:
    * The Supervision_Timeout in milliseconds shall be larger than
    * (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds. 

    Looking at your values, you should be well inside this limitation. 

    Where are you changing the supervision timeout in your central?
    Do you change the:
    NRF_BLE_SCAN_SUPERVISION_TIMEOUT in the sdk_config.h in your central?
    If not, could you please try to make the following change to the sdk_config.h file:

    // <o> NRF_BLE_SCAN_SUPERVISION_TIMEOUT - Determines the supervision time-out in units of 10 millisecond.
    #ifndef NRF_BLE_SCAN_SUPERVISION_TIMEOUT
    #define NRF_BLE_SCAN_SUPERVISION_TIMEOUT 2000
    #endif

    Br, 
    Joakim Jakobsen

  • Hi Joakim,

    After I change NRF_BLE_SCAN_SUPERVISION_TIMEOUT from 4000 to 2000 in the Central, the Peripheral would time out in 2 seconds, instead of 4. I then leave everything the same but change the NRF_BLE_SCAN_SUPERVISION_TIMEOUT  to 1000. The Peripheral would time out in 1 second. It looks like that value control the timeout, but not the gap_conn_params.conn_sup_timeout in sd_ble_gap_ppcp_set(&gap_conn_params).

    Thanks for your help!

Reply
  • Hi Joakim,

    After I change NRF_BLE_SCAN_SUPERVISION_TIMEOUT from 4000 to 2000 in the Central, the Peripheral would time out in 2 seconds, instead of 4. I then leave everything the same but change the NRF_BLE_SCAN_SUPERVISION_TIMEOUT  to 1000. The Peripheral would time out in 1 second. It looks like that value control the timeout, but not the gap_conn_params.conn_sup_timeout in sd_ble_gap_ppcp_set(&gap_conn_params).

    Thanks for your help!

Children
No Data
Related