Raspberry Pi3 BLE as Central device receiving just one packet per connection interval - gatttool/hcitool

若如初见. 提交于 2019-12-10 11:44:49

问题


i would appreciate if someone can explain one issue i'm experiencing with Raspberry Pi 3 model B acting as a Central device on a BLE connection with a Peripheral device.

First, i successsfully connect both devices and enable notifications on the Central device using the folllowing hcitool/gatttool commands:

sudo hciconfig hci0 up
sudo gatttool --adapter=hci0 --device=XX:XX:XX:XX:XX:XX --adr_type=random --mtu=23 -I
[][LE]> connect
[][LE]> char-write-req 0x000c 0100

After that, i started receiving notifications on the Raspberry Pi3 model B, and using a BLE sniffer, i check that it receives 5 BLE packets with notified values per connection interval (that is OK), which is established by default to 54 (67,5ms). However, once both devices are connected, i update the connection parameters in order to modify the connection interval to, i.e. 24 (30ms) using the following hcitool command:

sudo hcitool lecup --handle=XX --min=24 --max=24

And the issue i found is that, once the connection parameters are updated, i checked that the Raspberry Pi3 model B starts receiving just 1 BLE packet per connection interval (That is not OK). The same behavioral is observed updating the conection parameters to higher values of connection interval, i.e. 800 (1s).

Could anyone give me an explanation of that issue? In addition, could anyone try to reproduce this procedure and check if the same issue is observed?

Thanks


回答1:


hcitool lecup uses hci_le_conn_update (http://elixir.free-electrons.com/linux/latest/source/net/bluetooth/hci_conn.c#L321) which sets the min_ce_len and max_ce_len to 0, which means it hints to the controller that the connection event length should be 0*0.625 ms. You don't want that. You want it to be as long as your connection interval if you would like to keep sending packets during the entire interval.

To test to set the CE length, use a raw command instead:

sudo hcitool cmd 0x08 0x13   0x40 0x00   0x18 0  0x18 0   0 0   0x60 0   0x30 0  0x30 0

This issues a connection parameter update request for handle 0x0040, with connection interval min/max=24*1.25 ms, slave latency=0, timeout=960ms, CE interval min/max=48*0.625 ms.



来源:https://stackoverflow.com/questions/46847750/raspberry-pi3-ble-as-central-device-receiving-just-one-packet-per-connection-int

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!