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

Behavior of sd_ble_gap_conn_param_update

Peripheral: nrf52832

Central: nrf52840

The communication speed after executing sd_ble_gap_conn_param_update is different in the following two cases.

case 1:

When the BLE_GAP_EVT_CONNECTED event occurs,

Call sd_ble_gap_conn_param_update to update the communication parameter to the value of B.

case 2:

When the BLE_GAP_EVT_CONNECTED event occurs,

Call sd_ble_gap_conn_param_update to update the communication parameter to the value of A.

When BLE_GATTS_EVT_WRITE event occurs after BLE communication is established,

call sd_ble_gap_conn_param_update to update the communication parameters to the value of B.

A Parameter

#define MIN_CONN_INTERVAL MSEC_TO_UNITS(50, UNIT_1_25_MS)
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(65, UNIT_1_25_MS)
#define SLAVE_LATENCY 3
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS)

B Parameter

#define MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_1_25_MS)
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_1_25_MS)
#define SLAVE_LATENCY 0
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(10000, UNIT_10_MS)

Expect Behavior

Case 1 and case 2 have the same communication speed.

Actual Behavior

Case 1 has a much faster communication speed.

Is sd_ble_gap_conn_param_update used incorrectly?
Both update to the value of parameter B, but I don't know the reason for the difference in speed.

  • Hello,

    From the time you call sd_ble_gap_conn_params_update() it will take some time to update the actual parameters. And remember that it is actually the master/central that decides whether the new connection parameters are actually accepted or not.

    Which device requests the update? What is the connection parameter settings on the other device?

    Do you get the event BLE_GAP_EVT_CONN_PARAM_UPDATE event? If so, what are the connection parameters in that case? You can read them out by:

        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONN_PARAM_UPDATE:
                uint16_t max_conn_int = p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params.max_conn_interval;
                uint16_t min_conn_int = p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval;
                NRF_LOG_INFO("max: %d, min: %d", max_conn_int, min_conn_int);
                
                break;
            ...

    Please note that these are printed in units of 1.25ms. So 12 units corresponds to 15ms.

    BR,
    Edvin

  • >>Which device requests the update? What is the connection parameter settings on the other device?

    Peripheral requests an update.
    In the environment currently being confirmed, communication is 1: 1 for Pheripheral and Central.

    We confirmed the timing when UPDATE occurred again.
    The action of case B was performed, and the parameter was updated to the value of A without permission after the NEXT_CONN_PARAMS_UPDATE_DELAY time had elapsed.

  • I don't know why the value is returned after NEXT_CONN_PARAMS_UPDATE_DELAY time has passed.
    Why is the timer started?
    Does this mean that the parameter was not allowed to Central?

  • Sawada said:
    The action of case B was performed, and the parameter was updated to the value of A without permission after the NEXT_CONN_PARAMS_UPDATE_DELAY time had elapsed.

     What do you mean with "without permission"?

    Do you get the BLE_GAP_EVT_CONN_PARAM_UPDATE event?

     

     Can you specify what the connection parameters are (max and min) in the central? Does that change, or is it always:

    #define MIN_CONN_INTERVAL MSEC_TO_UNITS(50, UNIT_1_25_MS)
    #define MAX_CONN_INTERVAL MSEC_TO_UNITS(65, UNIT_1_25_MS)
    #define SLAVE_LATENCY 3
    #define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS)

  • >> What do you mean with "without permission"?
    The permission is a translation mistake.
    It means "the process has run without calling the function to change parameters" or "automatically".

    >>Do you get the BLE_GAP_EVT_CONN_PARAM_UPDATE event?
    Yes.

    >> Can you specify what the connection parameters are (max and min) in the central?
    Did not know that the connection parameter can be changed in Central.

    There is no Define such as MIN_CONN_INTERVAL, and there is no code that references it.
    How can I change the connection parameters in Central?

Related