DART-6UL/VAR-SOM-MX7 Wireless LAN

From Variscite Wiki
DART-6UL/VAR-SOM-MX7 Wireless LAN

Test

Scan for wireless networks:

$ ifconfig wlan0 up
$ iw dev wlan0 scan | grep SSID


Connecting to a WPA encrypted network:
If you are using Krogoth distro, please remember that Wifi interface is controlled by connman.
Before continuing with this procedure, remember to disable wifi control running

$ connmanctl disable wifi

If you are using Debian, please note that Wifi interface is controlled by Network Manager.
Before continuing with this procedure, remember to disable wifi control running

$ nmcli radio wifi off

Find your network from the above scan command.

$ mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.org
$ wpa_passphrase <YourAP> <YourPassword> >/etc/wpa_supplicant.conf
$ wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

Check link:

$ iw dev wlan0 link

Disable eth0:

$ ifconfig eth0 down
$ ifconfig eth1 down

Run DHCP:

$ udhcpc -iwlan0
$ ifconfig

Check link speed:
iperf3 server (on Target/Host):

$ ifconfig  (to get the IP address)
$ iperf3 -s

iperf3 client (on Host/Target):

$ iperf3 -c <IP_ADDRESS_OF_IPERF_SERVER>


Useful link for common iw commands: https://wiki.archlinux.org/index.php/Wireless_network_configuration#Manual_setup

Access Point

This example will demonstrate you how to use the board as an access point. It will forward packets from wlan0 to eth0. DHCPD:

$ vi /etc/udhcpd.conf 
# 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   wlan0               #default: eth0
#Example
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

This is a network example. You need to set the IP address based on your network.
Wireless configuration can be setup in file /etc/hostapd.conf before launching hostapd for configuring access point name, requiring password, etc.
For example:

$ vi /etc/hostapd.conf

You can set the following parameters:

ssid=VARI_AP
wpa=2
rsn_pairwise=CCMP
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
ieee80211n=1

Ensure that wpa_supplicant is not holding the device

$ killall wpa_supplicant
$ killall hostapd

IP Forwarding:

$ echo 1 > /proc/sys/net/ipv4/ip_forward
$ ifconfig wlan0 192.168.5.1
$ hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
$ udhcpd /etc/udhcpd.conf
$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

As a next step one should take a look at iw utility which can be used for configuring some parameters https://wireless.wiki.kernel.org/en/users/documentation/iw

Note on DART-6UL WiFi initialization

On the DART-6UL the WiFi and the SD card share the same SDIO controller and therefore cannot be used simultaneously.
The choice to use either the WiFi or the SD card is made by selecting the appropriate device tree.
The WiFi initialization script looks for a "WIFI" sub-string in the machine description property of the used device tree (accessible via /sys/devices/soc0/machine) to determine whether or not the WiFi device tree was selected.
Please bear this in mind when making DTS modifications.

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

ccode=US
regrev=911

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

* ISED for Sterling LWB is managed using ccode=US, it's not a typo.