原创 基于飞凌NXP i.MX6ULL的无线网络测试

2022-5-5 16:53 906 4 4 分类: MCU/ 嵌入式

一、iMX6ULL开发板 WIFI 功能测试


WiFi支持:

模块

支持

RTL8188EUS

WiFi

RTL8723BU

WiFi

RTL8723DU

WiFi


1、 USB WIFI RTL8188eus使用

说明: USB  WIFI无线局域网卡是选配模块 ,如若有需求,请联系飞凌嵌入式官网在线客服。

以下对wifi模块在STA模式下,连接到无线网络的测试:

步骤1:iMX6ULL开发板上电,启动Linux系统。

步骤2:连接USB WIFI到飞凌iMX6ULL开发板的USB Host接口

步骤 3 按照如下格式输入相应的参数:  

-i表示wifi型号;

-s表示wifi热点名称;

-p表示密码,若无密码输入-p NONE;

路由器采用wpa加密方式。具体操作指令可查看wifi.sh脚本。

连接打印内容如下:

root@fl-imx6ull:~# fltest_cmd_wifi.sh -i 8188 -s forlinx -p xxxx

打印信息如下:

wifi 8188

ssid forlinx

pasw xxxx

usbcore: deregistering interface driver rtl8723bu

RTL871X: module exit start

usbcore: deregistering interface driver rtl8188eu

RTL871X: rtw_ndev_uninit(wlan1)

usb 1-1.3: reset high-speed USB device number 7 using ci_hdrc

RTL871X: module exit success

RTL871X: module init start

RTL871X: rtl8188eu v4.3.0.9_15178.20150907

RTL871X: build time: Mar 25 2020 02:23:46

bFWReady == _FALSE call reset 8051...

RTL871X: rtw_ndev_init(wlan0)

usbcore: registered new interface driver rtl8188eu

RTL871X: module init ret=0

==> rtl8188e_iol_efuse_patch

IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

ps: invalid option -- 'f'

BusyBox v1.24.1 (2019-04-27 02:24:01 CST) multi-call binary.

 

Usage: ps

Successfully initialized wpa_supplicant

rfkill: Cannot open RFKILL controRTL871X: set bssid:00:00:00:00:00:00

l device

RTL871X: set ssid [g▒isQ▒J▒)ͺ▒▒▒▒F|▒T▒▒vZ.c3▒ɚ���<▒▒▒▒] fw_state=0x00000008

ioctl[SIOCSIWAP]: Operation not permitted

ioctl[SIOCGIWSCAN]: Resource temporarily unavailable

ioctl[SIOCGIWSCAN]: Resource temporarily unavailable

RTL871X: indicate disassoc

wlan0: Trying to associate with 04:d7:a5:84:fa:40 (SSID='forlinx' freq=2437 MHz)

RTL871X: set ssid [forlinx] fw_state=0x00000008

RTL871X: set bssid:04:d7:a5:84:fa:40

RTL871X: start auth

RTL871X: auth success, start assoc

RTL871X: assoc success

IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

RTL871X: recv eapol packet

wlan0: Associated with 04:d7:a5:84:fa:40

RTL871X: send eapol packet

RsvdPageNum: 8

udhcpc (v1.24.1) started

RTL871X: recv eapol packet

RTL871X: send eapol packet

RTL871X: recv eapol packet

RTL871X: send eapol packet

RTL871X: set pairwise key camid:4, addr:04:d7:a5:84:fa:40, kid:0, type:AES

wlan0: WPA: Key negotiation completed with 04:d7:a5:84:fa:40 [PTKRTL871X: set group key camid:5, addr:04:d7:a5:84:fa:40, kid:2, type:AES

=CCMP GTK=CCMP]

wlan0: CTRL-EVENT-CONNECTED - Connection to 04:d7:a5:84:fa:40 completed [id=0 id_str=]

Sending discover...

Sending select for 192.168.4.129...

Lease of 192.168.4.129 obtained, lease time 36000

/etc/udhcpc.d/50default: Adding DNS 222.222.202.202

/etc/udhcpc.d/50default: Adding DNS 222.222.222.222

Finshed!

脚本运行完,能自动分配ip并添加DNS,则wifi连接成功。

步骤5:ping ip或者域名,命令如下。

root@fl-imx6ull:~# ping -c 4 www.baidu.com

PING www.baidu.com (220.181.38.149): 56 data bytes

64 bytes from 220.181.38.149: seq=0 ttl=51 time=26.648 ms

64 bytes from 220.181.38.149: seq=1 ttl=51 time=13.529 ms

64 bytes from 220.181.38.149: seq=2 ttl=51 time=15.656 ms

64 bytes from 220.181.38.149: seq=3 ttl=51 time=26.249 ms

 

--- www.baidu.com ping statistics ---

4 packets transmitted, 4 packets received, 0% packet loss

round-trip min/avg/max = 13.529/20.520/26.648 ms

步骤6:卸载已经加入内核的模块。

root@fl-imx6ull:~# rmmod 8188eu

打印信息如下:

RTL871X: module exit start

usbcore: deregistering interface driver rtl8188eu

RTL871X: indicate disassoc

RTL871X: rtw_cmd_thread: DriverStopped(1) SurpriseRemoved(0) break at line 478

wlan0: CTRL-EVENT-DISCONNECTED bssid=04:d7:a5:84:fa:40 reason=3 locally_generated=1

RTL871X: rtw_ndev_uninit(wlan0)

RTL871X: rtw_dev_unload: driver not in IPS

usb 1-1.3: reset high-speed USB device number 7 using ci_hdrc

RTL871X: module exit success


2、 板载WIFI的使用

说明:

l  wifi频率为2.4G

l  兼容8723bu和8723du两种wifi驱动

l  默认路由器采用wpa加密方式。

如果开发板有板载的WIFI无线局域网卡,则焊接在评估板如图所示位置(下图为8723du):

 

步骤1:检查iMX6ULL开发板是否已经焊接该模块,正确焊接如上图。连接上天线。

步骤2:iMX6ULL开发板上电,启动Linux系统,先使用lsmod查看模块加载状态:

root@fl-imx6ull:~# lsmod

Module                  Size  Used by

mx6s_capture           14876  0

8723 du                1313893  0             //默认wifi自动加载,8723du已加载成功

ov9650_camera          12446  0

 

注意:若 飞凌iMX6ULL 开发板上焊接的是8723 b u,使用lsmod会显示8723 b u

以下以8723du为例进行测试描述:

步骤3:测试

Ø  STA模式

该模式即作为一个站点,连接到无线网络中,操作方法如下:

-i表示wifi型号;-s表示wifi热点名称;-p表示密码,若无密码输入-p NONE;路由器采用wpa加密方式,具体操作指令可查看wifi.sh脚本

root@fl-imx6ull:~# fltest_cmd_wifi.sh -i 8723du -s forlinx -p xxx        //执行测试脚本

打印信息如下:

wifi 8723du

ssid forlinx

pasw xxx

usbcore: deregistering interface driver rtl8723du

usbcore: registered new interface driver rtl8723du

IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

Successfully initialized wpa_supplicant

rfkill: Cannot open RFKILL control device

udhcpc (v1.24.1) started

Sending discover...

wlan0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT type=UNKNOWN

wlan0: Trying to associate with 04:d7:a5:f9:26:1d (SSID='forlinx' freq=2427 MHz)

wlan0: Associated with 04:d7:a5:f9:26:1d

IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

wlan0: WPA: Key negotiation completed with 04:d7:a5:f9:26:1d [PTK=CCMP GTK=TKIP]

wlan0: CTRL-EVENT-CONNECTED - Connection to 04:d7:a5:f9:26:1d completed [id=0 id_str=]

nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.

Sending discover...

Sending select for 192.168.5.186...

Lease of 192.168.5.186 obtained, lease time 1800

/etc/udhcpc.d/50default: Adding DNS 222.222.202.202

/etc/udhcpc.d/50default: Adding DNS 222.222.222.222

WLAN Finshed!

脚本运行完,能自动分配ip并生成DNS,则wifi连接成功。

ping ip或者域名,命令如下:

root@fl-imx6ull:~# ping -c 5 www.baidu.com

打印信息如下:

PING 192.168.4.1 (192.168.4.1): 56 data bytes

64 bytes from 192.168.4.1: seq=0 ttl=128 time=39.783 ms

64 bytes from 192.168.4.1: seq=1 ttl=128 time=81.529 ms

64 bytes from 192.168.4.1: seq=2 ttl=128 time=15.236 ms

64 bytes from 192.168.4.1: seq=3 ttl=128 time=12.076 ms

64 bytes from 192.168.4.1: seq=4 ttl=128 time=16.300 ms

 

--- 192.168.4.1 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max = 12.076/32.984/81.529 ms

wifi信号

查看WiFi信号方法如下:

root@fl-imx6ull:~# cat /proc/net/wireless | grep wlan0 | awk '{print $3}' //获取信号强度

78.

root@fl-imx6ull:~# cat /proc/net/wireless | grep wlan0 | awk '{print $4}' //获取信号质量,单位dBm

-68.

root@fl-imx6ull:~# cat /proc/net/wireless | grep wlan0 | awk '{print $5}' //网口背景噪声,单位dBm

-256.

AP模式

说明:

l  本模块支持AP模式,理论最大连接用户为8个。

l  本例为以太网eth0连接路由器说明,配置完以太网后,需要测试eth0是否可以连接外网,如果可以连接外网(方法参考 “有线网卡”章节),请继续按照操作步骤执行,如果不可以请检查以太网或者路由器连接是否正常

工作在AP模式下,手机等设备可以直接连接模块。

设置以太网IP,配置网络防火墙:

root@fl-imx6ull:~# udhcpc -i eth0     //自动分配IP,若以测试eth0网络正常,可不操作此步

root@fl-imx6ull:~# echo 1 > /proc/sys/net/ipv4/ip_forward                   //打开 IP 转发

root@fl-imx6ull:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE//设置转发规则

设置WiFi的模式与IP

确保模块8723bu已经加载。

root@fl-imx6ull:~# ifconfig wlan0 up                                         //打开WiFi

root@fl-imx6ull:~# ifconfig wlan0 192.168.0.10 netmask 255.255.255.0  //设置IP与子网掩码

root@fl-imx6ull:~# ifconfig wlan0 promisc                        //设置 wlan0 为混杂模式

开启AP

root@fl-imx6ull:~# udhcpd /etc/udhcpd/udhcpd.conf &                 //WiFi 地址、网关等配置信息

root@fl-imx6ull:~# hostapd -d /etc/hostapd/hostapd.conf &   //加密方式、用户名、密码等设置

hostapd.conf文件中:ssid为用户名,/为密码

手机等移动终端可以通过WiFi连接到开发板的AP热点,iMX6ULL开发板默认使用以下用户名和密码:

热点名:forlinxtest密码:1234567890

步骤4:卸载已经加入内核的模块:

root@fl-imx6ull:~# rmmod 8723du

usbcore: deregistering interface driver rtl8723du

wlan0: CTRL-EVENT-DISCONNECTED bssid=04:d7:a5:f9:26:1d reason=0

 

 

FETMX6ULL-C核心板是飞凌基于NXP i.MX6U系列处理器推出的第三款核心板,成熟的技术方案,带来稳定可靠的全新体验。核心板尺寸仅40*29mm,并采用2mm合高的板对板连接器,将小体积、便于拆卸的优势集一身。https://www.forlinx.com/product/148.html

文章评论0条评论)

登录后参与讨论
我要评论
0
4
关闭 站长推荐上一条 /2 下一条