DART-6UL/VAR-SOM-MX7 Wireless LAN: Difference between revisions
(Add category Debian) |
|||
(26 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{PageHeader|DART-6UL - Wireless LAN}} {{DocImage|category1= | {{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 8: | Line 8: | ||
<br> | <br> | ||
'''Connecting to a WPA encrypted network:''' <br> | '''Connecting to a WPA encrypted network:''' <br> | ||
If you are using Krogoth distro, please remember that Wifi interface is controlled by [[wifi connman | connman]].<br> | |||
Before continuing with this procedure, remember to disable wifi control running | |||
<pre> | |||
$ connmanctl disable wifi | |||
</pre> | |||
If you are using Debian, please note that Wifi interface is controlled by Network Manager. <br> | |||
Before continuing with this procedure, remember to disable wifi control running | |||
<pre> | |||
$ nmcli radio wifi off | |||
</pre> | |||
Find your network from the above scan command.<br> | Find your network from the above scan command.<br> | ||
<pre> | <pre> | ||
Line 13: | Line 23: | ||
$ wpa_passphrase <YourAP> <YourPassword> >/etc/wpa_supplicant.conf | $ wpa_passphrase <YourAP> <YourPassword> >/etc/wpa_supplicant.conf | ||
$ wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf | $ wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf | ||
</pre> | </pre> | ||
Check link: | Check link: | ||
Line 32: | Line 38: | ||
$ ifconfig | $ ifconfig | ||
</pre> | </pre> | ||
Check link speed | '''Check link speed:''' <br> | ||
iperf3 server (on Target/Host): | |||
<pre> | <pre> | ||
$ | $ ifconfig (to get the IP address) | ||
$ iperf3 -s | |||
</pre> | </pre> | ||
iperf3 client (on Host/Target): | |||
<pre> | <pre> | ||
$ | $ iperf3 -c <IP_ADDRESS_OF_IPERF_SERVER> | ||
</pre> | </pre> | ||
Line 46: | Line 53: | ||
= Access Point = | = Access Point = | ||
This example will demonstrate you how to use the | This example will demonstrate you how to use the board as an access point. It will forward packets from wlan0 to eth0. | ||
DHCPD: | DHCPD: | ||
<pre>$ vi /etc/udhcpd.conf | <pre>$ vi /etc/udhcpd.conf | ||
Line 62: | 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> | ||
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 | For example:<br> | ||
<pre> | |||
<pre>$ vi /etc/hostapd.conf | $ vi /etc/hostapd.conf | ||
</pre> | |||
ssid= | You can set the following parameters: | ||
<pre> | |||
ssid=VARI_AP | |||
wpa=2 | |||
rsn_pairwise=CCMP | |||
wpa_passphrase=12345678 | wpa_passphrase=12345678 | ||
wpa_key_mgmt=WPA-PSK | |||
ieee80211n=1 | |||
</pre> | </pre> | ||
Ensure that wpa_supplicant is not holding the device | |||
<pre> | |||
<pre>$ killall wpa_supplicant | $ killall wpa_supplicant | ||
$ killall hostapd | $ killall hostapd | ||
</pre> | </pre> | ||
IP Forwarding: | IP Forwarding: | ||
<pre>$ echo 1 > /proc/sys/net/ipv4/ip_forward | <pre> | ||
$ echo 1 > /proc/sys/net/ipv4/ip_forward | |||
$ ifconfig wlan0 192.168.5.1 | $ ifconfig wlan0 192.168.5.1 | ||
$ hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid | $ hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid | ||
Line 85: | Line 99: | ||
</pre> | </pre> | ||
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.<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
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.