蓝牙(BLE)传输数据的吞吐量

修改上一篇文章的程序,client定时发送数据,server把收到的数据写入flash而不发送到串口。测试BLE传输数据能达到的最大吞吐量,结果如下:

1)2.5 KB/s @interval = 40 ms, latency = 0, client每40 ms调用gecko_cmd_gatt_write_characteristic_value发送200字节数据;

2)5 KB/s @interval = 20 ms, latency = 0, client每40 ms调用gecko_cmd_gatt_write_characteristic_value发送200字节数据;

3)10 KB/s @interval = 20 ms, latency = 0, client每20 ms调用gecko_cmd_gatt_write_characteristic_value_without_response发送200字节数据;

4)20 KB/s @interval = 20 ms, latency = 0, client每10 ms调用gecko_cmd_gatt_write_characteristic_value_without_response发送200字节数据;

5)20 KB/s @interval = 20 ms, latency = 0, client每5 ms调用gecko_cmd_gatt_write_characteristic_value_without_response发送200字节数据;

6)20 KB/s @interval = 10 ms, latency = 0, client每5 ms调用gecko_cmd_gatt_write_characteristic_value_without_response发送200字节数据;

781 KB/s @interval = 40 ms, latency = 0, client10 ms调用4gecko_cmd_gatt_write_characteristic_value_without_response发送240字节数据。

用write方式,两个interval才能传送一个包(1, 2);而用write_without_response方式,每个interval可以传送多个包,包数由物理层速率和包长度决定。

当把发送间隔减小到5 ms时,吞吐量跟10 ms时一样(5, 6),这是因为soft timer支持的最短间隔是10 ms,所以实际上还是每10 ms才发送了一次。

可以一次调用几遍write_without_response,这样能发送更多的数据(超过MTU),达到接近极限的数据吞吐量。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值