焊接
换个粗点的风枪嘴,让热风覆盖 RTL8823BS 整体模块,最终实现自动归位
焊接 SDIO 接口的上拉电阻以及复位引脚上拉电阻
硬件部分就这么多比较简单,接下来是软件部分
打开内核编译选项
搜索 RTL8723BS
RTL8723BS 默认关闭,不过要使能该驱动之前,需要先使能 WLAN
和 CFG80211
搜索 WLAN
使能 WLAN
搜索 CFG80211
已经被打开了,应该是使能 WLAN 时,将其联动打开了
使能 RTL8723BS
发现只能选择为 [M] 无法选择成 [*],有了解的小伙伴可以告知下原因。我的猜测是,WiFi 接口 up 时需要将 fw 文件加载到 WiFi Chip,如果将驱动编译成内核静态模块的话,驱动初始化在文件系统挂载前,那时候还无法从文件系统中读取 fw 文件,所以索性就只让该驱动编译成动态模块,等操作系统启动完毕后由应用层手动加载,这时候就可以方便地从文件目录中读取 fw 文件发送给 WiFi Chip 了。
重新编译内核
make O=DIY_V3S/ linux-rebuild
make O=DIY_V3S/
cp DIY_V3S/images/sdcard.img ~/share/
sync
烧录 && 运行 && 测试
SD 卡烧录 sdcard.img 镜像
上电启动
安装驱动
# insmod /lib/modules/5.3.5/kernel/drivers/staging/rtl8723bs/r8723bs.ko
[ 60.289175] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
[ 60.320409] RTL8723BS: module init start
[ 60.326135] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
[ 60.335108] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
[ 60.386496] pnetdev = de099689
[ 60.448836] RTL8723BS: rtw_ndev_init(wlan0)
[ 60.456286] RTL8723BS: module init ret =0
#
驱动安装后,就会产生 wlan0 接口,但是没有 up,需要手动将其 up
# ifconfig wlan0 up
[ 167.848205] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
#
初次 up 时,会加载 firmware 到 WiFi Chip,fw 文件存放在 /lib/firmware/rtlwifi/
# ls /lib/firmware/rtlwifi/
rtl8712u.bin rtl8723bs_ap_wowlan.bin rtl8723bu_nic.bin
rtl8723aufw_A.bin rtl8723bs_bt.bin rtl8723bu_wowlan.bin
rtl8723aufw_B.bin rtl8723bs_nic.bin rtl8723fw.bin
rtl8723aufw_B_NoBT.bin rtl8723bs_wowlan.bin rtl8723fw_B.bin
rtl8723befw.bin rtl8723bu_ap_wowlan.bin
查看接口
# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 34:C3:D2:BD:F8:81
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
#
发现已经 up 了,接下来就让它连接家里 WiFi,
配置 wpa_supplicant.conf
# cat /etc/wpa_supplicant.conf
ap_scan=1
network={
ssid="your SSID"
scan_ssid=1
key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
pairwise=TKIP CCMP
psk="your SSID password"
priority=5
}
#
连接
# wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
# [ 1060.759388] RTL8723BS: rtw_set_802_11_connect(wlan0) fw_state = 0x00000008
[ 1061.055922] RTL8723BS: start auth
[ 1061.366001] RTL8723BS: auth success, start assoc
[ 1061.378898] RTL8723BS: rtw_cfg80211_indicate_connect(wlan0) BSS not found !!
[ 1061.387965] RTL8723BS: assoc success
[ 1061.398201] RTL8723BS: send eapol packet
[ 1061.428154] RTL8723BS: send eapol packet
[ 1061.442062] RTL8723BS: set pairwise key camid:4, addr:80:ea:07:c9:d6:4a, kid:0, type:AES
[ 1061.476357] RTL8723BS: set group key camid:5, addr:80:ea:07:c9:d6:4a, kid:1, type:AES
# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 34:C3:D2:BD:F8:81
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:62 errors:0 dropped:70 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14450 (14.1 KiB) TX bytes:288 (288.0 B)
#
连接成功,不过没有分配 IP 地址,手动触发 DHCP 获取 IP
# udhcpc -i wlan0
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting select for 192.168.31.29, server 192.168.31.1
udhcpc: lease of 192.168.31.29 obtained from 192.168.31.1, lease time 43200
deleting routers
adding dns 192.168.31.1
#
ping 外网测试
# ping baidu.com
PING baidu.com (39.156.66.10): 56 data bytes
64 bytes from 39.156.66.10: seq=0 ttl=49 time=76.509 ms
64 bytes from 39.156.66.10: seq=1 ttl=49 time=37.077 ms
64 bytes from 39.156.66.10: seq=2 ttl=49 time=41.511 ms
64 bytes from 39.156.66.10: seq=3 ttl=49 time=45.283 ms
64 bytes from 39.156.66.10: seq=4 ttl=49 time=37.318 ms
64 bytes from 39.156.66.10: seq=5 ttl=49 time=39.462 ms
^C
--- baidu.com ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 37.077/46.193/76.509 ms
#
网络已通
完善脚本
列举上述操作
- 安装驱动
- up interface
- 使用 wpa_supplicant 连接
- 执行 dhcp 获取 IP
如果板子每次重启后都需要手动执行上述操作,那就太麻烦了,遂将上述操作添加到启动脚本中
# cat /etc/inittab
# /etc/inittab
。。。
# now run any rc scripts
::sysinit:/etc/init.d/rcS
::sysinit:/etc/init.d/rc.local // 添加这行
。。。
#
创建 rc.local 文件,并赋予可执行权限
# cat /etc/init.d/rc.local
#!/bin/sh
/etc/init.d/wifi_insmod_connect.sh
#
创建 wifi_insmod_connect.sh 文件,并赋予可执行权限
# cat /etc/init.d/wifi_insmod_connect.sh
#!/bin/sh
insmod /lib/modules/5.3.5/kernel/drivers/staging/rtl8723bs/r8723bs.ko
ifconfig wlan0 up
wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
sleep 3s
udhcpc -i wlan0
#
重启
[ 1.826283] Run /sbin/init as init process
[ 1.977033] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 2.471812] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
[ 2.523731] RTL8723BS: module init start
[ 2.529315] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
[ 2.538281] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
[ 2.568836] pnetdev = 24ff44ca
[ 2.631249] RTL8723BS: rtw_ndev_init(wlan0)
[ 2.638718] RTL8723BS: module init ret =0
[ 2.676561] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
[ 5.959413] RTL8723BS: rtw_set_802_11_connect(wlan0) fw_state = 0x00000008
[ 6.247413] RTL8723BS: start auth
[ 6.254599] RTL8723BS: auth success, start assoc
[ 6.266249] RTL8723BS: rtw_cfg80211_indicate_connect(wlan0) BSS not found !!
[ 6.275381] RTL8723BS: assoc success
[ 6.285938] RTL8723BS: send eapol packet
[ 6.311315] RTL8723BS: send eapol packet
[ 6.325445] RTL8723BS: set pairwise key camid:4, addr:80:ea:07:c9:d6:4a, kid:0, type:AES
[ 6.358530] RTL8723BS: set group key camid:5, addr:80:ea:07:c9:d6:4a, kid:1, type:AES
Welcome to Buildroot for the LicheePi Zero
licheepi-zero login: [ 31.843505] vcc5v0: disabling
Welcome to Buildroot for the LicheePi Zero
licheepi-zero login: root
# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 34:C3:D2:BD:F8:81
inet addr:192.168.31.29 Bcast:192.168.31.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:107 errors:0 dropped:119 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20760 (20.2 KiB) TX bytes:1098 (1.0 KiB)
# ping baidu.com
PING baidu.com (39.156.66.10): 56 data bytes
64 bytes from 39.156.66.10: seq=0 ttl=49 time=61.308 ms
64 bytes from 39.156.66.10: seq=1 ttl=49 time=44.674 ms
64 bytes from 39.156.66.10: seq=2 ttl=49 time=73.668 ms
64 bytes from 39.156.66.10: seq=3 ttl=49 time=40.631 ms
^C
--- baidu.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 40.631/55.070/73.668 ms
#
可以看到,板子启动后,WiFi 已工作,网络已通。
测速
编译 iperf 测试一下网速
# iperf3 -s
warning: this system does not seem to support IPv6 - trying IPv4
-----------------------------------------------------------
Server listening on 5201 (test #1)
-----------------------------------------------------------
Accepted connection from 192.168.31.211, port 2642
[ 5] local 192.168.31.29 port 5201 connected to 192.168.31.211 port 2643
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 88.4 KBytes 724 Kbits/sec
[ 5] 1.00-2.00 sec 82.7 KBytes 677 Kbits/sec
[ 5] 2.00-3.00 sec 168 KBytes 1.38 Mbits/sec
[ 5] 3.00-4.00 sec 111 KBytes 911 Kbits/sec
[ 5] 4.00-5.00 sec 111 KBytes 911 Kbits/sec
[ 5] 5.00-6.00 sec 79.8 KBytes 654 Kbits/sec
[ 5] 6.00-7.00 sec 92.7 KBytes 759 Kbits/sec
[ 5] 7.00-8.00 sec 89.8 KBytes 736 Kbits/sec
[ 5] 8.00-9.00 sec 82.7 KBytes 677 Kbits/sec
[ 5] 9.00-10.00 sec 37.1 KBytes 304 Kbits/sec
[ 5] 10.00-11.00 sec 104 KBytes 855 Kbits/sec
[ 5] 11.00-11.41 sec 58.5 KBytes 1.16 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-11.41 sec 1.08 MBytes 794 Kbits/sec receiver
-----------------------------------------------------------
Server listening on 5201 (test #2)
-----------------------------------------------------------
只有 1Mbps 。。。
哦,对了,没接天线,应该是信号不好,看下信号强度,
但是板子中并没有 wpa_cli 命令,交叉编译了一个,
又提示 CONFIG_CTRL_IFACE not defined - wpa_cli disabled
,
而 wpa_supplicant.conf 中添加 ctrl_interface=/var/run/wpa_supplicant 后 wpa_supplicant 又运行不起来。。。
索性不用系统自带的 wpa_supplicant 了(应该是有点问题)。
按照之前写的一篇文章《hostapd、wpa_supplicant 交叉编译》,重新编译 wpa_supplicant
,并在 wpa_supplicant.conf 中添加
ctrl_interface=/var/run/wpa_supplicant
系统重启后查看 RSSI
# wpa_cli -i wlan0 signal_poll
RSSI=-65
LINKSPEED=150
NOISE=9999
FREQUENCY=2437
RSSI=-65
确实是信号太弱了,
买的 IPEX 座子还没到,怎么办呢?
手搓天线
那就先手撸一根天线焊上试试吧
# wpa_cli -i wlan0 signal_poll
RSSI=-45
LINKSPEED=150
NOISE=9999
FREQUENCY=2437
哇,RSSI 直接增强到 -45,NB
测一下速
# iperf3 -s
warning: this system does not seem to support IPv6 - trying IPv4
-----------------------------------------------------------
Server listening on 5201 (test #1)
-----------------------------------------------------------
Accepted connection from 192.168.31.211, port 14988
[ 5] local 192.168.31.29 port 5201 connected to 192.168.31.211 port 14989
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 6.10 MBytes 51.1 Mbits/sec
[ 5] 1.00-2.00 sec 5.56 MBytes 46.7 Mbits/sec
[ 5] 2.00-3.00 sec 6.44 MBytes 54.0 Mbits/sec
[ 5] 3.00-4.00 sec 6.33 MBytes 53.1 Mbits/sec
[ 5] 4.00-5.00 sec 6.28 MBytes 52.7 Mbits/sec
[ 5] 5.00-6.00 sec 6.05 MBytes 50.7 Mbits/sec
[ 5] 6.00-7.00 sec 4.56 MBytes 38.2 Mbits/sec
[ 5] 7.00-8.00 sec 7.06 MBytes 59.3 Mbits/sec
[ 5] 8.00-9.00 sec 6.34 MBytes 53.2 Mbits/sec
[ 5] 9.00-10.00 sec 6.53 MBytes 54.7 Mbits/sec
[ 5] 10.00-10.89 sec 5.87 MBytes 55.7 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.89 sec 67.1 MBytes 51.7 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201 (test #2)
-----------------------------------------------------------
51Mbps,鼓掌👏👏👏
正式天线
等了两天,IPEX 座子到了,焊接,插天线
查看信号强度
# wpa_cli -i wlan0 signal_poll
RSSI=-45
LINKSPEED=150
NOISE=9999
FREQUENCY=2437
和我手搓的天线一样啊,也没高多少,抑或是软件最强只能显示 -45 ???
再测下速
# iperf3 -s
warning: this system does not seem to support IPv6 - trying IPv4
-----------------------------------------------------------
Server listening on 5201 (test #1)
-----------------------------------------------------------
Accepted connection from 192.168.31.211, port 1148
[ 5] local 192.168.31.29 port 5201 connected to 192.168.31.211 port 1149
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 5.35 MBytes 44.9 Mbits/sec
[ 5] 1.00-2.00 sec 6.11 MBytes 51.3 Mbits/sec
[ 5] 2.00-3.00 sec 6.46 MBytes 54.2 Mbits/sec
[ 5] 3.00-4.00 sec 6.38 MBytes 53.5 Mbits/sec
[ 5] 4.00-5.00 sec 5.64 MBytes 47.4 Mbits/sec
[ 5] 5.00-6.00 sec 5.86 MBytes 49.2 Mbits/sec
[ 5] 6.00-7.00 sec 6.26 MBytes 52.4 Mbits/sec
[ 5] 7.00-8.00 sec 5.18 MBytes 43.5 Mbits/sec
[ 5] 8.00-9.00 sec 5.96 MBytes 50.0 Mbits/sec
[ 5] 9.00-10.00 sec 5.97 MBytes 50.1 Mbits/sec
[ 5] 10.00-10.86 sec 5.70 MBytes 56.0 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.86 sec 64.9 MBytes 50.1 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201 (test #2)
-----------------------------------------------------------
也是 50Mbps 左右嘛。。。说明我手搓的天线性能还是挺好的。文章来源:https://www.toymoban.com/news/detail-727632.html
至此,WiFi 调试 OK文章来源地址https://www.toymoban.com/news/detail-727632.html
到了这里,关于ARM Linux DIY(四)WiFi 调试的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!