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

How to use the default connection paramater as set by the central?

I'm using the nRF52 + SDK11.0.0 + s132 and the ble_hrs example. The function conn_params_init() is called to initialize the connection parameters that the peripheral will request, but where is the actual call to request the new connection parameter made? I want to disable this and use the defaults as set by the central.

  • The functions implementing the connection parameters negotiation can be found in ble_conn_params.c. The initial connection parameters are set by the central on connection. The function on_connect() is called, and the initial connection parameters are saved in m_current_conn_params.

    The parameter negotiation is done in the function conn_params_negotiation(), where the function is_conn_params_ok() is used to check if the connection parameters received from the central are acceptable.

    If the initial received parameters are not acceptable, a timer called m_conn_params_timer_id is started. When the timer expires after FIRST_CONN_PARAMS_UPDATE_DELAY, and the peripheral still haven't received any acceptable connection parameters from the central, it will send a connection parameters update request to the central, with the preferred connection parameters. This is done by calling the function sd_ble_gap_conn_param_update().

    So if you want to always accept the connection parameters from the central, I suggest you in main.c set MIN_CONN_INTERVAL to 7.5 ms and MAX_CONN_INTERVAL to 4 s. This is the minium and maximum connection interval supported by the SoftDevice. Another solution could be to change is_conn_params_ok() to always return true.

Related