系统信息
U-Boot 2015.04-g4df34a6 (Jun 07 2018 - 09:19:48)
CPU: Freescale i.MX6UL rev1.2 at 396 MHz
CPU: Temperature 52 C
Reset cause: POR
Board: MX6UL 14x14 EVK
I2C: ready
DRAM: 256 MiB
NAND: 256 MiB
MMC: FSL_SDHC: 0
*** Warning - bad CRC, using default environment
Display: TFT70AB-800x480 (800x480)
Video: 800x480x24
NAND read: device 0 offset 0x400000, size 0x200000
2097152 bytes read: OK
display bmp cfb_console.c
In: serial
Out: serial
Err: serial
Net: Phy 1 not found
PHY reset timed out
FEC1
Error: FEC1 address not set.
Normal Boot
Hit any key to stop autoboot: 0
硬件方案:FETMX6UL-C核心板+参考OKMX6UL-C3控制单元成品制作的底板,其中板载wifi模块为RTL8723BU,板载核心板为C3成品上已烧录的核心板
参考手册:OKMX6UL-C3控制单元操作指导书-V1.6-2018.11.15
步骤1: 上电模块加载
底板上电,启动linux系统,wifi模块会自动加载,root登录后可使用lsmod指令查看
root@freescale ~$ lsmod
8723bu 1280657 0 - Live 0x7f004000
evbug 1854 0 - Live 0x7f000000
root@freescale ~$
步骤2: 检测wifi网卡状况
root@freescale ~$ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 54:C9:DF:0B:5B:A1
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:24215 errors:0 dropped:2116 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)
root@freescale ~$
步骤3: 设置网卡
root@freescale ~$ ifconfig eth0 down
root@freescale ~$
root@freescale ~$ ifconfig eth1 down
root@freescale ~$
root@freescale ~$ ifconfig wlan0 up
root@freescale ~$
步骤4: 扫描可用的无线网络
root@freescale ~$ iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: EE:08:8D:43:54:96
ESSID:"iphone7"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.437 GHz (Channel 6)
Encryption key:on
Bit Rates:144 Mb/s
Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Quality=43/100 Signal level=65/100
Extra:fm=0003
步骤5: 配置wpa_supplicant.conf
由于wifi使用的是WPA加密方式,需配置/etc/wpa_supplicant.conf(目录下没有该文件则新建一个),文件内容如下:
network={
ssid="iphone7"
#psk="wjl12345678"
psk=5e666c8bc4cd2378ec71fc4073a468721709fbbeb7358a8cc8802f960c4808cc
}
步骤5: 设置ESSID
root@freescale ~$ iwconfig wlan0 essid iphone7
[ 1537.943636] RTL871X: set ssid [iphone7] fw_state=0x00000008
root@freescale ~$
root@freescale ~$ [ 1537.991587] RTL871X: start auth
[ 1537.997118] RTL871X: auth success, start assoc
[ 1538.009150] RTL871X: indicate disassoc
特别注意: 厂家操作指导书中这个指令操作后出现的是assoc success,下图这样
而我的板子操作后是indicate disassoc,厂家技术支持意见:继续往下进行!(这个地方卡了我好久,程序员直觉告诉有报错就一定有问题,暂时先往下走)
步骤6: 连接路由器
root@freescale ~$
root@freescale ~$ wpa_supplicant -Dwext -c/etc/wpa_supplicant.conf -iwlan0 &
root@freescale ~$
root@freescale ~$ rfkill: Cannot open RFKILL contro[ 1910.062165] RTL871X: set bssid:00:00:00:00:00:00
l device
ioctl[SIOCSIWAP]: Operation not permitted
wlan0: Trying to associate with e[ 1911.706046] RTL871X: set ssid [iphone7] fw_state=0x00000008
e:08:8d:43:54:96 (SSID='iphone7' freq=2437 MHz)
[ 1911.715952] RTL871X: set bssid:ee:08:8d:43:54:96
[ 1911.748680] RTL871X: start auth
[ 1911.755043] RTL871X: auth success, start assoc
[ 1911.764066] RTL871X: assoc success
[ 1911.767733] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
wlan0: Associated with ee:08:8d:43:54:96
[ 1911.784567] RTL871X: send eapol packet
[ 1911.798045] RTL871X: send eapol packet
wlan0: WPA: Key negotiation completed with ee:08:8d:43:54:96 [PTK[ 1911.806024] RTL871X: set pairwise key camid:4, addr:ee:08:8d:43:54:96, kid:0, type:AES
=CCMP GTK=CCMP]
wlan0: CTRL-EVENT-CONNECTED - Connection to ee:0[ 1911.820719] RTL871X: set group key camid:5, addr:ee:08:8d:43:54:96, kid:2, type:AES
8:8d:43:54:96 completed (auth) [id=0 id_str=]
步骤7: 自动IP地址分配dhcp
root@freescale ~$ udhcpc -iwlan0
udhcpc (v1.23.1) started
Sending discover...
Sending select for 172.20.10.3...
Lease of 172.20.10.3 obtained, lease time 85536
Deleting routers
adding dns 172.20.10.1
步骤8: 联网测试
root@freescale ~$ ping www.baidu.com
PING www.baidu.com (14.215.177.39): 56 data bytes
64 bytes from 14.215.177.39: seq=0 ttl=53 time=61.762 ms
64 bytes from 14.215.177.39: seq=1 ttl=53 time=58.229 ms
64 bytes from 14.215.177.39: seq=2 ttl=53 time=57.622 ms
64 bytes from 14.215.177.39: seq=3 ttl=53 time=92.595 ms
以上为后知后觉调试全过程,在参考厂家文档过程中由于出现indicate disassoc这个问题,导致功能测试停滞不前,一直努力在网上查找相关解决方法,一度怀疑硬件是否有问题。最终实现顺利连接wifi,但中途为何出现indicate disassoc这个问题一直没搞懂!