DESK-MX9-L/Peripherals/WiFi

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2025/01/30 DESK-MX9-L-5.2.0 release


Peripheral WiFi[edit | edit source]

Device tree configuration[edit | edit source]

Here below is an example of device tree configuration used standard DAVE's kit:

From imx93-aura-sbcx.dtsi:

/ {
...
		usdhc3_pwrseq: usdhc3_pwrseq {
			compatible = "mmc-pwrseq-simple";
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usdhc3_pwrseq>;
			reset-gpios = <&gpio2 18 GPIO_ACTIVE_LOW>;
		};
...
		reg_wifi_en: regulator-wifi-en {
			compatible = "regulator-fixed";
			enable-active-high;
			gpio = <&gpio2 6 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_wifi_pwr_en>;
			regulator-max-microvolt = <3300000>;
			regulator-min-microvolt = <3300000>;
			regulator-name = "PDn_AW-CM276NF";
			/*
			 * IW612 wifi chip needs more delay than other wifi chips to complete
			 * the host interface initialization after power up, otherwise the
			 * internal state of IW612 may be unstable, resulting in the failure of
			 * the SDIO3.0 switch voltage.
			 */
			startup-delay-us = <20000>;
		};
...
};

...
...

/*
 * AzureWave SDIO on usdhc3
 */
&usdhc3{
	pinctrl-names = "default", "state_100mhz", "state_200mhz";
	pinctrl-0 = <&pinctrl_usdhc3>;
	pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
	pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
	vmmc-supply = <&reg_wifi_en>;
	mmc-pwrseq = <&usdhc3_pwrseq>;
	bus-width = <4>;
	non-removable;
	no-1-8-v;
	max-frequency = <24000000>;
	status = "okay";
};

...
...

&iomuxc {
...
...
	pinctrl_usdhc3: usdhc3grp {
		fsl,pins = <
			MX93_PAD_SD3_CLK__USDHC3_CLK		0x159e
			MX93_PAD_SD3_CMD__USDHC3_CMD		0x4000138e
			MX93_PAD_SD3_DATA0__USDHC3_DATA0	0x4000138e
			MX93_PAD_SD3_DATA1__USDHC3_DATA1	0x4000138e
			MX93_PAD_SD3_DATA2__USDHC3_DATA2	0x4000138e
			MX93_PAD_SD3_DATA3__USDHC3_DATA3	0x4000138e
		>;
	};

	pinctrl_usdhc3_100mhz: usdhc3-100mhzgrp {
		fsl,pins = <
			MX93_PAD_SD3_CLK__USDHC3_CLK		0x158e
			MX93_PAD_SD3_CMD__USDHC3_CMD		0x4000138e
			MX93_PAD_SD3_DATA0__USDHC3_DATA0	0x4000138e
			MX93_PAD_SD3_DATA1__USDHC3_DATA1	0x4000138e
			MX93_PAD_SD3_DATA2__USDHC3_DATA2	0x4000138e
			MX93_PAD_SD3_DATA3__USDHC3_DATA3	0x4000138e
		>;
	};

	pinctrl_usdhc3_200mhz: usdhc3-200mhzgrp {
		fsl,pins = <
			MX93_PAD_SD3_CLK__USDHC3_CLK		0x15fe
			MX93_PAD_SD3_CMD__USDHC3_CMD		0x400013fe
			MX93_PAD_SD3_DATA0__USDHC3_DATA0	0x400013fe
			MX93_PAD_SD3_DATA1__USDHC3_DATA1	0x400013fe
			MX93_PAD_SD3_DATA2__USDHC3_DATA2	0x400013fe
			MX93_PAD_SD3_DATA3__USDHC3_DATA3	0x400013fe
		>;
	};

	pinctrl_wifi_pwr_en: wifipwrengrp { 		//  SDIO_RESET
		fsl,pins = <
			MX93_PAD_GPIO_IO06__GPIO2_IO06		0x31e
		>;
	};

	pinctrl_usdhc3_pwrseq: usdhc3pwrseqgrp {   	//  W_DISABLE
		fsl,pins = <
			MX93_PAD_GPIO_IO18__GPIO2_IO18		0x31e
		>;
	};
};

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

  • load wlan driver
...
...
root@desk-mx93-rev1:~# killall wpa_supplicant
root@desk-mx93-rev1:~# modprobe moal mod_para=nxp/wifi_mod_para.conf
[   37.997699] mlan: loading out-of-tree module taints kernel.
[   38.085829] wlan: Loading MWLAN driver
[   38.089934] wlan: Register to Bus Driver...
[   38.099910] vendor=0x02DF device=0x9141 class=0 function=1
[   38.105482] Attach moal handle ops, card interface type: 0x104
[   38.111327] rps set to 0 from module param
[   38.117559] SD8997: init module param from usr cfg
[   38.122405] card_type: SD8997, config block: 0
[   38.126865] cfg80211_wext=0xf
[   38.129838] max_vir_bss=1
[   38.132478] cal_data_cfg=none
[   38.135467] ps_mode = 1
[   38.137907] auto_ds = 1
[   38.140365] host_mlme=enable
[   38.143270] fw_name=nxp/sdiouart8997_combo_v4.bin
[   38.148199] SDIO: max_segs=128 max_seg_size=65535
[   38.152939] rx_work=1 cpu_num=2
[   38.156095] Enable moal_recv_amsdu_packet
[   38.160201] Attach mlan adapter operations.card_type is 0x104.
[   38.171634] wlan: Enable TX SG mode
[   38.175123] wlan: Enable RX SG mode
[   38.183326] Request firmware: nxp/sdiouart8997_combo_v4.bin
[   38.996490] Wlan: FW download over, firmwarelen=625948 downloaded 625948
[   39.359391] audit: type=1334 audit(1677843467.344:16): prog-id=10 op=UNLOAD
[   39.366400] audit: type=1334 audit(1677843467.344:17): prog-id=9 op=UNLOAD
[   39.711375] WLAN FW is active
[   39.714350] on_time is 39551146599
[   39.745584] FW country code WW does not match with US
[   39.750949] fw_cap_info=0x587c7fa3, dev_cap_mask=0xffffffff
[   39.756546] max_p2p_conn = 8, max_sta_conn = 8
[   39.787983] Register NXP 802.11 Adapter mlan0
[   39.792614] wlan: uap%d set max_mtu 2000
[   39.798647] Register NXP 802.11 Adapter uap0
[   39.824851] Register NXP 802.11 Adapter wfd0
[   39.829276] wlan: version = SD8997----16.92.21.p84.4-MM6X16423.p6-GPL-(FP92)
[   39.843858] wlan: Register to Bus Driver Done
[   39.851352] remoteproc remoteproc0: releasing imx-rproc
[   39.854157] wlan: Driver loaded successfully
...
...

Setup for static connection[edit | edit source]

  • check the interface is properly initialized:
root@desk-mx93-rev1:~# ifconfig mlan0
mlan0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether 28:d0:43:3e:a9:37  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@desk-mx93-rev1:~#
  • setup the wpa_supplicant.conf configuration file
root@desk-mx93-rev1:~# cat /tmp/wpa_supplicant.conf
network={
    ssid="ZyXEL"
    key_mgmt=NONE
}
  • apply the wpa_supplicant.conf configuration file starting the wpa_supplicant:
root@desk-mx93-rev1:~# wpa_supplicant -i mlan0 -c /etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
[  144.653726] wlan: mlan0 START SCAN
[  148.970820] wlan: SCAN COMPLETED: scanned AP count=9
[  148.980014] wlan: HostMlme mlan0 send auth to bssid fc:XX:XX:XX:03:90
[  148.988131] mlan0:
[  148.988144] wlan: HostMlme Auth received from fc:XX:XX:XX:03:90
[  149.001239] CMD_RESP: cmd 0x121 error, result=0x2
[  149.005975] IOCTL failed: 00000000b35a8259 id=0x200000, sub_id=0x200024 action=2, status_code=0x3
[  149.014842] Get multi-channel policy failed
[  149.027301] wlan: HostMlme mlan0 Connected to bssid fc:XX:XX:XX:03:90 successfully
[  149.036896] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
...

Add the mlan0 IP address:

root@desk-mx93-rev1:~# ip addr add 192.168.11.89/255.255.255.0 dev mlan0
  • the network access is enabled
root@desk-mx93-rev1:~# ping 192.168.11.243 -c 4 -I mlan0
PING 192.168.11.243 (192.168.11.243) from 192.168.11.89 mlan0: 56(84) bytes of data.
64 bytes from 192.168.11.243: icmp_seq=1 ttl=64 time=5.50 ms
64 bytes from 192.168.11.243: icmp_seq=2 ttl=64 time=2.63 ms
64 bytes from 192.168.11.243: icmp_seq=3 ttl=64 time=1.88 ms
64 bytes from 192.168.11.243: icmp_seq=4 ttl=64 time=1.92 ms

--- 192.168.11.243 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 1.883/2.981/5.500/1.484 ms

Setup for DHCP connection[edit | edit source]

  • check the interface is properly recognized
root@desk-mx93-rev1:~# ifconfig mlan0
mlan0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether 28:d0:43:3e:a9:37  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@desk-mx93-rev1:~#
  • add the network configuration for systemd-networkd
root@desk-mx93-rev1:~# cat /etc/systemd/network/21-mlan0.network
[Match]
Name=mlan0

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot

[Network]
DHCP=yes
  • setup your wpa_supplicant.conf configuration file
root@desk-mx93-rev1:~# cat /etc/wpa_supplicant.conf
network={
        ssid="daveguest"
        psk="******"
}
  • reboot and start the wpa_supplicant using the mlan0 interface and the wpa_supplicant.conf configuration file:
root@desk-mx93-rev1:~# wpa_supplicant -i mlan0 -c /etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
root@desk-mx93-rev1:~# [  137.185528] wlan: mlan0 START SCAN
[  141.502556] wlan: SCAN COMPLETED: scanned AP count=9
[  141.512980] wlan: HostMlme mlan0 send auth to bssid d0:XX:XX:XX:87:e8
[  141.525067] mlan0:
[  141.525082] wlan: HostMlme Auth received from d0:XX:XX:XX:87:e8
[  141.538605] CMD_RESP: cmd 0x121 error, result=0x2
[  141.543370] IOCTL failed: 00000000258e68c9 id=0x200000, sub_id=0x200024 action=2, status_code=0x3
[  141.552266] Get multi-channel policy failed
[  141.566521] wlan: HostMlme mlan0 Connected to bssid d0:XX:XX:XX:87:e8 successfully
[  141.585938] mlan0:
[  141.585954] wlan: Send EAPOL pkt to d0:XX:XX:XX:87:e8
[  141.609448] mlan0:
[  141.609462] wlan: Send EAPOL pkt to d0:XX:XX:XX:87:e8
[  141.620262] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
[  141.628813] woal_cfg80211_set_rekey_data return: gtk_rekey_offload is DISABLE
  • the interface will be configured and the network is accessed
root@desk-mx93-rev1:~# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
root@desk-mx93-rev1:~# systemctl restart systemd-resolved
root@desk-mx93-rev1:~# ping www.dave.eu -c 4 -I mlan0
PING www.dave.eu (51.91.120.202) from 10.203.1.171 mlan0: 56(84) bytes of data.
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=1 ttl=48 time=225 ms
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=2 ttl=48 time=145 ms
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=3 ttl=48 time=65.3 ms
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=4 ttl=48 time=293 ms

--- www.dave.eu ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 65.339/182.077/292.823/85.358 ms
root@desk-mx93-rev1:~#

Additional information[edit | edit source]