HiHope开发者社区
直播中

lustao

12年用户 469经验值
擅长:嵌入式技术
私信 关注
[经验]

【星闪派物联网开发套件体验连载】SLE交通灯控制

接上文【星闪派物联网开发套件体验连载】systick
W63E 案例含有一个sle_led,为星闪Server端向星闪client端发送指令信息,控制client端交通灯板红灯亮灭。每隔500毫秒,Server会通过星闪连接发送消息,来控制Client端交通灯板上的3个LED灯的亮/灭状态。两块星闪开发板 交通灯板 底板

  • src\application\samples\peripheral文件夹新建一个sample文件夹,在peripheral上右键选择“新建文件夹”,创建Sample文件夹,例如名称”sle_led“。
    image-70551992

  • 将\vendor\HiHope_NearLink_DK_WS63E_V03\sle_led文件里面内容拷贝到**步骤一创建的Sample文件夹中”sle_led“**下。
    image-20240403100728566

    *:在src\application\samples\peripheral\CMakeLists.txt文件中新增编译案例,具体如下
    image_20240808184434

if(DEFINED CONFIG_SAMPLE_SUPPORT_SLE_LED)
  add_subdirectory_if_exist(sle_led)
  endif()

  • :在xxx\src\application\samples\peripheral\Kconfig文件中新增编译案例,具体如
    image_20240808184555
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

SLE_LED_SERVER端 :点击工具栏中的“系统配置”选项,选择Application目录,勾选“Enable Sample”、“Enable the Sample of peripheral”以及需要要编译的serverd端,选中“support SLE_LED_SERVER Sample”;(需要准备两块开发板,选择不同的编译选项,烧录不同的镜像),并保存。未标题-1 拷贝.png
未标题-5 拷贝.jpg未标题-1 拷贝.png

. 编译: 点击工具栏中的“重编译”按钮,编译代码
Alt text


时间比较长。

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:--------------------Load Sections:--------------------

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分钟以上。

[烧录镜像]

此程序包括烧录
未标题-7 拷贝.png
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

  • 终端将被任务重用,按任意键关闭。
  1. 点击工具栏中的“工程配置”, 找到“程序加载”选项, 选择开发板与电脑连接后映射出来的端口。
    Alt text
  2. 点击工具栏中的“程序加载”,按一下开发板的复位按键就会进行烧录未标题-8 拷贝.png
  3. 下载完毕后,开发板复位,使用串口工具即可查看运行日志,日志打印波特率为115200。
    此程序
    未标题-9 拷贝.png

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.

SLE_LED client端:点击工具栏中的“系统配置”选项,选择Application目录,勾选“Enable Sample”、“Enable the Sample of peripheral”以及需要要编译的client端,选中“support SLE_LED_CLIENT Sample”,并保存。未标题-1 拷贝.png

未标题-5 拷贝.jpg未标题-1 拷贝.png

. 编译: 点击工具栏中的“重编译”按钮,编译代码
Alt text


时间比较长。

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:--------------------Load Sections:--------------------

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                         234488                                  

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                         2370                                    

INFO:root:.data                                   380                                     

INFO:root:total_size:                             1248745                                 
INFO:root:------------------------------------------------------

INFO:root:++++++++++++++++++++++++++++++end buildAnalyzer++++++++++++++++++++++++++++++

project analysis Done! 
================================ [SUCCESS] Took 174.77 seconds ================================

5分钟以上。

[烧录镜像]

此程序包括烧录
未标题-7 拷贝.png
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

  • 终端将被任务重用,按任意键关闭。
  1. 点击工具栏中的“工程配置”, 找到“程序加载”选项, 选择开发板与电脑连接后映射出来的端口。
    Alt text
  2. 点击工具栏中的“程序加载”,按一下开发板的复位按键就会进行烧录未标题-8 拷贝.png
  3. 下载完毕后,开发板复位,使用串口工具即可查看运行日志,日志打印波特率为115200。
    此程序
    未标题-9 拷贝.png

com信息:

2024-10-18 17:05:39:602 -> device_module_init:: succ!
2024-10-18 17:05:39:607 -> cali_set_cali_mask:old[0x0] -> new[0x1fa2]
2024-10-18 17:05:39:607 -> fe_rf_initialize
2024-10-18 17:05:39:611 -> cali_offline_cali_entry enter
2024-10-18 17:05:39:630 -> cali_set_cali_done_flag:old[0x0] -> new[0x1]
2024-10-18 17:05:39:633 -> rf cali OK. time cost:22, ret:0
2024-10-18 17:05:43:521 -> xo update temp:3,diff:0,xo:0x3083c
2024-10-18 17:05:44:600 -> APP|[SLE Client] try enable.
2024-10-18 17:05:44:605 -> [ACore] sle enable cbk in, result:0
2024-10-18 17:05:44:605 -> sle enable
2024-10-18 17:05:50:635 -> APP|[SYS INFO] mem: used:88872, free:275052; log: drop/all[0/0], at_recv 0.

SLE_LED和main function都在运行。

SLE_LED_SERVER端 SLE发送代码:
未标题-2 拷贝.png

同时上电
client端com信息:
2024-10-18 17:16:00:645 -> APP|[SYS INFO] mem: used:88872, free:275052; log: drop/all[0/0], at_recv 0.
2024-10-18 17:16:05:647 -> [adv_report] event_type: 0x03, addr_type: 0x0000, addr: 04::::06:03
2024-10-18 17:16:05:652 -> [adv_report] data length: 6, data: 0x02 0x01 0x01 0x02 0x02 0x00
2024-10-18 17:16:05:657 -> APP|[SLE Client] seek result find expected addr:04
0603
2024-10-18 17:16:05:732 -> [Connected]
2024-10-18 17:16:05:734 -> addr:04:
:::06:03, handle:00
2024-10-18 17:16:05:740 -> APP|[SLE Client] conn state changed conn_id:0x0, addr:04
0603
2024-10-18 17:16:05:744 -> APP|[SLE Client] conn state changed disc_reason:0x0
2024-10-18 17:16:06:017 -> APP|[SLE Client] pair complete conn_id:0x0, status:0x0, addr:04
*0603
2024-10-18 17:16:06:040 -> ssapc exchange info, conn_id:0, err_code:0
2024-10-18 17:16:06:046 -> APP|[SLE Client] pair complete client id:0x0, status:0x0
2024-10-18 17:16:06:050 -> APP|[SLE Client] exchange mtu, mtu size:0x12c, version:0x1.
2024-10-18 17:16:06:065 -> discovery character cbk complete in
2024-10-18 17:16:06:071 -> APP|[SLE Client] find structure cbk client:0x0 conn_id:0x0 status:0x0
2024-10-18 17:16:06:079 -> APP|[SLE Client] find structure start_hdl:[0x0001], end_hdl:[0x0002], uuid len:0x2
2024-10-18 17:16:06:082 -> APP|[SLE Client] structure uuid:[0xcd][0xab]
2024-10-18 17:16:06:090 -> APP|[SLE Client] find structure cmp cbk client id:0x0 conn_id:0x0 status:0x0 type:1 uuid len:0x0
2024-10-18 17:16:06:096 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x0]:[0x00]
2024-10-18 17:16:06:101 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x1]:[0x00]
2024-10-18 17:16:06:107 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x2]:[0x00]
2024-10-18 17:16:06:115 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x3]:[0x00]
2024-10-18 17:16:06:121 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x4]:[0x00]
2024-10-18 17:16:06:126 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x5]:[0x00]
2024-10-18 17:16:06:132 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x6]:[0x00]
2024-10-18 17:16:06:137 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x7]:[0x00]
2024-10-18 17:16:06:143 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x8]:[0x00]
2024-10-18 17:16:06:148 -> APP|[SLE Client] find structure cmp cbk structure uuid[0x9]:[0x00]
2024-10-18 17:16:06:154 -> APP|[SLE Client] find structure cmp cbk structure uuid[0xa]:[0x00]
2024-10-18 17:16:06:162 -> APP|[SLE Client] find structure cmp cbk structure uuid[0xb]:[0x00]
2024-10-18 17:16:06:168 -> APP|[SLE Client] find structure cmp cbk structure uuid[0xc]:[0x00]
2024-10-18 17:16:06:173 -> APP|[SLE Client] find structure cmp cbk structure uuid[0xd]:[0x00]
2024-10-18 17:16:06:179 -> APP|[SLE Client] find structure cmp cbk structure uuid[0xe]:[0x00]
2024-10-18 17:16:06:185 -> APP|[SLE Client] find structure cmp cbk structure uuid[0xf]:[0x00]
2024-10-18 17:16:06:518 -> APP|[SLE Client] notification cbk client id:0x0 conn id:0x0 status:0x0
2024-10-18 17:16:06:524 -> APP|[SLE Client] notification cbk handle:0x2, type:0x0 data len:0x7
2024-10-18 17:16:06:526 -> APP|[SLE Client] notification cbk[0x0] 0x52
2024-10-18 17:16:06:532 -> APP|[SLE Client] notification cbk[0x1] 0x4c
2024-10-18 17:16:06:535 -> APP|[SLE Client] notification cbk[0x2] 0x45
2024-10-18 17:16:06:540 -> APP|[SLE Client] notification cbk[0x3] 0x44
2024-10-18 17:16:06:543 -> APP|[SLE Client] notification cbk[0x4] 0x5f
2024-10-18 17:16:06:546 -> APP|[SLE Client] notification cbk[0x5] 0x4f
2024-10-18 17:16:06:551 -> APP|[SLE Client] notification cbk[0x6] 0x4e
2024-10-18 17:16:06:563 -> ssapc write rsp handle:1
2024-10-18 17:16:06:568 -> [sle write_req_complete_cbk]conn_id:0, err_code:0
2024-10-18 17:16:06:573 -> APP|[SLE Client] write cfm cbk client id:0x0 conn_id:0x0 status:0x0.
2024-10-18 17:16:06:579 -> APP|[SLE Client] write cfm cbk handle:0x1, type:0x0
2024-10-18 17:16:07:031 -> APP|[SLE Client] notification cbk client id:0x0 conn id:0x0 status:0x0
2024-10-18 17:16:07:036 -> APP|[SLE Client] notification cbk handle:0x2, type:0x0 data len:0x8
2024-10-18 17:16:07:039 -> APP|[SLE Client] notification cbk[0x0] 0x52
2024-10-18 17:16:07:044 -> APP|[SLE Client] notification cbk[0x1] 0x4c
2024-10-18 17:16:07:047 -> APP|[SLE Client] notification cbk[0x2] 0x45
2024-10-18 17:16:07:053 -> APP|[SLE Client] notification cbk[0x3] 0x44
2024-10-18 17:16:07:055 -> APP|[SLE Client] notification cbk[0x4] 0x5f
2024-10-18 17:16:07:058 -> APP|[SLE Client] notification cbk[0x5] 0x4f
2024-10-18 17:16:07:064 -> APP|[SLE Client] notification cbk[0x6] 0x46
2024-10-18 17:16:07:067 -> APP|[SLE Client] notification cbk[0x7] 0x46

VID_20241018_171717

更多回帖

发帖
×
20
完善资料,
赚取积分