Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52 SDK13 connection parameter negotiation

Hi!

I'm working on HID mouse example on SDK 13.0.0, SoftDevice S1332 v4.0.5. I'm supposed to use this as a low power media button control, using a nRF52 DK. 
I've done a few modicifations on the code for power optimizations, such as setting TX power, set the preferred connection paramaters slightly according to Android spec and disabled logging. 

 

I've set the min, max connection intervals and latency parameters non rigid, to be compliant with as much devices as possible at this point. Since I want this device to be low power I would like it to stay as close to the 4 second boundary as possible regarding connection intervals. The connection intervals are set this way:

 

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)            /**< Minimum connection interval (7.5 ms). */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(125, UNIT_1_25_MS)             /**< Maximum connection interval (15 ms). */
#define SLAVE_LATENCY                   30                                         /**< Slave latency. (30 ) */
#define CONN_SUP_TIMEOUT               	MSEC_TO_UNITS(20000, UNIT_10_MS)             /**< Connection supervisory timeout (20000 ms). */

When I connect the nRF52 as a peripheral to my phone (Huawei P9 Plus), they connect, exchange connection parameters, and stay connected according to my "low power connection intervals". I have verified the connection intervals by current measurements on the nRF52, as well as a nrf sniffer trace.

These two devices can stay connected on the "low power connection intervals" for longer periods, but when the devices gets disconnected by being too far away from each other, and then reconnect, they seem to operate on the Android CONNECTION_PRIORITY_BALANCED plan, which is 50 ms interval. They dont seem to negotiate for connection parameters again either, as I've measured on the oscillioscope for at least 15 minutes after reconnection.
My sniffer trace hasn't been able to track the "reconnection event", the unit I'm using as sniffer is probably not able to capture the reconnection event due to high sensitivity. 

However, if I disable and enable the bluetooth on my phone, the two previosly bonded devices seem to reconnect and communicate on my own custom connection interval. 

From what I've seen in the HID mouse example code, the ble_evt_dispatch is set while initiating the BLE stack. 
From ble_evt_dispatch,  ble_conn_params_on_ble_evt is called. 
Further the BLE_GAP_EVT_CONNECTED should be the case upon connection and reconnection?
From BLE_GAP_EVT_CONNECTED, on_connect is called, which eventually resets the update counter and should initiate a new connection parameter negotiation.
This should mean that a parameter negotiation should occur for each time a device connects. 

Does anyone have a clue regarding what could be the issue here? 

The project file is located here:

https://github.com/petter15/ble_app_hids_mouse

  • Hi,

    I have verified the connection intervals by current measurements on the nRF52, as well as a nrf sniffer trace.

    What connection interval is used here? What is the value of your "low power connection intervals" ?

    This should mean that a parameter negotiation should occur for each time a device connects. 

    The negotiation is only started if the received connection parameters are not acceptable, i.e. outside your MIN_CONN_INTERVAL/MAX_CONN_INTERVAL interval.

    You could call sd_ble_gap_conn_param_update() with your "low power connection intervals" after e.g. 1-2 min after BLE_GAP_EVT_CONNECTED, if you don't want to change the MIN_CONN_INTERVAL/MAX_CONN_INTERVAL. Also note that for BLE HID keyboard/mouse, you generally want a low connection interval, so that the keyboard/mouse feels responsive for the end-user.

  • The connection intervals used as my "custom low power" are (125, 30, 20 000). 

    I've implemented a connection parameter negotiation 60 seconds after connection, which seem to work well by now. The updated build is tested on Android and Windows devices, and most of them seem to be affected by the connection parameter negotiation. 

Related