Pierre Pitiot
Pierre Pitiot

Reputation: 81

BLE connect interval setting

For an application reading a block of data (9000 bytes) from a BLE device I need to modify the connect interval to be as fast as possible.

I am running BlueZ stack 4.101 with a linux kernel = 3.14.43

Presently, I am able to do that using "hcitool lecup" after connecting the device but it means to do first "connect" then get the connection handle using "hcitool con" and finally "hcitool lecup" with min and max=6 (minimum value = 7.5 ms).

This is working fine but "hcitool lecup" takes around 600 ms after a "connect" that is taking several hundreds of ms. The connection parameters are reset when the device disconnect, meaning that this sequence has to be done on each connection.

Using BlueZ tools (hcitool and gatttool) is it possible to pass the connection parameters directly during the connect process or is it mandatory to first connect then modify connection parameters in a second step.

Many Thanks

Upvotes: 8

Views: 3542

Answers (2)

dimitrii_n
dimitrii_n

Reputation: 51

I was looking for the answer to the same question and was able to resolve the issue in the firmware of the device (I've used esp32 with nimble stack). The device served in this case a role of BLE central. And it seems that the bluez will try to accept what device is negotiating, so there was no need to specify this additionally (by writing to dev). So I ended up doing ble_gap_update_params api call on the embedded side, with connection interval min and max both set to minimum value, in this manner it was negotiated and confirmed by bluez stack.

Upvotes: 0

Krastanov
Krastanov

Reputation: 6549

You can set the connection interval through the hci kernel filesystem interface before starting the connection:

echo  6 > /sys/kernel/debug/bluetooth/hci0/conn_min_interval
echo 20 > /sys/kernel/debug/bluetooth/hci0/conn_max_interval

(in units of 1.25ms)

Upvotes: 5

Related Questions