本文来源电子发烧友社区,作者:赵杰, 帖子地址:https://bbs.elecfans.com/jishu_2293164_1_1.html
拿到跃昉科技BF2开发板有段时间,前面测试了一个demo后停了一段时间,虽然跃昉的技术支持很到位,但是整体感觉这款开发板应用过程中有很多的限制,因此也耽搁下来了。
当初申请这块板子的时候也是想测试WiFi的,但是尝试了几次感觉其使用方面不太方便,尤其是代码编写方面,感觉很复杂,因此先完成其WiFi的Demo测试,即Customer_App下的lf686_demo_wifi例程。
一、代码编译及下载
使用VSCode查看代码,并用MSYS2编译的,由于没改什么核心代码,编译也比较简单。
1、在msys2中进入到lf686_demo_wifi目录后,输入./genromap进行编译
正常情况下,直接完成编译
生成后的文件在该目录的build_out目录下。
2、在tools目录下的flash_tools中打开LFFlashEnv进行烧写
选择前面build_out目录下的Bin文件
烧写时需要把IO8拉到HI,然后复位后下载
三、运行结果
打开串口sscom,设置波特率2000000,就能获得启动过程中的信息,也是cli输入命令的窗口
启动信息部分之后,是系统初始化信息,即system_init信息
然后是lf_flash的分区信息
hal_board信息
后面是核心任务信息
后面是当前任务列表和启动环境信息
后面是usart初始化和wifi初始化相关信息
在串口sscom中输入help,可得到相关的支持命令
复制代码
通过串口输入相关命令,连接WiFi
wifi_sta_connect TP-LINK_6BE8 177381309xx
复制代码
可以看到比较完整的WiFi连接信息,及其结果,IP地址详细信息
成功连接WiFi后,可以用ping命令测试是否联网成功
复制代码
有个别丢包现象,应该是WiFi信号不够好
demo例程中提供了一个http下载的功能
复制代码
对应的命令是http,可以看到其下载的过程
复制代码
total的值,应该就是下载的字节数值。
三、心得体会
BF2的开发板提供了很多的demo,还是比较丰富的,只是其代码风格和公司的规定,可能有些特殊,感觉使用起来束缚感比较重,代码方面也感觉不够简单易用,想开发符合自己要求的应用,感觉难度不小,相对其他厂家的同类产品,如ESP32等,易用性以及性价比方面感觉存在不小的差距。最后,还是感觉跃昉科技和发烧友提供的评测机会!
拿到跃昉科技BF2开发板有段时间,前面测试了一个demo后停了一段时间,虽然跃昉的技术支持很到位,但是整体感觉这款开发板应用过程中有很多的限制,因此也耽搁下来了。
当初申请这块板子的时候也是想测试WiFi的,但是尝试了几次感觉其使用方面不太方便,尤其是代码编写方面,感觉很复杂,因此先完成其WiFi的Demo测试,即Customer_App下的lf686_demo_wifi例程。
一、代码编译及下载
使用VSCode查看代码,并用MSYS2编译的,由于没改什么核心代码,编译也比较简单。
1、在msys2中进入到lf686_demo_wifi目录后,输入./genromap进行编译
正常情况下,直接完成编译
生成后的文件在该目录的build_out目录下。
2、在tools目录下的flash_tools中打开LFFlashEnv进行烧写
选择前面build_out目录下的Bin文件
烧写时需要把IO8拉到HI,然后复位后下载
三、运行结果
打开串口sscom,设置波特率2000000,就能获得启动过程中的信息,也是cli输入命令的窗口
启动信息部分之后,是系统初始化信息,即system_init信息
然后是lf_flash的分区信息
hal_board信息
后面是核心任务信息
后面是当前任务列表和启动环境信息
后面是usart初始化和wifi初始化相关信息
在串口sscom中输入help,可得到相关的支持命令
- ====Support 4 cmds once, seperate by ; ====
- help : print this
- p : print memory
- m : modify memory
- echo : echo for command
- exit : close CLI
- devname : print device name
- sysver : system version
- reboot : reboot system
- poweroff : poweroff system
- reset : system reset
- time : system time
- ota : system ota
- ps : thread dump
- ls : file list
- hexdump : dump file
- cat : cat file
- ====User Commands====
- aws : aws iot demo
- pka : pka iot demo
- wifi : wifi
- sha : sha iot demo
- trng : trng test
- aes : trng test
- cks : cks test
- dma : dma test
- exception_load : exception load test
- exception_l_illegal : exception load test
- exception_store : exception store test
- exception_inst_illegal : exception illegal instruction
- stack_wifi : Wi-Fi Stack
- http : http client download test based on socket
- httpc : http client download test based on RAW TCP
- coex_dump : coex dump
- rf_dump : rf dump
- wifi_ap_bcnint_set : wifi ap bcnin set
- wifi_capcode : wifi capcode
- wifi_scan : wifi scan
- wifi_scan_filter : wifi scan
- wifi_mon : wifi monitor
- wifi_raw_send : wifi raw send test
- wifi_sta_info : wifi sta info
- wifi_sta_ip_set : wifi STA IP config [ip] [mask] [gw] [dns1] [dns2]
- wifi_sta_ip_unset : wifi STA IP config unset
- wifi_sta_disconnect : wifi station disconnect
- wifi_sta_connect : wifi station connect
- wifi_sta_get_state : wifi sta get state
- wifi_sta_autoconnect_enable: wifi station enable auto reconnect
- wifi_sta_autoconnect_disable: wifi station disable auto reconnect
- rc_fix_en : wifi rate control fixed rate enable
- rc_fix_dis : wifi rate control fixed rate diable
- wifi_sta_ps_on : wifi power saving mode ON
- wifi_sta_ps_off : wifi power saving mode OFF
- wifi_sta_denoise_enable: wifi denoise
- wifi_sta_denoise_disable : wifi denoise
- wifi_sniffer_on : wifi sniffer mode on
- wifi_sniffer_off : wifi sniffer mode off
- wifi_ap_start : start Ap mode
- wifi_ap_stop : stop Ap mode
- wifi_ap_conf_max_sta : config Ap max sta
- wifi_dump : dump fw statistic
- wifi_cfg : wifi cfg cmd
- wifi_mib : dump mib statistic
- wifi_pkt : wifi dump needed
- wifi_coex_rf_force_on : wifi coex RF forece on
- wifi_coex_rf_force_off : wifi coex RF forece off
- wifi_coex_pti_force_on : wifi coex PTI forece on
- wifi_coex_pti_force_off: wifi coex PTI forece off
- wifi_coex_pta_force_on : wifi coex PTA forece on
- wifi_coex_pta_force_off: wifi coex PTA forece off
- wifi_sta_list : get sta list in AP mode
- wifi_sta_del : delete one sta in AP mode
- wifi_edca_dump : dump EDCA data
- wifi_state : get wifi_state
- wifi_update_power : Power table test command
- looprt : looprt based on bloop
- looprt_status : looprt based on bloop
- looprt_evt : looprt notify event
- looprt_evt_status : looprt evt to dump
- looprt_schedule1 : looprt schedule evt 20s
- looprt_schedule2 : looprt schedule evt 10s
- tcpc : create a tcpc for in a new task
- tcps : create a tcp server for in a new task
- ipc : iperf TCP client
- ips : iperf TCP server
- ipu : iperf UDP client
- ipus : iperf UDP server
- netstat : show current net states
- ping : ping [-c count] [-i interval] [-W timeout] [-s size] [-h help] destination
- -c count of ping requests. default is infinite
- -i interval in ms. default is 1000
- -W timeout in ms. default is 5000
- -s ICMP payload size in bsntp_start : sntp start
- sntp_time : sntp time
- sntp_date : sntp date
- blfdt : blfdt
- blogset : blog pri set level
- blogdump : blog info dump
- ota_tcp : OTA from TCP server port 3333
- ota_dump : dump partitions for ota related
- lf_sys_time_now : sys time now
- psm_set : psm set
- psm_unset : psm unset
- psm_get : psm get
- psm_dump : psm dump
- psm_erase : psm dump
- psm_test : psm test
- gpio-func : gpio-func pinnum 0/1[0:output, 1:input] 0/1[pullup] 0/1[pulldown]
- gpio-set : gpio-set pinnum 0/1
- gpio-get : gpio-get pinnum
- wdt-init : wdt-init ms
- wdt-feed : wdt-feed
- wdt-disable : wdt-disable
- timer-start : timer-start
通过串口输入相关命令,连接WiFi
wifi_sta_connect TP-LINK_6BE8 177381309xx
- ----- BUG FIXME? NOT do STA enable again
- [WF] MM_ADD_IF_REQ Sending: STA
- 歵d_start idx=0
- [WF] MM_ADD_IF_REQ Done
- [WF] vif_index from LAMC is 0
- [WF][SM] Entering idle state
- [WF][SM] Action Connect
- ssid TP-LINK_6BE8
- ssid len 12
- psk 17738130986
- psk len 11
- pmk
- pmk len 0
- channel band 0
- channel freq 0
- mac 00:00:00:00:00:00
- dhcp status: true
- [WF][SM] State Action ###idle### --->>> ###connecting###
- connecting using vif_idx 0
- ===start sm_get_bss_params===
- bssid[0] = 0xffff
- bssid[1] = 0xffff
- bssid[2] = 0xffff
- search ssid = TP-LINK_6BE8
- result ssid index = -1
- ===end sm_get_bss_params===
- [WF][SM] Entering connecting state
- # [APP] [EVT] Connecting 880885
- ===start sm_get_bss_params===
- bssid[0] = 0xffff
- bssid[1] = 0xffff
- bssid[2] = 0xffff
- search ssid = TP-LINK_6BE8
- result ssid index = 0
- ===end sm_get_bss_params===
- wpa2/wpa3 pairwise ccmp:1,tkip:0,wep104:0,wep:40:0
- wpa2/wpa3 group ccmp:1,tkip:0,wep104:0,wep:40:0
- wpa2/wpa3 is_pmf_required:0
- AP Security mode: wep:0,wpa:1,wpa2:1,wpa3:0
- ------ 247 set default key 0x42018c08, key ptr 0x00000000
- [APP] [EVT] SCAN On Join 884653
- [ 890129][[32mINFO[0m: lf_adc.c: 260] offset = 2158
- proc_hellow_entry: RISC-V rv32imafc
- 4-way handshake timeout failure, wlan 802.11 reason code = 15, try to transmit deauth frame
- ind ix 0x4202303c, chan_ctxt is 0x420183f4
- connect failure, ssid = TP-LINK_6BE8, index = 0
- from sm_connect_ind to scanu_rm_exist_ssid
- [RX] Connection Status
- [RX] status_code 8
- [RX] connect result: Passwd error, 4-way handshake timeout
- [RX] MAC 74:05:A5:C3:6B:E8
- [RX] vif_idx 0
- [RX] ap_idx 0
- [RX] ch_idx 0
- [RX] qos 1
- [RX] acm 0
- [RX] assoc_req_ie_len 89
- [RX] assoc_rsp_ie_len 196
- [RX] aid 0
- [RX] band 0
- [RX] center_freq 2462
- [RX] width 0
- [RX] center_freq1 2462
- [RX] center_freq2 0
- [WF][SM] Exiting connecting state
- [WF][SM] State Action ###connecting### --->>> ###disconnect###
- [WF][SM] Entering disconnect state
- [WF][SM] Will retry in 2000 ticks
- [APP] [EVT] disconnect 894737, Reason: Passwd error, 4-way handshake timeout
- [WF][PF] Using profile, idx is @0
- [WF][SM] Retry Again --->>> retry connect
- [WF][SM] Exiting disconnect state
- Delete Timer.
- [WF][SM] State Action ###disconnect### --->>> ###connecting###
- [WF][SM]Action Connect
- ssid TP-LINK_6BE8
- ssid len 12
- psk 17738130986
- psk len 11
- pmk
- pmk len 0
- mac 00:00:00:00:00:00
- connecting using vif_idx 0
- ===start sm_get_bss_params===
- bssid[0] = 0xffff
- bssid[1] = 0xffff
- bssid[2] = 0xffff
- search ssid = TP-LINK_6BE8
- result ssid index = -1
- ===end sm_get_bss_params===
- [WF][SM] Entering connecting state
- [APP] [EVT] Reconnect 896740
- [APP] [EVT] Connecting 896740
- ===start sm_get_bss_params===
- bssid[0] = 0xffff
- bssid[1] = 0xffff
- bssid[2] = 0xffff
- search ssid = TP-LINK_6BE8
- result ssid index = 0
- ===end sm_get_bss_params===
- wpa2/wpa3 pairwise ccmp:1,tkip:0,wep104:0,wep:40:0
- wpa2/wpa3 group ccmp:1,tkip:0,wep104:0,wep:40:0
- wpa2/wpa3 is_pmf_required:0
- AP Security mode: wep:0,wpa:1,wpa2:1,wpa3:0
- ------ 247 set default key 0x42018d40, key ptr 0x00000000
- [APP] [EVT] SCAN On Join 900510
- proc_hellow_entry: RISC-V rv32imafc
- set key:sta_idx:1, inst_nbr:0, key_idx:0,cipher_suite:2,key_len:16
- set key:sta_idx:255, inst_nbr:0, key_idx:1,cipher_suite:2,key_len:16
- ind ix 0x42022e34, chan_ctxt is 0x42018410
- [RX] Connection Status
- [RX] status_code 0
- [RX] connect result: sm connect ind ok
- [RX] MAC 74:05:A5:C3:6B:E8
- [RX] vif_idx 0
- [RX] ap_idx 1
- [RX] ch_idx 0
- [RX] qos 1
- [RX] acm 0
- [RX] assoc_req_ie_len 89
- [RX] assoc_rsp_ie_len 196
- [RX] aid 0
- [RX] band 0
- [RX] center_freq 2462
- [RX] width 0
- [RX] center_freq1 2462
- [RX] center_freq2 0
- [WF][SM] Exiting connecting state
- [WF][SM] State Action ###connecting### --->>> ###wifiConnected_ipObtaining###
- [WF][SM] Entering wifiConnected_ipObtaining state
- [WF][SM] DHCP Starting...0x42019e24
- [APP] [EVT] connected 900828
- -----------------> AABA Request:
- A-MSDU: Not Permitted
- Block Ack Policy: Immediate Block Ack
- TID: 0
- Number of Buffers: 64
- -----------------> AABA Response:
- A-MSDU: Not Permitted
- Block Ack Policy: Immediate Block Ack
- TID: 0
- Number of Buffers: 8
- [lwip] netif status callback
- IP: 192.168.1.105
- MK: 255.255.255.0
- GW: 192.168.1.1
- [WF][SM] Exiting wifiConnected_ipObtaining state
- [WF][SM] IP GOT IP:192.168.1.105, MASK: 255.255.255.0, Gateway: 192.168.1.1, dns1: 172.16.16.16, dns2: 172.16.16.17
- [WF][SM] State Action ###wifiConnected_ipObtaining### --->>> ###wifiConnected_IPOK###
- [WF][SM] Entering wifiConnected_IPOK state
- [APP] [EVT] GOT IP 903003
- [SYS] Memory left is 133512 Bytes
可以看到比较完整的WiFi连接信息,及其结果,IP地址详细信息
成功连接WiFi后,可以用ping命令测试是否联网成功
- ping -c20 www.baidu.com
- # 60 bytes from 182.61.200.7: icmp_seq=1 ttl=47 time=38 ms
- 60 bytes from 182.61.200.7: icmp_seq=2 ttl=47 time=34 ms
- proc_hellow_entry: RISC-V rv32imafc
- 60 bytes from 182.61.200.7: icmp_seq=3 ttl=47 time=37 ms
- 60 bytes from 182.61.200.7: icmp_seq=5 ttl=47 time=36 ms
- 60 bytes from 182.61.200.7: icmp_seq=6 ttl=47 time=37 ms
- 60 bytes from 182.61.200.7: icmp_seq=7 ttl=47 time=38 ms
- 60 bytes from 182.61.200.7: icmp_seq=8 ttl=47 time=35 ms
- The sequence number 4 timed out
- 60 bytes from 182.61.200.7: icmp_seq=9 ttl=47 time=39 ms
- 60 bytes from 182.61.200.7: icmp_seq=10 ttl=47 time=42 ms
- 60 bytes from 182.61.200.7: icmp_seq=11 ttl=47 time=36 ms
- 60 bytes from 182.61.200.7: icmp_seq=12 ttl=47 time=34 ms
- proc_hellow_entry: RISC-V rv32imafc
- 60 bytes from 182.61.200.7: icmp_seq=13 ttl=47 time=36 ms
- 60 bytes from 182.61.200.7: icmp_seq=14 ttl=47 time=39 ms
- 60 bytes from 182.61.200.7: icmp_seq=15 ttl=47 time=39 ms
- 60 bytes from 182.61.200.7: icmp_seq=16 ttl=47 time=39 ms
- 60 bytes from 182.61.200.7: icmp_seq=17 ttl=47 time=40 ms
- 60 bytes from 182.61.200.7: icmp_seq=18 ttl=47 time=39 ms
- 60 bytes from 182.61.200.7: icmp_seq=19 ttl=47 time=34 ms
- 60 bytes from 182.61.200.7: icmp_seq=20 ttl=47 time=41 ms
有个别丢包现象,应该是WiFi信号不够好
demo例程中提供了一个http下载的功能
- static int client_demo(char *hostname)
- {
- int sockfd;
- /* Get host address from the input name */
- struct hostent *hostinfo = gethostbyname(hostname);
- uint8_t *recv_buffer;
- if (!hostinfo) {
- printf("gethostbyname Failedrn");
- return -1;
- }
- struct sockaddr_in dest;
- char buffer[MAXBUF];
- /* Create a socket */
- /*---Open socket for streaming---*/
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- printf("Error in socketrn");
- return -1;
- }
- /*---Initialize server address/port struct---*/
- memset(&dest, 0, sizeof(dest));
- dest.sin_family = AF_INET;
- dest.sin_port = htons(PORT);
- dest.sin_addr = *((struct in_addr *) hostinfo->h_addr);
- // char ip[16];
- uint32_t address = dest.sin_addr.s_addr;
- char *ip = inet_ntoa(address);
- printf("Server ip Address : %srn", ip);
- /*---Connect to server---*/
- if (connect(sockfd,
- (struct sockaddr *)&dest,
- sizeof(dest)) != 0) {
- printf("Error in connectrn");
- return -1;
- }
- /*---Get "Hello?"---*/
- memset(buffer, 0, MAXBUF);
- char wbuf[]
- = "GET /ddm/ContentResource/music/204.mp3 HTTP/1.1rnHost: nf.cr.dandanman.comrnUser-Agent: wmsdkrnAccept: */*rnrn";
- write(sockfd, wbuf, sizeof(wbuf) - 1);
- int ret = 0;
- int total = 0;
- int debug_counter = 0;
- uint32_t ticks_start, ticks_end, time_consumed;
- ticks_start = xTaskGetTickCount();
- recv_buffer = pvPortMalloc(BUFFER_SIZE);
- if (NULL == recv_buffer) {
- goto out;
- }
- while (1) {
- ret = read(sockfd, recv_buffer, BUFFER_SIZE);
- if (ret == 0) {
- printf("eofnr");
- break;
- } else if (ret < 0) {
- printf("ret = %d, err = %dnr", ret, errno);
- break;
- } else {
- total += ret;
- /*use less debug*/
- if (0 == ((debug_counter++) & 0xFF)) {
- printf("total = %d, ret = %dnr", total, ret);
- }
- //vTaskDelay(2);
- if (total > 82050000) {
- ticks_end = xTaskGetTickCount();
- time_consumed = ((uint32_t)(((int32_t)ticks_end) - ((int32_t)ticks_start))) / 1000;
- printf("Download comlete, total time %u s, speed %u Kbpsrn",
- (unsigned int)time_consumed,
- (unsigned int)(total / time_consumed * 8 / 1000)
- );
- break;
- }
- }
- }
- vPortFree(recv_buffer);
- out:
- close(sockfd);
- return 0;
- }
对应的命令是http,可以看到其下载的过程
- http
- Server ip Address : 60.255.154.100
- total = 688, ret = 688
- proc_hellow_entry: RISC-V rv32imafc
- total = 234608, ret = 688
- total = 468528, ret = 688
- proc_hellow_entry: RISC-V rv32imafc
- total = 695568, ret = 1376
- total = 920544, ret = 688
- proc_hellow_entry: RISC-V rv32imafc
- total = 1157216, ret = 688
- total = 1490896, ret = 1376
- proc_hellow_entry: RISC-V rv32imafc
- total = 1885808, ret = 2064
- proc_hellow_entry: RISC-V rv32imafc
- proc_hellow_entry: RISC-V rv32imafc
- proc_hellow_entry: RISC-V rv32imafc
- proc_hellow_entry: RISC-V rv32imafc
- eof
total的值,应该就是下载的字节数值。
三、心得体会
BF2的开发板提供了很多的demo,还是比较丰富的,只是其代码风格和公司的规定,可能有些特殊,感觉使用起来束缚感比较重,代码方面也感觉不够简单易用,想开发符合自己要求的应用,感觉难度不小,相对其他厂家的同类产品,如ESP32等,易用性以及性价比方面感觉存在不小的差距。最后,还是感觉跃昉科技和发烧友提供的评测机会!
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。
举报投诉
-
跃昉科技
+关注
关注
0文章
66浏览量
1874 -
开发板试用
+关注
关注
3文章
301浏览量
2038
发布评论请先 登录
相关推荐
有奖丨米尔 瑞芯微RK3576开发板免费试用
米尔与瑞芯微合作发布的新品基于瑞芯微RK3576应用处理器的MYD-LR3576开发板免费试用活动来啦~~米尔提供了7块价值849元的MYD-LR3576开发板发起试用活动您不仅可以免
跃昉科技正式加入openGauss社区
日前,跃昉科技签署CLA(Contribution License Agreement,贡献许可协议),正式加入openGauss社区,致力于推动openGauss RISC-V SIG的发展。
【作品合集】龙芯2K0300蜂鸟开发板试用精选
】+4.libmodbus移植【龙芯2K0300蜂鸟板试用】+3.移植lua到loongarch【龙芯2K0300蜂鸟板
发表于 09-10 18:17
点击参与米尔NXP i.MX 93开发板有奖试用
米尔与NXP合作发布的新品基于NXPi.MX93应用处理器的MYD-LMX9X开发板免费试用活动来啦~~米尔提供了3块价值678元的MYD-LMX9X开发板发起试用活动您不仅可以免费体
【英飞凌测评】英飞凌PSoC™ 62开发板试用报告-LCD ILI9341 8080 DEMO
# Infineon Psoc6-evaluationkit-062S2 说明 ## 简介 本文档为 `RT-Thread` 为 `PSoC6 CY8CKIT-062S2-43012` 开发板提供
【昉·星光 2 高性能RISC-V单板计算机试用体验】开箱及装载Debian系统
上周收到了昉·星光 2高性能RISC-V单板计算机开发板,在此非常感谢赛昉科技提供的试用机会。开发板
发表于 01-24 00:32
跃昉动态|跃昉科技与友达数位,数字化时代的强强联手
近日,广东跃昉科技有限公司与友达数位科技服务(苏州)有限公司(AUO Digitech,以下简称“友达数位ADT”)正式达成战略合作伙伴关系,携手迈向数字化转型的新时代。
【涂鸦T2-U开发板试用体验】1、T2-U开发环境搭建及调试
前言
本章介绍T2-U的开发环境搭建流程,以及一些遇到的问题。
一、资料
试用网址:【新品体验】涂鸦 T2-U 开发板免费
发表于 11-25 23:38
评论