接【BearPi-Pico H3863星闪开发板体验连载】星闪超低功耗SLE串口透传server端发代码控制Client端蓝色LED
BearPi星闪Client端配置:
点击工具栏中的“系统配置”,打开配置界面.
选择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.
按下"Save"键保存配置。
在application\samples\products\sle_uart\sle_uart.c
文件 void sle_uart_notification_cb(uint8_t client_id, uint16_t conn_id, ssapc_handle_value_t *data,errcode_t status)`函数中更改为:
if (data->data_len == strlen("RLED_ON") && data->data[0] == 'R' && data->data[1] == 'L' && data->data[2] == 'E' &&
data->data[3] == 'D' && data->data[4] == '_' && data->data[5] == 'O' && data->data[6] == 'N') {
last_led = 1;
}
if (data->data_len == strlen("GLED_OFF") && data->data[0] == 'R' && data->data[1] == 'L' && data->data[2] == 'E' &&
data->data[3] == 'D' && data->data[4] == '_' && data->data[5] == 'O' && data->data[6] == 'F' &&
data->data[7] == 'F') {
last_led = 2;
}
if (data->data_len == strlen("YLED_ON") && data->data[0] == 'Y' && data->data[1] == 'L' && data->data[2] == 'E' &&
data->data[3] == 'D' && data->data[4] == '_' && data->data[5] == 'O' && data->data[6] == 'N') {
last_led = 3;
更改_uart_client.c中#define SLE_UART_SERVER_NAME
| 选择案例:点击工具栏中的“系统配置”选项,选择Application目录,勾选“Enable Sample”、“Enable the Sample of peripheral”以及需要要编译的BLINK,并保存。
编译操作:
NFO:root:
INFO:root:section_name section_size
INFO:root:startup 428
INFO:root:.sysintcall.init 52
INFO:root:.patch 2344
INFO:root:.rom_ram_cb_text 1816
INFO:root:.plat_romdata 212
INFO:root:.wifi_romdata 98
INFO:root:.btc_romdata 672
INFO:root:.btc_text_tcm 7206
INFO:root:.patch_on_tcm 1528
INFO:root:.btc_data_tcm 57
INFO:root:.wifi_data_tcm 3408
INFO:root:.plat_text_sram 10884
INFO:root:.patch_on_sram 2520
INFO:root:.plat_text_flash 177108
INFO:root:.wifi_text_flash 585302
INFO:root:.patch_on_flash 1908
INFO:root:.btc_text_flash 131560
INFO:root:.bth_text_flash 233004
INFO:root:.radar_text_flash 32012
INFO:root:.radar_ai_text_flash 5868
INFO:root:.text 42040
INFO:root:.btc_data_flash 4896
INFO:root:.bth_data_flash 2372
INFO:root:.data 380
INFO:root:total_size: 1247675
INFO:root:
INFO:root:++++++++++++++++++++++++++++++end buildAnalyzer++++++++++++++++++++++++++++++
project analysis Done!
================================ [SUCCESS] Took 178.29 seconds ================================```
-
终端将被任务重用,按任意键关闭。写入Client端
-
BearPi星闪Client端配置完成。
-
HiHope星闪Server端:
-
- src\application\samples\peripheral文件夹新建一个sample文件夹,在peripheral上右键选择“新建文件夹”,创建Sample文件夹,例如名称”sle_led“。
-
将\vendor\HiHope_NearLink_DK_WS63E_V03\sle_led文件里面内容拷贝到**步骤一创建的Sample文件夹中”sle_led“**下。
*:在src\application\samples\peripheral\CMakeLists.txt文件中新增编译案例,具体如下
if(DEFINED CONFIG_SAMPLE_SUPPORT_SLE_LED)
add_subdirectory_if_exist(sle_led)
endif()
- :在xxx\src\application\samples\peripheral\Kconfig文件中新增编译案例,具体如
config SAMPLE_SUPPORT_SLE_LED
bool
prompt "Support SLE_LED Sample."
default n
depends on ENABLE_PERIPHERAL_SAMPLE
help
This option means support SLE_LED Sample.
if SAMPLE_SUPPORT_SLE_LED
menu "SLE_LED Sample Configuration"
osource "application/samples/peripheral/sle_led/Kconfig"
endmenu
endif
*HiHope星闪 ******SLE_LED_SERVER端 *****:点击工具栏中的“系统配置”选项,选择Application目录,勾选“Enable Sample”、“Enable the Sample of peripheral”以及需要要编译的serverd端,选中“support SLE_LED_SERVER Sample”;(需要准备两块开发板,选择不同的编译选项,烧录不同的镜像),并保存。
. 编译: 点击工具栏中的“重编译”按钮,编译代码
时间比较长。
INFO:root:elf_path: ./output/ws63/acore/ws63-liteos-app/ws63-liteos-app.elf
INFO:root:map_path: ./output/ws63/acore/ws63-liteos-app/ws63-liteos-app.map
INFO:root:compiler_path: d:\\bearpi\\HiSpark Studio\\tools\\Windows\\cc_riscv32_musl_fp_win\\bin
INFO:root:build_config_path: None
INFO:root:prefix: riscv32-linux-musl
INFO:root:environment: windows
INFO:root:undef_addr_sections: ['.debug_info', '.debug_abbrev', '.debug_loc', '.debug_aranges', '.debug_ranges', '.debug_line', '.debug_str', '.comment', '.riscv.attributes', '.debug_frame']
INFO:root:no_size_sections: ['.plat_romtext', '.wifi_romtext', '.btc_romtext', '.bth_romtext', '.bth_romdata', '.plat_rombss', '.plat_text_tcm', '.wifi_text_tcm', '.plat_data_tcm', '.wifi_text_sram', '.btc_text_sram', '.bth_text_sram', '.wifi_data_sram', '.btc_data_sram', '.bth_data_sram', '.heap']
INFO:root:analysis sections: ['.text', '.data', '.bss', 'startup', '.sysintcall.init', '.patch', '.rom_ram_cb_text', '.plat_romdata', '.wifi_romdata', '.btc_romdata', '.bth_rombss', '.wifi_pkt_ram', '.btc_text_tcm', '.patch_on_tcm', '.btc_data_tcm', '.wifi_data_tcm', '.btc_bss_tcm', '.wifi_bss_tcm', '.plat_text_sram', '.patch_on_sram', '.plat_text_flash', '.wifi_text_flash', '.patch_on_flash', '.btc_text_flash', '.bth_text_flash', '.radar_text_flash', '.radar_ai_text_flash', '.btc_data_flash', '.bth_data_flash', '.plat_bss_sram', '.plat_bss_flash', '.wifi_bss_flash', '.radar_bss_flash', '.radar_ai_bss_flash', '.btc_bss_flash', '.bth_bss_flash', '.preserve', '.stacks']
INFO:root:
INFO:root:section_name section_size
INFO:root:startup 424
INFO:root:.sysintcall.init 52
INFO:root:.patch 2344
INFO:root:.rom_ram_cb_text 1816
INFO:root:.plat_romdata 212
INFO:root:.wifi_romdata 98
INFO:root:.btc_romdata 672
INFO:root:.btc_text_tcm 7206
INFO:root:.patch_on_tcm 1528
INFO:root:.btc_data_tcm 57
INFO:root:.wifi_data_tcm 3408
INFO:root:.plat_text_sram 10884
INFO:root:.patch_on_sram 2520
INFO:root:.plat_text_flash 176644
INFO:root:.wifi_text_flash 585358
INFO:root:.patch_on_flash 1908
INFO:root:.btc_text_flash 131560
INFO:root:.bth_text_flash 235112
INFO:root:.radar_text_flash 32012
INFO:root:.radar_ai_text_flash 5868
INFO:root:.text 42040
INFO:root:.btc_data_flash 4896
INFO:root:.bth_data_flash 2419
INFO:root:.data 380
INFO:root:total_size: 1249418
INFO:root:
INFO:root:++++++++++++++++++++++++++++++end buildAnalyzer++++++++++++++++++++++++++++++
project analysis Done!
================================ [SUCCESS] Too
5分钟以上。
[烧录镜像]
此程序包括烧录
command: d:\bearpi\HiSpark Studio\tools\cfbb\BurnTool\BurnTool.exe -com:10 -bin:d:\bearpi\sw63\src\output\ws63\fwpkg\ws63-liteos-app\ws63-liteos-app_all.fwpkg -signalbaud:921600 -reset -switchafterloader
Connecting, please reset device...
烧录进度: [####################################################################################################] 100/100
All images burn successfully
reset device
-
点击工具栏中的“工程配置”, 找到“程序加载”选项, 选择开发板与电脑连接后映射出来的端口。
-
点击工具栏中的“程序加载”,按一下开发板的复位按键就会进行烧录
-
下载完毕后,开发板复位,使用串口工具即可查看运行日志,日志打印波特率为115200。
此程序
com信息:
2024-10-18 16:53:26:694 -> [ACore] sle adv cbk in, event:0 status:0
2024-10-18 16:53:26:697 -> [ACore] sle adv cbk in, event:1 status:0
2024-10-18 16:53:26:699 -> [ACore] sle adv cbk in, event:2 status:0
2024-10-18 16:53:26:705 -> [ACore] sle adv cbk in, event:3 status:0
2024-10-18 16:53:26:708 -> APP|[SLE Adv] sle announce enable id:01, state:00
2024-10-18 16:53:26:713 -> APP|[SLE Adv] example_sle_server_adv_init out
2024-10-18 16:53:26:715 -> APP|[SLE Server] init ok
2024-10-18 16:53:32:607 -> APP|[SYS INFO] mem: used:89856, free:274132; log: drop/all[0/0], at_recv 0.
先开server端电再开Client端电Client端
com:
fe_rf_initialize
cali_offline_cali_entry enter
cali_set_cali_done_flag:old[0x0] -> new[0x1]
rf cali OK. time cost:22, ret:0
Test BLINKY
last_led: 0
Test BLINKY
last_led: 0
Test BLINKY
last_led: 0
xo update temp:3,diff:0,xo:0x3083c
Test BLINKY
last_led: 0
[SLE Client] try enable.
[ACore] sle enable cbk in, result:0
sle enable: 0.
sle enable
Test BLINKY
last_led: 0
Test BLINKY
last_led: 0
Test BLINKY
last_led: 0
Test BLINKY
last_led: 0
Test BLINKY
last_led: 0
[SLE Client] try enable.
[SLE Client] sle enbale fail !
[adv_report] event_type: 0x03, addr_type: 0x0000, addr: 04:**:**:**:06:03
[adv_report] data length: 6, data: 0x02 0x01 0x01 0x02 0x02 0x00
[adv_report] event_type: 0x0b, addr_type: 0x0000, addr: 04:**:**:**:06:03
[adv_report] data length: 19, data: 0x02 0x0c 0x0a 0x0f 0x0b 0x53
[sle uart client] sle uart scan data :
[sle uart client] sle uart scan data :
SLE_L_SERVER
[Connected]
addr:04:**:**:**:06:03, handle:00
[sle uart client] conn state changed disc_reason:0x0
[sle uart client] SLE_ACB_STATE_CONNECTED
[sle uart client] sle_low_latency_rx_enable
Test BLINKY
last_led: 0
[sle uart client] pair complete conn_id:0, addr:04***0603
ssapc exchange info, conn_id:0, err_code:0
[sle uart client] exchange_info_cbk,pair complete client id:0 status:0
[sle uart client] exchange mtu, mtu size: 520, version: 1.
discovery character cbk in
discovery character cbk complete in
[sle uart client] sle_uart_client_sample_find_property_cbk, client id: 0, conn id: 0, operate ind: 0, descriptors count: 1 status:0 property->handle 2
[sle uart client] sle_uart_client_sample_find_structure_cmp_cbk,client id:0 status:0 type:3 uuid len:0
sle uart recived data : RLED_ON
RLED_ONAPP|1 bearpiAPP|[SYS INFO] mem: used:94612, free:268784; log: drop/all[0/0], at_recv 0.
Test BLINKY
Hello BearPi! 0
last_led: 1
sle uart recived data : RLED_OFF
RLED_OFF
sle uart recived data : YLED_ONF
YLED_ONTest BLINKY
last_led: 3
sle uart recived data : YLED_OFF
YLED_OFF
sle uart recived data : GLED_ON
GLED_ONTest BLINKY
last_led: 0
sle uart recived data : GLED_OFF
GLED_OFF
sle uart recived data : RLED_ONF
RLED_ONTest BLINKY
last_led: 1
sle uart recived data : RLED_OFF
RLED_OFF
sle uart recived data : YLED_ON