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

MIN_CONN_INTERVAL and MAX_CONN_INTERVAL using ble_nus_data_send.

Hello,

Im using SDK 15 ble pheripheral and central uart example on my custom nrf52832 board. 

I would like to know how to set  MIN_CONN_INTERVAL and MAX_CONN_INTERVAL for connection when im sending 20bytes 

in frame every 8ms using timer for 60 seconds continously. How to calculate it?

Parents
  • 7.5 min and max  disconnecting much more than min 8ms and max 9ms settings. 

  • A disconnect may happen when the central does not accept the connection interval parameters. In this case a BLE_GAP_EVT_CONN_PARAM_UPDATE event is received with the parameters selected by the central. The peripheral attempts to update the parameters max_conn_params_update_count times, which will obviously fail since it keeps trying the same values. Next a BLE_CONN_PARAMS_EVT_FAILED is received and the connection drops. Usually the handler calls sd_ble_gap_disconnect, then the central reconnects. If it doesn't call this, then the central remains connected, but no further communication is possible. When first_conn_params_update_delay is 5, next_conn_params_update_delay is 30, and max_conn_params_update_count is 3, the expected time between disconnects is 95 seconds.

    The solution is to negotiate the parameters: When BLE_GAP_EVT_CONN_PARAM_UPDATE is received, check if the values match what the peripheral asked for. If not, I would reduce min, since I prefer low latency. If that fails too, I would set max to whatever the central suggested, and then it should work. Call ble_conn_params_change_conn_params with the new values.

    The iPhone behaviour in particular deprived of any sane logic. If you ask for 20-20 it will use 33.75. It will happily accept 15 or 30, then it jumps up 3 steps or 3.75 ms. One might think that simply using 45-45 will work since the value is supported, but the iPhone will refuse it and use 60 instead. But if we say 30-45, it will agree on 45.

Reply
  • A disconnect may happen when the central does not accept the connection interval parameters. In this case a BLE_GAP_EVT_CONN_PARAM_UPDATE event is received with the parameters selected by the central. The peripheral attempts to update the parameters max_conn_params_update_count times, which will obviously fail since it keeps trying the same values. Next a BLE_CONN_PARAMS_EVT_FAILED is received and the connection drops. Usually the handler calls sd_ble_gap_disconnect, then the central reconnects. If it doesn't call this, then the central remains connected, but no further communication is possible. When first_conn_params_update_delay is 5, next_conn_params_update_delay is 30, and max_conn_params_update_count is 3, the expected time between disconnects is 95 seconds.

    The solution is to negotiate the parameters: When BLE_GAP_EVT_CONN_PARAM_UPDATE is received, check if the values match what the peripheral asked for. If not, I would reduce min, since I prefer low latency. If that fails too, I would set max to whatever the central suggested, and then it should work. Call ble_conn_params_change_conn_params with the new values.

    The iPhone behaviour in particular deprived of any sane logic. If you ask for 20-20 it will use 33.75. It will happily accept 15 or 30, then it jumps up 3 steps or 3.75 ms. One might think that simply using 45-45 will work since the value is supported, but the iPhone will refuse it and use 60 instead. But if we say 30-45, it will agree on 45.

Children
No Data
Related