Wireless¶
VAR-SOM-MX8M-NANO Overview¶
The VAR-SOM-MX8M-NANO supports the following WiFi modules:
| Module | Chipset | Features | Network Interface(s) |
|---|---|---|---|
| Sterling LWB | Cypress CYW4343W | 802.11 b/g/n | wlan0 |
| Sterling LWB5 | Cypress CYW43353 | 802.11 ac/a/b/g/n, | wlan0 |
This guide demonstrates how to configure WiFi using systemd-networkd. It is important to use the correct network interface for the module assembled on your VAR-SOM-MX8M-NANO.
Managing WiFi using systemd-networkd¶
systemd-networkd is a system daemon that manages network configurations. It detects and configures network devices as they appear.
systemd-networkd's functionality can be useful for both wireless and wired networks.
This guide describes how to use systemd-networkd to configure wireless networks.
Enabling and disabling WiFi¶
To enable WiFi run
To disable WiFi run
Configuring WiFi Client¶
Scanning for available WiFi APs¶
If WiFi is enabled you can get the list of available APs by running
Connecting to a protected WiFi network¶
Create /etc/systemd/network/80-wifi-station.network as following:
# cp /lib/systemd/network/80-wifi-station.network.example /etc/systemd/network/80-wifi-station.network
Append the following content to /etc/systemd/network/80-wifi-station.network:
Create /etc/wpa_supplicant/wpa_supplicant-wlan0.conf with the following content:
To set your network's SSID and password:
Enable Wi-Fi interface:
Restart the services:
# systemctl restart systemd-networkd.service
# systemctl restart [email protected]
Wait a few seconds and then check if wlan0 is up and has an assigned IP:
Check if the gateway and the DNS server are reachable:
To make the Wi-Fi connection permanent, enable the wpa_supplicant service:
# systemctl enable [email protected]
If wlan0 fails to connect, the following commands may be helpful for debugging:
# journalctl -u [email protected]
# journalctl -u systemd-networkd.service
# wpa_cli
Configuring WiFi Access Point with Hostapd¶
hostapd is a versatile option for setting up a WiFi access point. It offers more options and flexibility compared to other tools.
For instance, hostapd can even enable the creation of a WiFi 6 access point.
udhcpd is a suitable option for providing DHCP services alongside hostapd. It's a lightweight DHCP server that can be easily integrated with hostapd.
The following steps describe how to create an access point using hostapd and udhcpd.
Create /etc/hostapd.conf¶
The next step is to create /etc/hostapd.conf. The following table shows how to configure 802.11bgn, 802.11ac, and 802.11ax access points:
|
Wi-Fi 2.4GHz (802.11bgn)
/etc/hostapd.conf |
Wi-Fi 5 (802.11ac)
/etc/hostapd.conf |
Wi-Fi 6 (802.11ax)
/etc/hostapd.conf |
|---|---|---|
|
|
|
Add the Control interface directory and group to /etc/hostapd.conf:
Note: When copying the text above, your file may contain zero width spaces at the end of each line (appearing as ^^k in nano or hex e2 80 8b in hexdump). This will cause hostapd to fail. You can fix it by running:
# sed 's/\xe2\x80\x8b//g' /etc/hostapd.conf > /etc/hostapd_cleaned.conf && mv /etc/hostapd_cleaned.conf /etc/hostapd.conf
Configure DHCP server¶
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 192.168.5.20 #default: 192.168.0.20
end 192.168.5.25 #default: 192.168.0.254
# The interface that udhcpd will use
interface uap0
opt dns 8.8.8.8 8.8.4.4 # public google dns servers
option subnet 255.255.255.0
opt router 192.168.5.1
option lease 864000 # 10 days of seconds
Then, assign uap0 an ip and start hostapd and udhcpd:
At this point, devices can connect and dhcp an ip address using the access point on uap0.
Optionally configure NAT between uap0 and eth0:¶
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i uap0 -o eth0 -j ACCEPT
and allow ip forwarding:
Now, devices connecting to the access point on uap0 will have network access through eth0.
Sterling LWB/LWB5 WiFi STA/AP concurrency¶
To get the WiFi module to work in concurrent AP-STA mode on the Sterling LWB/LWB5, a virtual wireless interface is required.
This can be achieved creating a virtual uap0 interface, running
STA setup can be managed simply following the steps described in Configuring WiFi Client section.
AP setup can be managed following the steps described in Configuring WiFi Access Point section, but when creating the access point, be careful to use uap0 instead of wlan0.
Notes¶
The iw command (used to create the virtual uap0 interface) does not create permanent changes: we suggest to introduce it in the variscite-wifi script (located in /etc/wifi for latest releases), when checking for the wlan0 existance, something like
if [ -d /sys/class/net/wlan0 ]; then
# create uap0 interface
iw dev wlan0 interface add uap0 type __ap
return 0
else
...
Also, in the same file, just before shutting down wlan0, you may want to delete this virtual interface, something like
Limitations¶
By HW design, Sterling-LWB/LWB5 WiFi modules provide a single channel tuner.
AP-STA operations are possible, but the local AP channel is actually the one negotiated between the local client and the remote AP.
Testing WiFi throughput¶
Establish connection to WiFi network and use iperf3 tool on target and another host:
iperf3 server (on Target/Host):
iperf3 client (on Host/Target):
Configuring WiFi Regulatory Domain¶
According the mounting option of the SoM in use, the kernel loads dedicated firmware files from the folder /lib/firmware/brcm:
| mounting option | WiFi chip | firmware files |
|---|---|---|
| WB | Sterling LWB | brcmfmac43430-sdio.bin / brcmfmac43430-sdio.txt |
| WBD | Sterling LWB5 | brcmfmac4339-sdio.bin / brcmfmac4339-sdio.txt |
Each txt file contains the ccode parameter selecting the regulatory domain.
Additionally, for Sterling LWB5 only, the regrev parameter must change according the ccode (it's always zero for Sterling LWB).
By default, the BSP ships firmware configurations matching FCC Regulatory Domain, one of the most restrictive in terms of available channels.
For Sterling LWB5 and FCC you can read
The following table reports the valid options for ccode / regrev parameter.
|
regulatory
authority |
Sterling LWB | Sterling LWB5 | ||
|---|---|---|---|---|
| ccode | regrev | ccode | regrev | |
| FCC | US | 0 | US | 911 |
| ETSI | EU | 0 | EU | 116 |
| ISED | US* | 0 | CA | 938 |
| MIC | JP | 0 | JP | 101 |
| RRA | N/A | N/A | KR** | 301 |
* ISED for Sterling LWB is managed using ccode=US, it's not a typo.
** RRA is only available for Sterling LWB5 with FW 6.37.39.141 or greater.