Raspberry Pi3 BLE作为中央设备在每个连接间隔仅接收一个数据包-gatttool/hcitool [英] Raspberry Pi3 BLE as Central device receiving just one packet per connection interval - gatttool/hcitool

查看:241
本文介绍了Raspberry Pi3 BLE作为中央设备在每个连接间隔仅接收一个数据包-gatttool/hcitool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人能解释我在与外围设备的BLE连接中充当中央设备的Raspberry Pi 3模型B遇到的一个问题,我将不胜感激.

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.

首先,我成功连接了两个设备,并使用以下hcitool/gatttool命令在中央设备上启用了通知:

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

此后,我开始在Raspberry Pi3模型B上接收通知,并使用BLE嗅探器,检查它是否在每个连接间隔(即确定)接收到5个BLE数据包,这些数据包具有已通知值(默认情况下设置为54) (67,5ms).但是,一旦两个设备都连接好,我将更新连接参数,以便使用以下hcitool命令将连接间隔修改为24(30ms):

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

我发现的问题是,一旦更新了连接参数,我检查了Raspberry Pi3模型B在每个连接间隔开始只接收1个BLE数据包(那不是很好).观察到相同的行为,将连接参数更新为较高的连接间隔值,即800(1s).

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?

谢谢

推荐答案

hcitool lecup使用hci_le_conn_update(

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.

要测试设置CE长度,请使用原始命令:

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

这将发出句柄0x0040的连接参数更新请求,连接间隔为min/max = 24 * 1.25 ms,从属延迟== 0,超时= 960ms,CE间隔min/max = 48 * 0.625 ms.

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.

这篇关于Raspberry Pi3 BLE作为中央设备在每个连接间隔仅接收一个数据包-gatttool/hcitool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆