Difference between revisions of "DESK-MX8M-L/Peripherals/WiFI"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "<section begin=History/> {| style="border-collapse:collapse; " !colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History |- !style="border-le...")
 
 
Line 15: Line 15:
 
==Peripheral WiFi==
 
==Peripheral WiFi==
  
=== Device tree configuration ===
+
For device-tree configuration, please take a look to [[DESK-MX8M-L/Peripherals/PCI_express | PCIe]] page for DESK-MX8M-L
  
Here below an example of device tree configuration used on standard DAVE's kit for the MITO 8M Mini:
+
===Accessing the peripheral ===
 +
 
 +
====Linux messages at boot time====
  
From <code>imx8mm-mito8mmini.dts</code>:
+
Check that AzureWave driver for PCIe was initialized:
  
<pre>
+
<pre class="workstation-terminal">
 
...
 
...
 +
...                                                                                 
 +
[    6.519674] mwifiex_pcie 0000:01:00.0: no quirks enabled
 +
[    6.525230] mwifiex_pcie 0000:01:00.0: enabling device (0000 -> 0002)
 +
[    6.593357] mwifiex_pcie: PCI memory map Virt0: (____ptrval____) PCI memory map Virt2: (____ptrval____)
 
...
 
...
pcie0_refclk: pcie0-refclk {
+
[    7.638822] mwifiex_pcie 0000:01:00.0: info: FW download over, size 632240 bytes
compatible = "fixed-clock";
 
#clock-cells = <0>;
 
clock-frequency = <100000000>;
 
};
 
 
...
 
...
 +
[    8.509865] mwifiex_pcie 0000:01:00.0: WLAN FW is active
 +
[    8.562243] mwifiex_pcie 0000:01:00.0: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p179)
 +
[    8.570473] mwifiex_pcie 0000:01:00.0: driver_version = mwifiex 1.0 (16.68.1.p179)
 
...
 
...
regulators {
 
 
...
 
...
reg_pcie_pwr: pcie_pwr {
+
</pre>
compatible = "regulator-fixed";
+
 
regulator-name = "PCIe_PWREN";
+
Check that AzureWave connected to the PCIe
regulator-min-microvolt = <3300000>;
+
 
regulator-max-microvolt = <3300000>;
+
<pre class="workstation-terminal">
regulator-always-on;
+
root@desk-mx8mm:~# lspci
gpio = <&gpio2 20 GPIO_ACTIVE_HIGH>;
+
00:00.0 PCI bridge: Synopsys, Inc. DWC_usb3 / PCIe bridge (rev 01)
enable-active-high;
+
01:00.0 Ethernet controller: Marvell Technology Group Ltd. Device 2b42 (rev 11)
};
+
root@desk-mx8mm:~#
 +
</pre>
 +
 
 +
====Setup for static connection====
 +
 
 +
Check that interface was recognize correctly
 +
 
 +
<pre class="workstation-terminal">
 +
root@desk-mx8mm:~# ifconfig -a
 
...
 
...
 
...
 
...
&pcie0 {
+
 
pinctrl-names = "default";
+
mlan0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
pinctrl-0 = <&pinctrl_pcie0>;
+
        ether e8:fb:1c:e1:80:65  txqueuelen 1000  (Ethernet)
disable-gpio = <&gpio5 20 GPIO_ACTIVE_LOW>;
+
        RX packets 0  bytes 0 (0.0 B)
reset-gpio = <&gpio5 21 GPIO_ACTIVE_LOW>;
+
        RX errors 0  dropped 0  overruns 0  frame 0
wake-gpio = <&gpio3 20 GPIO_ACTIVE_HIGH>;
+
        TX packets 0  bytes 0 (0.0 B)
clocks = <&clk IMX8MM_CLK_PCIE1_ROOT>,
+
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
<&clk IMX8MM_CLK_PCIE1_AUX>,
+
</pre>
<&clk IMX8MM_CLK_PCIE1_PHY>,
+
 
<&pcie0_refclk>;
+
Setup your <code>wpa_supplicant.conf</code> configuration file for handle WiFi connection
clock-names = "pcie", "pcie_aux", "pcie_phy", "pcie_bus";
+
 
assigned-clocks = <&clk IMX8MM_CLK_PCIE1_AUX>,
+
<pre class="workstation-terminal">
  <&clk IMX8MM_CLK_PCIE1_PHY>,
+
root@desk-mx8mm:~# echo 'network={' > /tmp/wpa_supplicant.conf
  <&clk IMX8MM_CLK_PCIE1_CTRL>;
+
root@desk-mx8mm:~# echo '    ssid="ZyXEL"' >> /tmp/wpa_supplicant.conf
assigned-clock-rates = <10000000>, <100000000>, <250000000>;
+
root@desk-mx8mm:~# echo '    key_mgmt=NONE' >> /tmp/wpa_supplicant.conf
assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_50M>,
+
root@desk-mx8mm:~# echo '}' >> /tmp/wpa_supplicant.conf
<&clk IMX8MM_SYS_PLL2_100M>,
+
root@desk-mx8mm:~# cat /tmp/wpa_supplicant.conf
<&clk IMX8MM_SYS_PLL2_250M>;
+
network={
ext_osc = <0>;
+
    ssid="ZyXEL"
status = "okay";
+
    key_mgmt=NONE
};
+
}
 +
</pre>
 +
 
 +
Apply your <code>wpa_supplicant.conf</code> configuration file
 +
 
 +
<pre class="workstation-terminal">
 +
root@desk-mx8mm:~# wpa_supplicant -i mlan0 -c /tmp/wpa_supplicant.conf -B
 +
Successfully initialized wpa_supplicant
 
...
 
...
...
+
root@desk-mx8mm:~#
&iomuxc {
+
</pre>
...
+
 
...
+
Add network ip address
pinctrl_pcie0: pcie0grp {
+
 
fsl,pins = <
+
<pre class="workstation-terminal">
MX8MM_IOMUXC_I2C4_SCL_GPIO5_IO20   0x19
+
root@desk-mx8mm:~# ip addr add 192.168.11.165/255.255.255.0 dev mlan0
MX8MM_IOMUXC_I2C4_SDA_GPIO5_IO21   0x19
+
</pre>
MX8MM_IOMUXC_SD2_WP_GPIO2_IO20   0x19
+
 
MX8MM_IOMUXC_SAI5_RXC_GPIO3_IO20 0x19
+
Ping to local gateway
>;
+
 
};
+
<pre class="workstation-terminal">
 +
root@desk-mx8mm:~# ping 192.168.11.243 -c 4
 +
PING 192.168.11.243 (192.168.11.243) 56(84) bytes of data.
 +
64 bytes from 192.168.11.243: icmp_seq=1 ttl=64 time=2.93 ms
 +
64 bytes from 192.168.11.243: icmp_seq=2 ttl=64 time=2.96 ms
 +
64 bytes from 192.168.11.243: icmp_seq=3 ttl=64 time=1.97 ms
 +
64 bytes from 192.168.11.243: icmp_seq=4 ttl=64 time=2.77 ms
 +
 
 +
--- 192.168.11.243 ping statistics ---
 +
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
 +
rtt min/avg/max/mdev = 1.969/2.657/2.962/0.404 ms
 +
root@desk-mx8mm:~#
 +
</pre>
 +
 
 +
 
 +
====Setup for DHCP connection====
 +
 
 +
Check that interface was recognize correctly
 +
 
 +
<pre class="workstation-terminal">
 +
root@desk-mx8mm:~# ifconfig -a
 
...
 
...
 
...
 
...
 +
 +
mlan0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
 +
        ether e8:fb:1c:e1:80:65  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
 +
</pre>
 +
 +
Add network configuration for Systemd
 +
 +
<pre class="workstation-terminal">
 +
root@desk-mx8mm:~# 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
 
</pre>
 
</pre>
  
===Accessing the peripheral ===
+
Setup your <code>wpa_supplicant.conf</code> configuration file for handle WiFi connection
  
====Linux messages at boot time====
+
<pre class="workstation-terminal">
 +
root@desk-mx8mm:~# echo 'network={' > /tmp/wpa_supplicant.conf
 +
root@desk-mx8mm:~# echo '    ssid="daveguest"' >> /tmp/wpa_supplicant.conf
 +
root@desk-mx8mm:~# echo '    psk="******"' >> /tmp/wpa_supplicant.conf
 +
root@desk-mx8mm:~# echo '}' >> /tmp/wpa_supplicant.conf
 +
root@desk-mx8mm:~# cat /tmp/wpa_supplicant.conf
 +
network={
 +
        ssid="daveguest"
 +
        psk="******"
 +
}
 +
</pre>
  
PCIe driver initialized:
+
Apply your <code>wpa_supplicant.conf</code> configuration file
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
 +
root@desk-mx8mm:~# wpa_supplicant -i mlan0 -c /tmp/wpa_supplicant.conf -B
 +
Successfully initialized wpa_supplicant
 
...
 
...
...                                                                                 
+
[ 131.877506] ieee80211 phy0: mwifiex_cfg80211_sched_scan_start : Invalid Sched_scan parameters
[   1.131579] ehci-pci: EHCI PCI platform driver
+
root@desk-mx8mm:~# [ 134.728825] mwifiex_pcie 0000:01:00.0: info: trying to associate to bssid d0:21:f9:35:87:e8
[    1.147680] ohci-pci: OHCI PCI platform driver                                                                     
+
[ 134.754118] mwifiex_pcie 0000:01:00.0: info: associated to bssid d0:21:f9:35:87:e8 successfully
[   3.234024] imx6q-pcie 33800000.pcie: supply epdev_on not found, using dummy regulator
+
[ 134.778115] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
[    3.242348] imx6q-pcie 33800000.pcie: PLL REF_CLK is used!.             
 
[    3.276463] imx6q-pcie 33800000.pcie: PCIe PLL is locked.       
 
[    3.284714] imx6q-pcie 33800000.pcie: iATU unroll: enabled             
 
[   3.295015] imx6q-pcie 33800000.pcie: Detected iATU regions: 4 outbound, 4 inbound
 
[    3.309648] imx6q-pcie 33800000.pcie: host bridge /soc@0/pcie@33800000 ranges:
 
[    3.316925] imx6q-pcie 33800000.pcie:       IO 0x001ff80000..0x001ff8ffff -> 0x0000000000
 
[    3.330476] imx6q-pcie 33800000.pcie:     MEM 0x0018000000..0x001fefffff -> 0x0018000000
 
[    3.342505] imx6q-pcie 33800000.pcie: iATU unroll: enabled             
 
[   3.351821] imx6q-pcie 33800000.pcie: Detected iATU regions: 4 outbound, 4 inbound
 
[    3.444200] imx6q-pcie 33800000.pcie: Link up
 
...
 
...
 
 
</pre>
 
</pre>
  
Check which are the devices connected to the PCIe.
+
Ping to <code>www.dave.eu</code>
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@desk-mx8mm:~# lspci
+
root@desk-mx8mm:~# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
00:00.0 PCI bridge: Synopsys, Inc. DWC_usb3 / PCIe bridge (rev 01)
+
root@desk-mx8mm:~# systemctl restart systemd-resolved
01:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)
+
root@desk-mx8mm:~# ping www.dave.eu -c 4
 +
PING www.dave.eu (51.91.120.202) 56(84) bytes of data.
 +
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=1 ttl=48 time=332 ms
 +
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=2 ttl=48 time=254 ms
 +
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=3 ttl=48 time=174 ms
 +
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=4 ttl=48 time=94.2 ms
 +
 
 +
--- www.dave.eu ping statistics ---
 +
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
 +
rtt min/avg/max/mdev = 94.197/213.585/332.136/88.720 ms
 
root@desk-mx8mm:~#
 
root@desk-mx8mm:~#
 
</pre>
 
</pre>

Latest revision as of 14:22, 8 April 2024

History
Issue Date Notes
2024/04/08 DESK-MX8M-L-4.1.0 release


Peripheral WiFi[edit | edit source]

For device-tree configuration, please take a look to PCIe page for DESK-MX8M-L

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

Check that AzureWave driver for PCIe was initialized:

...
...                                                                                  
[    6.519674] mwifiex_pcie 0000:01:00.0: no quirks enabled
[    6.525230] mwifiex_pcie 0000:01:00.0: enabling device (0000 -> 0002)
[    6.593357] mwifiex_pcie: PCI memory map Virt0: (____ptrval____) PCI memory map Virt2: (____ptrval____)
...
[    7.638822] mwifiex_pcie 0000:01:00.0: info: FW download over, size 632240 bytes
...
[    8.509865] mwifiex_pcie 0000:01:00.0: WLAN FW is active
[    8.562243] mwifiex_pcie 0000:01:00.0: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p179)
[    8.570473] mwifiex_pcie 0000:01:00.0: driver_version = mwifiex 1.0 (16.68.1.p179)
...
...

Check that AzureWave connected to the PCIe

root@desk-mx8mm:~# lspci
00:00.0 PCI bridge: Synopsys, Inc. DWC_usb3 / PCIe bridge (rev 01)
01:00.0 Ethernet controller: Marvell Technology Group Ltd. Device 2b42 (rev 11)
root@desk-mx8mm:~#

Setup for static connection[edit | edit source]

Check that interface was recognize correctly

root@desk-mx8mm:~# ifconfig -a
...
...

mlan0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether e8:fb:1c:e1:80:65  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

Setup your wpa_supplicant.conf configuration file for handle WiFi connection

root@desk-mx8mm:~# echo 'network={' > /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# echo '    ssid="ZyXEL"' >> /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# echo '    key_mgmt=NONE' >> /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# echo '}' >> /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# cat /tmp/wpa_supplicant.conf
network={
    ssid="ZyXEL"
    key_mgmt=NONE
}

Apply your wpa_supplicant.conf configuration file

root@desk-mx8mm:~# wpa_supplicant -i mlan0 -c /tmp/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
...
root@desk-mx8mm:~#

Add network ip address

root@desk-mx8mm:~# ip addr add 192.168.11.165/255.255.255.0 dev mlan0

Ping to local gateway

root@desk-mx8mm:~# ping 192.168.11.243 -c 4
PING 192.168.11.243 (192.168.11.243) 56(84) bytes of data.
64 bytes from 192.168.11.243: icmp_seq=1 ttl=64 time=2.93 ms
64 bytes from 192.168.11.243: icmp_seq=2 ttl=64 time=2.96 ms
64 bytes from 192.168.11.243: icmp_seq=3 ttl=64 time=1.97 ms
64 bytes from 192.168.11.243: icmp_seq=4 ttl=64 time=2.77 ms

--- 192.168.11.243 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 1.969/2.657/2.962/0.404 ms
root@desk-mx8mm:~#


Setup for DHCP connection[edit | edit source]

Check that interface was recognize correctly

root@desk-mx8mm:~# ifconfig -a
...
...

mlan0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether e8:fb:1c:e1:80:65  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

Add network configuration for Systemd

root@desk-mx8mm:~# 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 for handle WiFi connection

root@desk-mx8mm:~# echo 'network={' > /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# echo '    ssid="daveguest"' >> /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# echo '    psk="******"' >> /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# echo '}' >> /tmp/wpa_supplicant.conf
root@desk-mx8mm:~# cat /tmp/wpa_supplicant.conf
network={
        ssid="daveguest"
        psk="******"
}

Apply your wpa_supplicant.conf configuration file

root@desk-mx8mm:~# wpa_supplicant -i mlan0 -c /tmp/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
...
[  131.877506] ieee80211 phy0: mwifiex_cfg80211_sched_scan_start : Invalid Sched_scan parameters
root@desk-mx8mm:~# [  134.728825] mwifiex_pcie 0000:01:00.0: info: trying to associate to bssid d0:21:f9:35:87:e8
[  134.754118] mwifiex_pcie 0000:01:00.0: info: associated to bssid d0:21:f9:35:87:e8 successfully
[  134.778115] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready

Ping to www.dave.eu

root@desk-mx8mm:~# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
root@desk-mx8mm:~# systemctl restart systemd-resolved
root@desk-mx8mm:~# ping www.dave.eu -c 4
PING www.dave.eu (51.91.120.202) 56(84) bytes of data.
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=1 ttl=48 time=332 ms
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=2 ttl=48 time=254 ms
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=3 ttl=48 time=174 ms
64 bytes from 202.ip-51-91-120.eu (51.91.120.202): icmp_seq=4 ttl=48 time=94.2 ms

--- www.dave.eu ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 94.197/213.585/332.136/88.720 ms
root@desk-mx8mm:~#

Additional information[edit | edit source]