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

nRF51822(peripheral role): How to Update connection parameter?

My test: PCA10000+Master Control Panel(3.4.0.8098) as central role, conninterval=20ms nRF51822+softdevice(5.0) as peripheral role, conninterval=10ms then sd_ble_gap_conn_param_update(), conninterval=50ms

Master Control Panel Display: First: [10:26:30.4] ConnectToDevice() [10:26:30.8] ---------------------------- [10:26:30.8] Connected to device [10:26:30.8] Role: 0 [10:26:30.8] PeerAddressType: 1 [10:26:30.8] PeerAddress (MSB): F7D7A095897E [10:26:30.8] Connection Interval: 20.0ms [10:26:30.8] Connection Latency: 0 [10:26:30.8] Supervision Timeout: 3000ms [10:26:30.8] Clock Accuracy: (1) [10:26:30.8] ---------------------------- [10:26:30.8] Connected to 7E8995A0D7F7

sd_ble_gap_conn_param_update(): [10:28:38.3] Received Connection Parameter Update Request [10:28:38.3] ConnectionParameterUpdateResponse sent with ACCEPTED response [10:28:38.3] Connection Parameters Update sent. ConnInterval:50.0ms, SlaveLatency:0, SupervisionTimeout:3000.0ms [10:28:38.4] PacketQueueSearch skipped event code 0x0D then [10:28:58.8] Received Connection Parameter Update Request [10:28:58.8] ConnectionParameterUpdateResponse sent with ACCEPTED response [10:28:58.8] Connection Parameters Update sent. ConnInterval:10.0ms, SlaveLatency:0, SupervisionTimeout:3000.0ms [10:28:58.9] PacketQueueSearch skipped event code 0x0D

why?

  • This obviously shows that your application is sending another connection parameter update request. Most of the SDK examples include the ble_conn_params module, that can handle such update requests for you. I therefore suspect that it's this module that sends the second request.

    To solve it, you can either make ble_conn_params request the parameters you actually want by modifying the parameters passed to ble_conn_params_init(), or just remove the entire module and handle it yourself.

  • But Most of the SDK examples ble_conn_params_init(): cp_init.p_conn_params = NULL; not set connect interval!, then must other function do this.

    /**@brief Initialize the Connection Parameters module. */ static void conn_params_init(void) { uint32_t err_code; ble_conn_params_init_t cp_init;

    memset(&cp_init, 0, sizeof(cp_init));

    cp_init.p_conn_params = NULL; cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY; cp_init.next_conn_params_update_delay = NEXT_CONN_PARAMS_UPDATE_DELAY; cp_init.max_conn_params_update_count = MAX_CONN_PARAMS_UPDATE_COUNT; cp_init.start_on_notify_cccd_handle = BLE_GATT_HANDLE_INVALID; cp_init.disconnect_on_fail = false; cp_init.evt_handler = on_conn_params_evt; cp_init.error_handler = conn_params_error_handler;

    err_code = ble_conn_params_init(&cp_init); APP_ERROR_CHECK(err_code); }

  • As you can see in the comment on this field in the struct definition, setting it to NULL means that the module will go fetch the parameters from the stack: "Pointer to the connection parameters desired by the application. When calling ble_conn_params_init, if this parameter is set to NULL, the connection parameters will be fetched from host."

    Also, take a look at lines 107-126 in ble_conn_params.c, where you can see how this is done.

    I'm therefore still confident this is the cause of the behavior you're seeing.

  • Hi,

    could you tell me please what do the following events mean?

    3055;11:45:49.4300 [480100137] PacketQueueSearch skipped event code 0x0D 3056;11:45:49.4300 [480100137] PacketQueueSearch skipped event code 0x96

  • Those are internal Master Control Panel messages and are not relevant to your application or the BLE connection, you can safely ignore them.

Related