SLE串口透传测试
该教程演示如何通过两块开发板实现SLE数据传输测试,A开发板通过串口接收数据,然后通过SLE传输给B开发板,B开发板通过串口将接收到的数据打印出来;同样,B开发板通过串口接收数据,然后通过SLE传输给A开发板,A开发板通过串口将接收到的数据打印出来。在测试中需要一块开发板做为Server端,另外一块开发板做为Client端,两块开发板配对后就可以互发消息了。
一、准备工作
- 准备2块BearPi-Pico H2821开发板
二、编译 SLE UART Server代码
在Windows下编译操作
点击左侧的“KConfig”,打开配置界面.
选择Enable SLE UART Server sample
Application ---> [*] Enable Sample. [ ] Enable the Sample of peripheral. [*] Enable the Sample of products. [ ] Enable all the sample of product, it's just for build. [ ] Support BLE UART sample. [*] Support SLE UART sample. SLE UART Sample Configuration ---> Select sle uart type (Enable SLE UART Server sample.) ---> (X) Enable SLE UART Server sample. ( ) Enable SLE UART Client sample.
选择协议
Protocol ---> Select sle ble support ---> ( ) Select sle ble central default. (X) Select sle ble peripheral. ( ) Select sle peripheral. ( ) Select sle central. ( ) Select ble peripheral.
按下"Save"键保存配置。
编译烧录固件
参考环境搭建教程编译烧录代码
在Ubuntu下编译操作
在MobaXterm中输入:
./build.py menuconfig
选择Enable SLE UART Server sample
Application ---> [*] Enable Sample. [ ] Enable the Sample of peripheral. [*] Enable the Sample of products. [ ] Enable all the sample of product, it's just for build. [ ] Support BLE UART sample. [*] Support SLE UART sample. SLE UART Sample Configuration ---> Select sle uart type (Enable SLE UART Server sample.) ---> (X) Enable SLE UART Server sample. ( ) Enable SLE UART Client sample.
选择协议
Protocol ---> Select sle ble support ---> ( ) Select sle ble central default. (X) Select sle ble peripheral. ( ) Select sle peripheral. ( ) Select sle central. ( ) Select ble peripheral.
按下"ESC"键退出并保存配置。
编译烧录固件
参考环境搭建教程编译烧录代码
三、编译 SLE UART Client代码
在Windows下编译操作
点击左侧的“KConfig”,打开配置界面.
选择Enable SLE UART Client sample
Application ---> [*] Enable Sample. [ ] Enable the Sample of peripheral. [*] Enable the Sample of products. [ ] Enable all the sample of product, it's just for build. [ ] Support BLE UART sample. [*] Support SLE UART sample. SLE UART Sample Configuration ---> Select sle uart type (Enable SLE UART Server sample.) ---> ( ) Enable SLE UART Server sample. (X) Enable SLE UART Client sample.
选择协议
Protocol ---> Select sle ble support ---> (X) Select sle ble central default. ( ) Select sle ble peripheral. ( ) Select sle peripheral. ( ) Select sle central. ( ) Select ble peripheral.
按下"Save"键保存配置。
编译烧录固件
参考环境搭建教程编译烧录代码
在Ubuntu下编译操作
在MobaXterm中输入:
./build.py menuconfig
选择Enable SLE UART Client sample
Application ---> [*] Enable Sample. [ ] Enable the Sample of peripheral. [*] Enable the Sample of products. [ ] Enable all the sample of product, it's just for build. [ ] Support BLE UART sample. [*] Support SLE UART sample. SLE UART Sample Configuration ---> Select sle uart type (Enable SLE UART Server sample.) ---> ( ) Enable SLE UART Server sample. (X) Enable SLE UART Client sample.
选择协议
Protocol ---> Select sle ble support ---> (X) Select sle ble central default. ( ) Select sle ble peripheral. ( ) Select sle peripheral. ( ) Select sle central. ( ) Select ble peripheral.
按下"ESC"键退出并保存配置。
编译烧录固件
参考环境搭建教程编译烧录代码
四、测试
烧录固件后先启动server设备,再启动client设备,在串口工具的输入框中输入数据并发送,测试server和client设备之间的数据收发,如下图所示。