> For the complete documentation index, see [llms.txt](https://amobile-solutions.gitbook.io/yocto-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amobile-solutions.gitbook.io/yocto-developer-guide/test-and-use-the-interface/wi-fi/wi-fi-iot-800n-g420.md).

# Wi-Fi - IOT-800N-G420

## Overview

|                   |                              |
| ----------------- | ---------------------------- |
| Module            | MediaTek MT7921S, on the SoM |
| Standards         | 802.11 a/b/g/n/ac/ax, 2T2R   |
| Interface         | **SDIO** (`mmc2`), not PCIe  |
| Driver            | `mt76` (`mt7921s`)           |
| Network interface | `wlan0`                      |

WiFi and Bluetooth are two SDIO functions of the same chip, so if `mmc2` does not come up neither appears.

## Checking the interface

```
ip link show wlan0
iw dev
```

```
dmesg | grep -i mt7921
```

Firmware loading should be visible:

```
mt7921s ...: WM Firmware Version: ____, Build Time: ...
```

The required firmware comes from `linux-firmware`:

```
ls /lib/firmware/mediatek/WIFI_RAM_CODE_MT7961*
ls /lib/firmware/mediatek/WIFI_MT7961*
```

## Scanning

```
nmcli dev wifi list
```

or

```
iw dev wlan0 scan | grep SSID
```

## Connecting with NetworkManager

### Enabling and disabling

```
nmcli radio wifi on
nmcli radio wifi off
```

To check the state:

```
nmcli dev show wlan0
```

`GENERAL.STATE` reads `connected` or `disconnected` when WiFi is enabled, and `unavailable` when it is not.

### Open network

```
nmcli dev wifi connect <SSID> ifname wlan0
```

Hidden:

```
nmcli dev wifi connect <SSID> hidden yes ifname wlan0
```

### Protected network

```
nmcli dev wifi connect <SSID> password <password> ifname wlan0
```

Hidden:

```
nmcli dev wifi connect <SSID> password <password> hidden yes ifname wlan0
```

### Managing connections

Connections persist across reboots unless deleted.

```
nmcli con show
nmcli con down <SSID>
nmcli con up <SSID>
nmcli con delete <SSID>
```

## Access point mode

NetworkManager can turn the interface into an AP, handling the DHCP server and NAT configuration at the same time.

### Disable the standalone dnsmasq

```
systemctl disable dnsmasq
systemctl stop dnsmasq
```

Then in `/etc/NetworkManager/NetworkManager.conf`:

```
[main]
dns=dnsmasq

[ifupdown]
managed=false
```

### Create the AP

```
nmcli con add type wifi ifname wlan0 mode ap con-name WIFI_AP ssid MY_AP && \
  nmcli con modify WIFI_AP 802-11-wireless.band bg && \
  nmcli con modify WIFI_AP 802-11-wireless.channel 1 && \
  nmcli con modify WIFI_AP 802-11-wireless-security.key-mgmt wpa-psk && \
  nmcli con modify WIFI_AP 802-11-wireless-security.proto rsn && \
  nmcli con modify WIFI_AP 802-11-wireless-security.group ccmp && \
  nmcli con modify WIFI_AP 802-11-wireless-security.pairwise ccmp && \
  nmcli con modify WIFI_AP 802-11-wireless-security.psk 11223344 && \
  nmcli con modify WIFI_AP ipv4.method shared && \
  nmcli con up WIFI_AP
```

For the 5 GHz band:

```
nmcli con modify WIFI_AP 802-11-wireless.band a
nmcli con modify WIFI_AP 802-11-wireless.channel 36
```

### DHCP subnet

The default is 10.42.0.x/24 with the AP at 10.42.0.1.

```
nmcli con modify WIFI_AP ipv4.addr 192.168.5.1/24
```

## Troubleshooting

### wlan0 does not appear

The MT7921 needs the PMIC's `vcn18` rail, which supplies the IO side of the SDIO bus.

```
grep vcn18 /sys/kernel/debug/regulator/regulator_summary
```

A use count of 0 means the rail is not enabled, and the chip will never answer CMD5:

```
dmesg | grep mmc2
```

```
mmc2: error -110 whilst initialising SDIO card
```

{% hint style="warning" %}
Unbinding and rebinding the driver does not help here — rebinding does not make a missing supply appear. The rail has to be enabled in the device tree.
{% endhint %}

### The MAC address looks wrong

The MAC is programmed during production. An address beginning `02:` or one that changes between boots means the driver generated a random one because it could not read the programmed value.

```
ip link show wlan0 | grep ether
```
