参考https://bl-mcu-sdk.readthedocs.i ... ifi6/wifi_http.html
1.获取SDK
https://github.com/Ai-Thinker-Open/aithinker_dev_open_sdk.git
git bash打开目录,执行
- mkdir sdk
- cd sdk
- git init
- git remote add origin https://github.com/Ai-Thinker-Open/aithinker_dev_open_sdk.git
- git config core.sparsecheckout true
- echo "os/bl618_sdk_lts" >> .git/info/sparse-checkout
- cat .git/info/sparse-checkout
- git pull origin master
- git status
复制代码 只需要获取bl618的sdk,其他文件可以不拉取
2.修改代码
vs code打开目录sdk\os\bl618_sdk_lts\sdk\bouffalo_sdk,修改文件components\wireless\wifi6\bl6_fhost\src\application\wifi_mgmr_cli.c
- uint16_t len = info->length, i = 0;
- uint8_t *payload = info->payload;
- printf("%04d ", len);
- while(i < len) printf("%02x", payload[i++]);
- printf("\r\n");
复制代码 保存,进入目录examples\wifi\sta\wifi_http,编译并烧录
3.开启sniffer
vs code安装Serial Monitor插件
修改插件设置,设置2M波特率,和换行符
- "vscode-serial-monitor.customBaudRates": [2000000],
- "vscode-serial-monitor.lineEnding": "\n",
复制代码 打开串行监视器,开始监视,输入help回车,查看支持的命令
输入wifi_state查看接口vif_name,后面会用到,这里是wl1
输入wifi_scan,扫描附近的WiFi
输入wifi_sniffer_on -i wl1 -f 2412
-i选项指定vif_name,-f选项指定频率
2412为信道1的中心频率,参考https://zhuanlan.zhihu.com/p/480226290
可以看到捕获的数据
输入wifi_sniffer_off -i wl1,关闭sniffer
|