DART-6UL/VAR-SOM-MX7 Wireless LAN: Difference between revisions

From Variscite Wiki
No edit summary
(Add category Debian)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{PageHeader|DART-6UL/VAR-SOM-MX7 Wireless LAN}} {{DocImage|category1=Yocto|category2=DART-6UL}}[[Category:VAR-SOM-MX7]] __toc__
{{PageHeader|DART-6UL/VAR-SOM-MX7 Wireless LAN}} {{DocImage|category1=Yocto|category2=Debian}}[[Category:DART-6UL]][[Category:VAR-SOM-MX7]] __toc__
= Test =
= Test =
'''Scan for wireless networks''':  
'''Scan for wireless networks''':  
Line 69: Line 69:
</pre>
</pre>
This is a network example. You need to set the IP address based on your network.<br>
This is a network example. You need to set the IP address based on your network.<br>
<br>
Wireless configuration can be setup in file /etc/hostapd.conf before launching hostapd for configuring access point name, requiring password, etc.<br>
Wireless configuration can be setup in file /etc/hostapd.conf before launching hostapd for configuring access point name, requiring password, etc.<br>
For example:<br>
For example:<br>
<pre>
<pre>
$ vi /etc/hostapd.conf
$ vi /etc/hostapd.conf
</pre>
You can set the following parameters:
You can set the following parameters:
<pre>
ssid=VARI_AP
ssid=VARI_AP
wpa=2
wpa=2
Line 80: Line 81:
wpa_passphrase=12345678
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_key_mgmt=WPA-PSK
ieee80211n=1
</pre>
</pre>


Line 99: Line 101:
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
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 =
= Note on DART-6UL WiFi initialization =
On DART-6UL SOM WIFI and SD card share the same SDIO controller and therefore cannot be used simultaneously. The choice to use either WIFI or SD card is made by selecting the appropriate device tree. WIFI initialization script looks for "WIFI" string in machine description property of device tree (accessible via /sys/devices/soc0/machine) to determine that WIFI device tree was selected. Please bear this in mind when making DTS modifications.
On the DART-6UL the WiFi and the SD card share the same SDIO controller and therefore cannot be used simultaneously.<br>
The choice to use either the WiFi or the SD card is made by selecting the appropriate device tree.<br>
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.<br>
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:
 
{| class="wikitable" style="text-align: center;"
! mounting option
! WiFi chip
! firmware files
|-
| WB
| [https://www.lairdconnect.com/wireless-modules/wifi-modules-bluetooth/sterling-lwb-24-ghz-wifi-module Sterling LWB]
| brcmfmac43430-sdio.bin / brcmfmac43430-sdio.txt
|-
| WBD
| [https://www.lairdconnect.com/wireless-modules/wifi-modules-bluetooth/sterling-lwb5-dual-band-wifi-module-bluetooth-42 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.
 
{| class="wikitable" style="text-align: center;"
! rowspan=2 | regulatory<br>authority
! colspan=2 | Sterling LWB
! colspan=2 | Sterling LWB5
|-
! ccode
! regrev
! ccode
! regrev
|-
| [https://www.fcc.gov/ FCC]
| US
| 0
| US
| 911
|-
| [https://www.etsi.org/ ETSI]
| EU
| 0
| EU
| 116
|-
| [https://www.ic.gc.ca/ ISED]
| US*
| 0
| CA
| 938
|-
| [https://www.soumu.go.jp/english/ MIC]
| JP
| 0
| JP
| 101
|}
<nowiki>*</nowiki> ISED for Sterling LWB is managed using ''ccode=US'', it's not a typo.

Latest revision as of 18:55, 6 June 2023

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.