BLE Throughput Example
Source path: example/ble/throughput
Supported Platforms
All platforms
Overview
This example demonstrates how this platform implements GAP central and peripheral roles, as well as GATT server and client functionalities, including connection establishment, service discovery, service registration, GATT write operations as a client, receiving notifications, receiving GATT writes as a server, and sending notifications.
Usage
Flash this program to two development boards.
After flashing and running, enter the following finsh command on one of the development boards:
diss speed_test 99227214AC03 512 0 100 65535 0
This will start the BLE throughput speed test, and the results will be printed in the log later.
Command parameters:
First parameter: Reversed address of the target board to connect (in this case, the address is 03:AC:14:72:22:99)
Second parameter: Negotiated MTU
Third parameter: Connection parameters (0 is the default short interval connection parameter; you can add custom connection parameters for testing as needed)
Fourth parameter: Number of packets to send in one test
Fifth parameter: Length of each packet (0 to 65535; if exceeding MTU limit, it will be filled according to the maximum length, i.e., MTU-3)
Sixth parameter: Frequency of peer replies during transmission (e.g., setting to 10 means reply once every 10 packets; 0 means no reply)
Hardware Requirements
Before running this example, prepare:
Two development boards supported by this example (Supported Platforms)
Compilation and Flashing
Navigate to the example’s project/common directory and run the scons command to compile:
> scons --board=eh-lb525 -j32
Navigate to the example’s project/common/build_xx
directory, run uart_download.bat
, and select the port as prompted to download:
$ ./uart_download.bat
Uart Download
please input the serial port num:5
For detailed steps on compilation and downloading, please refer to the relevant section in the Quick Start Guide.
Expected Results
After the example starts:
After executing the finsh command, it will connect to another development board and send data. After transmission is complete, it will print information such as transfer speed.
Troubleshooting
After executing the finsh command and connecting to another development board, the connection immediately disconnects with reason code 62. When a disconnection with code 0x3e occurs immediately after connection, simply retry the test.
Reference Documentation
Update History
Version |
Date |
Release Notes |
---|---|---|
0.0.1 |
02/2025 |
Initial version |