问题
本周用到树莓派Zero W来搭建一个原形项目,使用网上常见的USB-A直插扩展板,以方便插入电脑的USB口中。但是实际发现插入到USB3.0扩展坞上后,WIFI可以连接,但无法获取IP地址。这该如何解决?
排查
先从网上搜索看起吧。搜了下,都是有头没尾的帖子,最后大多数都没有解决。没办法,只能自己尝试解决了。
为了能够正常连接到树莓派,这里预先把串口连好。
可能的DHCP服务配置问题
我的DHCP服务器在OpenWRT上,会不会是DHCP的过程有什么异常?我在DHCP的链路上抓包,确实没有发现完整的DHCP请求和响应。因此还没到这个环节就出问题了。
实际看了下,网卡的TX和RX的包数似乎都不太多。会不会是无线物理层收发遇到问题了?看了一眼dmesg,果然各种报错
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
[ 56.793999] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready [ 78.970838] ICMPv6: process `dhcpcd' is using deprecated sysctl (syscall) net.ipv6.neigh.wlan0.retrans_time - use net.ipv6.neigh.wlan0.retrans_time_ms instead [ 86.646924] ieee80211 phy0: _brcmf_set_multicast_list: Setting mcast_list failed, -110 [ 89.206956] ieee80211 phy0: _brcmf_set_multicast_list: Setting allmulti failed, -110 [ 91.766946] ieee80211 phy0: _brcmf_set_multicast_list: Setting BRCMF_C_SET_PROMISC failed, err=-110 [ 99.446942] ieee80211 phy0: _brcmf_set_multicast_list: Setting mcast_list failed, -110 [ 102.010280] ieee80211 phy0: _brcmf_set_multicast_list: Setting allmulti failed, -110 [ 104.566928] ieee80211 phy0: _brcmf_set_multicast_list: Setting BRCMF_C_SET_PROMISC failed, err=-110 [ 123.366921] ieee80211 phy0: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 123.366987] ieee80211 phy0: brcmf_cfg80211_get_channel: chanspec failed (-110) [ 263.766922] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-110) [ 266.327309] ieee80211 phy0: brcmf_set_pmk: failed to change PSK in firmware (len=0) [ 268.886938] ieee80211 phy0: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 268.887002] ieee80211 phy0: brcmf_cfg80211_reg_notifier: Country code iovar returned err = -110 [ 271.446933] ieee80211 phy0: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 271.446998] ieee80211 phy0: brcmf_cfg80211_reg_notifier: Country code iovar returned err = -110 [ 274.006951] ieee80211 phy0: brcmf_run_escan: error (-110) [ 274.007014] ieee80211 phy0: brcmf_cfg80211_scan: scan error (-110) [ 276.566935] ieee80211 phy0: _brcmf_set_multicast_list: Setting mcast_list failed, -110 [ 279.126952] ieee80211 phy0: _brcmf_set_multicast_list: Setting allmulti failed, -110 [ 286.806948] ieee80211 phy0: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 286.807029] ieee80211 phy0: brcmf_cfg80211_get_tx_power: error (-110) [ 289.366927] ieee80211 phy0: brcmf_proto_bcdc_query_dcmd: brcmf_proto_bcdc_msg failed w/status -110 [ 291.926957] ieee80211 phy0: _brcmf_set_multicast_list: Setting BRCMF_C_SET_PROMISC failed, err=-110 [ 297.046950] ieee80211 phy0: brcmf_run_escan: error (-110) [ 297.047012] ieee80211 phy0: brcmf_cfg80211_scan: scan error (-110) [ 302.166937] ieee80211 phy0: _brcmf_set_multicast_list: Setting mcast_list failed, -110 [ 304.726991] ieee80211 phy0: brcmf_run_escan: error (-110) [ 304.727054] ieee80211 phy0: brcmf_cfg80211_scan: scan error (-110) [ 307.286935] ieee80211 phy0: _brcmf_set_multicast_list: Setting allmulti failed, -110 [ 309.846951] ieee80211 phy0: _brcmf_set_multicast_list: Setting BRCMF_C_SET_PROMISC failed, err=-110 |
因此接下来的方向要看物理层出问题有哪些可能了。
可能的蓝牙干扰
想起之前用树莓派的时候,蓝牙也不是特别好用。要不先试试把蓝牙禁用了? 搜索了一下有个在dtoverlay里禁用蓝牙的命令,验证过后发现无效。
可能的无线AP的问题
我的无线AP开了802.11k, 802.11v, 802.11r,会不会树莓派对这些的支持不好?搜了一下之前确实是有类似的记录。于是我就将树莓派接入到另外一个AP上进行对比验证,发现问题并没有任何改善。
USB3.0导致的干扰问题
正当被困扰了几个小时没有进展之际,我突然想到之前听到的2.4G被USB3.0干扰的现象。会不会是这种可能的?
我将树莓派的直插USB3.0扩展坞改成了通过延长线插入,将树莓派远离扩展坞10cm左右,重启树莓派,发现正常获取到IP地址了,iperf3测速30mbps+。
后记
实际树莓派Zero W在我使用的飞利浦7口USB3.0扩展坞上的干扰范围有多大呢? 我实测了下,扩展坞不同方向的距离是不同的。似乎在两侧要10cm以上才可以避免被明显干扰,在上下和前后不需要这么多。而且干扰也是有程度的,比如距离3~4cm时表现为测速下降到1mbps左右,再近就直接丢包报错。可能这与树莓派Zero W的WLAN天线与发射功率都有关。
2.4G USB Dongle无线应用似乎要考虑的东西比我们多。除去空间内其他同频WIFI信源的干扰外,USB3.0这种也是不能忽略的。