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

Quick connection parameters update

Hello everyone,

I'm currently trying to change the connection parameters to be quick(100ms 0 slave latency) on a button press and after a timer timeout I go back to the low connection parameters.

I'm also sending a notification to an android application at the same time and then send back 2 characteristic ( LED toggle and a string for a LCD) .

It's working but it take quite a long time (10s) for my application to change the connection parameters so the 2 characteristic are not sent at quick connection parameters the first time but if I press a second time it's then updated and send it quickly.

Do you guys know a workaround this problem ?

  • Hi,

    The Bluetooth spec says that the master should allow a minimum of 6 connection events before the new connection parameters are applied. This could easily amount to 10s, depending on the old connection interval.

    You could try using a short connection interval and increasing slave latency to send the notifications more quickly. This would also conserve power.

    BR

  • Thks for the reply ^^ My "low" connection parameters are 1s for the max interval connection and 3 slave latency . How high could I go for the Slave latency for maximum current economy ?

  • what about having 250ms conn interval and 3 slave latency? Then you would have 1s sleep usually when the peripheral don't have anything to send, and 250ms latency when it does.

  • Hi

    You can adjust when the connection parameter update request is sent from the peripheral to the central. How that is done is described here. In many nRF51 SDK examples, e.g. the heart rate example (ble_app_hrs), the connection parameter update request is sent some time after you enable services on the peripheral device. Services are enabled when the central writes to the CCCD characteristics on the peripheral to make the peripheral start sending notifications/indications to the central. When services are enabled, the application receives a BLE_GATTS_EVT_WRITE event from the softdevice which is captured in the ble_conn_params_on_ble_evt function. The connection parameter negotiation proceidure is then started by calling the conn_params_negotiation() function which starts a timer which starts the connection parameter negotiation procedure after FIRST_CONN_PARAMS_UPDATE_DELAY milliseconds. The first step in the connection parameter negotiation procedure is sending connection parameter update request to the central.

    So in order to start the connection parameter negotiation procedure on a button press, simply call the conn_params_negotiation() function from your button handler instead and set the FIRST_CONN_PARAMS_UPDATE_DELAY to relatively short number to make the delay small from the time the button is pressed until the connection parameter update request is actually sent.

  • Correct me if I'm wrong, but I don't think this solves OP's problem. The question is how to get notification sent as quickly as possible when having a long connection interval. OP is trying to change from long to short connection interval and then sending notification, which has the 6 connection interval delay. This can be solved by choosing a suitable shorter connection interval and slave latency.

    This would be similar to a HID over GATT scenario.

Related