Search by Tags

Wi-Fi (Linux)

 

Compare with Revision




Subscribe for this article updates

Currently no Toradex module comes with on-module Wi-Fi hardware. Support can easily be added using either a mini-PCIe, SDIO or USB Wi-Fi module. Our Embedded Linux BSPs only support the Ambicom WL250N-USB out-of-the-box which is available through our web shop as well.

Alternatively many off-the-shelf Wi-Fi modules will work just fine once the matching driver is compiled into a custom Linux kernel. Please note however that most Wi-Fi modules require matching firmware as well. The easiest is to first test respective module on a regular PC running Linux (e.g. using a mini-PCIe to PCIe adapter if required). Make sure to use a Linux kernel version as close to the version running on the Toradex module as possible. Not only do you then see whether it works reliable or not but one can also simply copy matching firmware from there if required.

Note: Not all suitable drivers are available in custom downstream Linux kernels in which case one can use the driver backports package including suitable drivers available from later Linux kernel versions. Please refer to the following article concerning compilation of the same:

Kernel Driver Backports Integration

Custom Kernel

To enable support for other Wi-Fi hardware a custom Linux kernel is required. Please refer to the following article concerning setup/compilation of the same:

Build U-Boot and Linux Kernel from Source Code

Mini-PCIe

Our embedded Linux BSPs so far do not support any mini-PCIe Wi-Fi modules out-of-the-box. However we successfully tested various mini-PCIe Wi-Fi modules based on Broadcom (e.g. BCM4311KFBG) und Intel (e.g. 4965AGN, 6230AGN, ,N-1000 and N-7260) chip sets.

To configure e.g. support for the Intel 6230AGN mini-PCIe module one has to enable CONFIG_IWLAGN as follows:

[user@host linux-toradex]$ make menuconfig
Device Drivers  --->
[*] Network device support  --->
[*]   Wireless LAN  --->
<*>   Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlagn)
< Exit > (4 times)
Do you wish to save your new configuration? < Yes >

Then just compile and deploy the custom kernel as explained in above mentioned article.

During boot one gets the following kernel messages:

[    7.290881] Intel(R) Wireless WiFi Link AGN driver for Linux, in-tree:
...
[    7.344598] iwlagn 0000:04:00.0: HW Revision ID = 0x34
[    7.357966] iwlagn 0000:04:00.0: Detected Intel(R) Centrino(R) Advanced-N 6230 AGN, REV=0xB0
[    7.369558] iwlagn 0000:04:00.0: L1 Disabled; Enabling L0S
[    7.396050] iwlagn 0000:04:00.0: device EEPROM VER=0x716, CALIB=0x6
[    7.405308] iwlagn 0000:04:00.0: Device SKU: 0X1f0

USB

The following USB Wi-Fi sticks with the Ralink RT3070 chip set are supported out-of-the-box. However we successfully tested various USB Wi-Fi modules based on Ralink(e.g RT5370, RT5572), Realtek(e.g RTL8188CUS, RTL8192EU chipset), Zydas(e.g ZD1211B).

  • Ambicom WL250N-USB Wireless 802.11b/g/n (V1.0a) EOL
  • WL250N-USB WiFi V2.0a 802.11b/g/n

During boot or upon insertion the following kernel messages identify this stick:

[    6.325130] usb 2-1: new high speed USB device number 2 using tegra-ehci
[    6.513350] usb 2-1: New USB device found, idVendor=148f, idProduct=3070
[    6.535906] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    6.558417] usb 2-1: Product: 802.11 n WLAN
[    6.577712] usb 2-1: Manufacturer: Ralink
[    6.596717] usb 2-1: SerialNumber: 1.0
[    6.745127] usb 2-1: reset high speed USB device number 2 using tegra-ehci

In user space it can be identified by lsusb as follows:

root@colibri_t20:~# lsusb
...
Bus 002 Device 002: ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
...

Linux V2.0 images contain the required firmware, however for older images or custom builds the following error message indicates missing /lib/firmware/rt2870.bin:

[ 3579.756603] phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.

The firmware can be downloaded and installed as follows:

  • http://www.ralinktech.com - Support - Downloads - Linux - rmware RT28XX/RT30XX USB series (RT2870/RT2770/RT3572/RT3070)
  • extract rt2870.bin and put it into /lib/firmware on the target

SDIO

Our embedded Linux BSPs so far do not support any SDIO Wi-Fi modules out-of-the-box. However we successfully tested the WiBear 11n SDIO Wifi wireless adapter module based on Marvel 8787 chipset.

To configure support for the Marvel 8787 SDIO wireless adapter module one has to enable CONFIG_MWIFIEX, CONFIG_MWIFIEX_SDIO as follows:

[user@host linux-toradex]$ make menuconfig
Device Drivers  --->
[*] Network device support  --->
[*]   Wireless LAN  --->
<*>   Marvell WiFi-Ex Driver
<*>   Marvell WiFi-Ex Driver for SD8786/SD8787/SD8797/SD8887/SD8897
< Exit > (4 times)
Do you wish to save your new configuration? < Yes >

During boot one gets the following kernel messages:

[ 392.591781] mmc1: new high speed SDIO card at address 0001
[ 393.583165] mwifiex_sdio mmc1:0001:1: WLAN FW is active
[ 394.068554] mwifiex_sdio mmc1:0001:1: ignoring F/W country code US
[ 394.118806] mwifiex_sdio mmc1:0001:1: driver_version = mwifiex 1.0 (14.66.35.p52)
[ 429.748907] IPv6: ADDRCONF(NETDEV_UP): mlan0: link is not ready

Firmware

Most Wi-Fi hardware uses specific firmware to operate properly. Certain such firmware can easily be installed as follows:

opkg update
opkg --force-depends install linux-firmware

Wi-Fi Connection Bring Up

Wi-Fi Connection Bring Up BSP V1.x

On images V1.x the following brings up the connection from the command line:

ifconfig wlan0 up
iwlist wlan0 scanning
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
#  -dd for debugging
#  -B for background daemon

To do WEP, WPA or WPA2 just edit /etc/wpa_supplicant.conf and add the information about your wireless network infrastructure.

If you erroneously specify proto=WPA but do have a WPA2 infrastructure wpa_supplicant returns the following error message if run with debugging (-dd) enabled:

wlan0:    skip - no WPA/RSN proto match                                        

Wi-Fi Connection Bring Up BSP V2.x

On images V2.x the connman package provides connectivity management.

http://connman.net

Automatic (GUI)

The connections can be configured by starting the configuration program connman-properties or by starting the taskbar applet connman-applet.

Manual

Our latest V2.x images also include a command-line configuration tool called connmanctl:

https://gist.github.com/kylemanna/6930087

As follows how to connect to a WPA PSK enabled Wi-Fi using an Ambicom WL250N-USB stick:

First plug in the Wi-Fi USB stick:

[  151.035883] usb_phy_bringup_host_controller: timeout waiting for USB_PORTSC_PE
[  151.195650] usb 2-1: new high speed USB device number 2 using tegra-ehci
[  151.364040] usb 2-1: New USB device found, idVendor=148f, idProduct=3070
[  151.370894] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  151.385573] usb 2-1: Product: 802.11 n WLAN
[  151.389803] usb 2-1: Manufacturer: Ralink
[  151.393842] usb 2-1: SerialNumber: 1.0
[  151.545616] usb 2-1: reset high speed USB device number 2 using tegra-ehci

Then enable the Wi-Fi technology layer:

root@colibri-t20:~# connmanctl enable wifi
[ 3186.638515] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 3187.389969] ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 3190.239053] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

And scan for available networks:

root@colibri_t20:~# connmanctl scan wifi
Scan completed

Now show what the above actually found:

root@colibri-t20:~# connmanctl services
*AR Wired                { ethernet_00142d486cef_cable }
    <SSID>               { wifi_<HASH>_managed_psk }

Finally adjust the security aka WPA PSK configuration:

root@colibri_t20:~# vi /var/lib/connman/<SSID>-psk.config
[service_wifi_<HASH>_managed_psk]
Type = wifi
Name = <SSID>
Passphrase = <PASSPHRASE>

Last but not least attempt to connect:

root@colibri_t20:~# connmanctl connect wifi_<HASH>_managed_psk
[ 1165.219739] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Connected

If you still have wired Ethernet connected make sure to disconnect the cable in order for Wi-Fi to take over:

root@colibri_t20:~# [ 1197.993868] eth0: ax88772b - Link status is: 0
[ 1198.114958] ADDRCONF(NETDEV_UP): eth0: link is not ready

Configuring Wi-Fi with static IP address

Configuring Wi-Fi with a static IP address can be done using the connman-applet with a graphical user interface. If one does not have a GUI, the process must be done via the command line interface.

When a WPA PSK configuration file is created, connman automatically configures Wi-Fi to use DHCP and does not allow manual changes to the IP address as it would for an Ethernet connection using connmanctl.

If the following file was created before, it needs to be deleted, as it conflicts with a new file that will be created:

/var/lib/connman/<SSID>-psk.config

First create the following directory (where is the hash identifier assigned to the device by connman):

mkdir /var/lib/connman/wifi_<HASH>_managed_psk

Inside the directory, create a file named “settings”:

vi /var/lib/connman/wifi_<HASH>_managed_psk/settings

The file should contain the following:

[wifi_<HASH>_managed_psk]
Name=<SSID>                        ← Name of your network 
SSID=544f52414445585f4252          ← Name of your network in hexadecimal format 
Favorite=true
IPv4.method=manual                 ← Method to be used (in our case manual IP)
IPv4.netmask_prefixlen=24
IPv4.local_address=192.168.0.133   ← Desired IP address
IPv4.gateway=192.168.0.1
Passphrase=<PASS>                  ← Wi-Fi network password
AutoConnect=true

In this next step we have three options, one can use what is best suited to the application:

  • reboot the module;
  • disconnect and reconnect the Wi-Fi module (if it was already connected);
  • restart the USB bus port with the following commands:

    echo '1-1' > /sys/bus/usb/drivers/usb/unbind echo '1-1' > /sys/bus/usb/drivers/usb/bind

Now enable the Wi-Fi technology layer:

connmanctl enable wifi

Finally, simply connect to the network:

connmanctl connect wifi_<HASH>_managed_psk

With all the steps concluded, the module should be connected with the chosen static IP address and it is now possible to freely change the IP address using connmanctl.