Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 447
Pierre Pitiot Avatar asked Oct 19 '16 08:10

Pierre Pitiot


People also ask

What is BLE connection interval?

The connection interval can range from 7.5ms up to 4s. The lowest connection interval that you could use depends on the capabilities of the device. Android devices can support a connection interval as low as 7.5 ms, whereas iOS devices can go down to 15ms.

What is supervision timeout in BLE?

The Connection Supervision Timeout parameter defines the time to wait for a data transfer before assuming that the connection was lost. In all Bluetooth and Bluetooth LE test suites this value is hard coded as 20 sec.

How many BLE devices can be connected?

x protocol SPEC, when the iPhone/Android phone play as role of BLE central mode, the limitation to have active connection at the same time is up to 8 devices.

How long does it take to establish a BLE connection?

Min Connection Interval (*1.25 mS) Enter the minimum time that a peripheral device can take to establish a BLE connection with the central device. This value is multiplied by a factor of 1.25 milliseconds. The minimum connection interval value is 6 ( 7.5 milliseconds).


1 Answers

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)

like image 51
Krastanov Avatar answered Oct 18 '22 17:10

Krastanov