Phytec中国的wiki
support@phytec.cn
热线:0755-61802110-803
wifi模块硬件接法
wifi模块接开发板的X27
开发板上其他硬件设置: R19 需要接一个0欧电阻,
JP4--2+3, JP3--打开, JP7--1+2, JP8–1+2
硬件详细说明可参考开发板硬件手册L-830e_3中的17.4.16 Wi-Fi/Bluetooth Connector(X27)章节说明.
软件设置
ftp://ftp.phytec.cn/AM335x/BSP-Yocto-AM335x-PD19.1.1/machines.txt
从machines列表中,开发板带wifi软件设置的MACHINE为phycore-am335x-7,
使用wifi模块时,开发板需要选择这个machine的镜像.
kernel log
[ 8.064802] bus: 'sdio': add driver wl1271_sdio [ 8.064844] bus: 'sdio': driver_probe_device: matched device mmc1:0001:1 with driver wl1271_sdio [ 8.238271] bus: 'sdio': really_probe: probing driver wl1271_sdio with device mmc1:0001:1 [ 8.238329] wl1271_sdio mmc1:0001:1: no default pinctrl state [ 8.238497] wl1271_sdio: probe of mmc1:0001:1 rejects match -19 [ 8.238533] bus: 'sdio': driver_probe_device: matched device mmc1:0001:2 with driver wl1271_sdio [ 8.238543] bus: 'sdio': really_probe: probing driver wl1271_sdio with device mmc1:0001:2 [ 8.238567] wl1271_sdio mmc1:0001:2: no pinctrl handle [ 8.238923] Registering platform device 'wl12xx.0.auto'. Parent at mmc1:0001:2 [ 8.238935] device: 'wl12xx.0.auto': device_add [ 8.238954] bus: 'platform': add device wl12xx.0.auto [ 8.239024] PM: Adding info for platform:wl12xx.0.auto [ 8.239252] driver: 'wl1271_sdio': driver_bound: bound to device 'mmc1:0001:2' [ 8.239325] bus: 'sdio': really_probe: bound device mmc1:0001:2 to driver wl1271_sdio [ 10.158451] bus: 'platform': add driver wl12xx_driver [ 10.158734] bus: 'platform': driver_probe_device: matched device wl12xx.0.auto with driver wl12xx_driver [ 10.326144] bus: 'platform': really_probe: probing driver wl12xx_driver with device wl12xx.0.auto [ 10.326205] wl12xx_driver wl12xx.0.auto: no default pinctrl state [ 10.343829] driver: 'wl12xx_driver': driver_bound: bound to device 'wl12xx.0.auto' [ 10.343959] bus: 'platform': really_probe: bound device wl12xx.0.auto to driver wl12xx_driver [ 10.344651] firmware_class: __allocate_fw_buf: fw-ti-connectivity/wl127x-nvs.bin buf=db828d00 [ 10.351064] wl12xx_driver wl12xx.0.auto: loading /lib/firmware/updates/4.14.78-bsp-yocto-am335x-pd19.1.0/ti-connectivity/wl127x-nvs.bin failed with error -2 [ 10.351107] wl12xx_driver wl12xx.0.auto: loading /lib/firmware/updates/ti-connectivity/wl127x-nvs.bin failed with error -2 [ 10.351160] wl12xx_driver wl12xx.0.auto: loading /lib/firmware/4.14.78-bsp-yocto-am335x-pd19.1.0/ti-connectivity/wl127x-nvs.bin failed with error -2 [ 10.356460] wl12xx_driver wl12xx.0.auto: direct-loading ti-connectivity/wl127x-nvs.bin [ 10.356504] firmware_class: fw_set_page_data: fw-ti-connectivity/wl127x-nvs.bin buf=db828d00 data=e13e2000 size=912 [ 10.797493] wlcore: WARNING Detected unconfigured mac address in nvs, derive from fuse instead. [ 10.810439] wlcore: WARNING Your device performance is not optimized. [ 10.818734] wlcore: WARNING Please use the calibrator tool to configure your device. [ 10.828387] wlcore: WARNING Fuse mac address is zero. using random mac [ 10.885833] device: 'wlan0': device_add [ 10.886055] PM: Adding info for No Bus:wlan0 [ 10.900499] wlcore: loaded [ 10.914161] firmware_class: __fw_free_buf: fw-ti-connectivity/wl127x-nvs.bin buf=db828d00 data=e13e2000 size=912 [ 11.433825] firmware_class: __allocate_fw_buf: fw-ti-connectivity/wl127x-fw-5-sr.bin buf=dd547e80 [ 11.433906] wl12xx_driver wl12xx.0.auto: loading /lib/firmware/updates/4.14.78-bsp-yocto-am335x-pd19.1.0/ti-connectivity/wl127x-fw-5-sr.bin failed with error -2 [ 11.433924] wl12xx_driver wl12xx.0.auto: loading /lib/firmware/updates/ti-connectivity/wl127x-fw-5-sr.bin failed with error -2 [ 11.433943] wl12xx_driver wl12xx.0.auto: loading /lib/firmware/4.14.78-bsp-yocto-am335x-pd19.1.0/ti-connectivity/wl127x-fw-5-sr.bin failed with error -2 [ 11.452341] wl12xx_driver wl12xx.0.auto: direct-loading ti-connectivity/wl127x-fw-5-sr.bin [ 11.452393] firmware_class: fw_set_page_data: fw-ti-connectivity/wl127x-fw-5-sr.bin buf=dd547e80 data=e148a000 size=364044 [ 11.453900] firmware_class: __fw_free_buf: fw-ti-connectivity/wl127x-fw-5-sr.bin buf=dd547e80 data=e148a000 size=364044 [ 11.587648] wlcore: firmware booted (Rev 6.3.10.0.142) [ 11.607942] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
linux配置wlan网络
使用ip link能找到wifi接口信息
root@phycore-am335x-7:~# ip link 5: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 link/ether 08:00:28:95:1b:fe brd ff:ff:ff:ff:ff:ff
扫描wifi网络
root@phycore-am335x-7:~# iw wlan0 scan | grep SSID
在/etc/wpa_supplicant.conf文件中配置wifi网络信息
country=CN network={ ssid="<SSID>" proto=WPA2 psk="<KEY>" }
配置好wifi信息后, 可用以下命令连接到wifi网络
root@phycore-am335x-7:~# wpa_supplicant -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 &
linux 开机自启动wlan服务
进入linux能查到以下wifi接口信息
root@phycore-am335x-7:~# ifconfig wlan0 Link encap:Ethernet HWaddr 08:00:28:95:1B:FE inet6 addr: fe80::a00:28ff:fe95:1bfe/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:40 errors:0 dropped:0 overruns:0 frame:0 TX packets:45 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:5870 (5.7 KiB) TX bytes:5777 (5.6 KiB)
wifi接口为wlan0, 新建wlan配置文件wpa_supplicant-wlan0.conf, 存放在/etc/wpa_supplicant目录下
root@phycore-am335x-7:~# mkdir /etc/wpa_supplicant root@phycore-am335x-7:~# cd /etc/wpa_supplicant root@phycore-am335x-7:/etc/wpa_supplicant# vi wpa_supplicant-wlan0.conf
配置文件内容如下:
country=CN network={ ssid="<SSID>" proto=WPA2 psk="<KEY>" }
配置wlan0接口动态IP使能:/lib/systemd/network/20-wlan0.network
/lib/systemd/network/20-wlan0.network
[Match] Name=wlan0 [Network] DHCP=yes
开启wlan连接:
root@phycore-am335x-7:~# systemctl enable wpa_supplicant@wlan0.service Created symlink from /etc/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service to /lib/systemd/system/wpa_supplicant@.service. root@phycore-am335x-7:~# systemctl start wpa_supplicant@wlan0.service
在wifi连接设置成系统服务后, 当wifi信号断开后可以自动重新连接.
Overview
Content Tools
Tasks