Bluetooth:Throughput¶
1 功能概述¶
用于测试蓝牙的吞吐率,默认支持主从两个角色。
2 环境要求¶
board: 支持 BLE 的蓝牙设备
uart(option): 用来显示串口log
测试软件: nRF Connect
3 编译和烧录¶
例程位置:zephyr\samples_panchip\bluetooth\throughput
使用 ZAL 工具可以对其进行编译、烧录、打开 VS Code 调试等操作。关于 ZAL 工具的详细介绍请参考:Zephyr APP Launcher 工具介绍。
4 演示说明¶
准备2块板卡,均烧录
throughput
程序。两块EVB可以通过按键进入
Central
和Peripheral
不同的测试角色,通过KEY1
可以进入Central
模式,进入Central模式默认会进入Scan状态;通过KEY2
进入Peripheral
模式,默认会进入广播状态。如果Central
扫描到Peripheral
广播,会直接建立连接。下方为Central Log,其中支持命令如下(需要支持shell的串口工具,例如
Security CRT
等):config data_length 251
命令设置DLE为251个字节(最大值)。config phy 1M
设置phy为1M模式,支持1M
,2M
,S2
,S8
。config conn_interval 8
设置连接间隔为8,单位为1.25ms,8表示连接间隔为10ms。run
表示开始执行测试。Try to load HW calibration data.. DONE. - Chip Type : 0x80 - Chip CP Version : None - Chip FT Version : 8 - Chip MAC Address : D0000C0CBBF5 - Chip Flash UID : 32313334320EAC834330FFFFFFFFFFFF - Chip Flash Size : 1024 KB *** Booting Zephyr OS build zephyr-v2.7.0-1906-g5b63249e *** *** llcontroller-v1.0.0-06ff3d90 *** Starting Bluetooth Throughput example goon disable controller initializing.... tx power changed to 0 dBm Bluetooth initialized Press button 1 on the master board. Press button 2 on the slave board. [00:00:00.003,000] <wrn> bt_hci_core: Failed to set device name (-12) [00:00:00.072,000] <inf> bt_hci_core: Identity: FA:4F:CB:D6:A9:F2 (random) [00:00:00.072,000] <inf> bt_hci_core: HCI: version 5.1 (0x0a) revision 0x0003, manufacturer 0x07d1 [00:00:00.072,000] <inf> bt_hci_core: LMP: version 5.1 (0x0a) subver 0x0000 uart:~$ Master role. Starting scanning Filter not match. Address: 25:16:47:59:68:BB (random) connectable: 0 Filter not match. Address: 31:33:61:3C:2F:AB (random) connectable: 0 Filter not match. Address: 03:67:EE:4C:2A:47 (random) connectable: 0 Filter not match. Address: E9:F1:13:5B:E6:86 (public) connectable: 1 Filter not match. Address: 06:05:04:03:02:08 (public) connectable: 1 Filter not match. Address: 25:16:47:59:68:BB (random) connectable: 0 Filters matched. Address: D6:3D:69:7C:DC:71 (random) connectable: 1 Filter not match. Address: F2:77:EC:F7:BD:BF (random) connectable: 1 Updated MTU: TX: 23 RX: 23 bytes write_byte_number: 20 Connected as central Conn. interval is 24 units Service discovery completed MTU exchange pending Updated MTU: TX: 247 RX: 247 bytes write_byte_number: 244 MTU exchange successful Type 'config' to change the configuration parameters. You can use the Tab key to autocomplete your input. Type 'run' when you are ready to run the test. uart:~$ config data_length conn_interval phy print uart:~$ config data_length 251 LE Data Packet Length set to: 251 uart:~$ config phy 1M PHY set to: 1 Mbps uart:~$ config conn_interval 8 Connection interval set to: 8 uart:~$ run ==== Starting throughput test ==== LE PHY updated: TX PHY LE 1M, RX PHY LE 1M PHY update pending info.le.data_len:27,data_len->tx_max_len:251 LE Data length update pending LE data len updated: TX (len: 251 time: 2120) RX (len: 251 time: 328) Connection parameters update pending Connection parameters updated. interval: 8, latency: 0, timeout: 1000
start dummy write start throughput write ```
Peripheral
全程无需输入命令,只要通过KEY2
进入Peripheral
模式并且连接上即可。Try to load HW calibration data.. DONE. - Chip Type : 0x80 - Chip CP Version : None - Chip FT Version : 5 - Chip MAC Address : D0000C0293B4 - Chip Flash UID : 31373237300A23534330FFFFFFFFFFFF - Chip Flash Size : 1024 KB *** Booting Zephyr OS build zephyr-v2.7.0-1906-g5b63249e *** *** llcontroller-v1.0.0-06ff3d90 *** Starting Bluetooth Throughput example goon disable controller initializing.... tx power changed to 0 dBm Bluetooth initialized Press button 1 on the master board. Press button 2 on the slave board. [00:00:00.003,000] <wrn> bt_hci_core: Failed to set device name (-12) [00:00:00.072,000] <inf> bt_hci_core: Identity: CE:A1:84:8A:F8:DB (random) [00:00:00.072,000] <inf> bt_hci_core: HCI: version 5.1 (0x0a) revision 0x0003, manufacturer 0x07d1 [00:00:00.072,000] <inf> bt_hci_core: LMP: version 5.1 (0x0a) subver 0x0000 uart:~$ Slave role. Starting advertising delta:3 = next-currentUpdated MTU: TX: 23 RX: 23 bytes write_byte_number: 20 Connected as peripheral Conn. interval is 24 units Updated MTU: TX: 247 RX: 247 bytes write_byte_number: 244 [00:00:22.116,000] <inf> bt_adv: Start Advertising as CE:A1:84:8A:F8:DB (random) uart:~$ Connection parameters update request received. Minimum interval: 8, Maximum interval: 8 Latency: 0, Timeout: 1000 Connection parameters updated. interval: 8, latency: 0, timeout: 1000 =============================================================================================================================================================================================== [local] received 612684 bytes (598 KB) in 2511 GATT writes at 529165 bps
通过测试,我们给出一组推荐的参数使得吞吐率最大化,实际测试数据会随环境有所波动,此处仅供参考。
PHY模式 |
DLE |
Connection Interval(Unit:1.25ms) |
TX(Kbps) |
RX(bps) |
---|---|---|---|---|
1M |
251 |
8 |
561 |
529965 |
2M |
251 |
9 |
966 |
879613 |
S2 |
251 |
20 |
156 |
153505 |
S8 |
251 |
79 |
99 |
97865 |
5 RAM/Flash资源使用情况¶
Memory region Used Size Region Size %age Used
FLASH: 112852 B 384 KB 28.70%
SRAM: 40908 B 46 KB 86.85%