Project

General

Profile

USB WiFi Configuration

Commercial Temperature Rated Adapters

Currently we have verified the following USB WiFi adapters:

Brand Model Wireless Chipset Chipset Brand Kernel Version USB Port SoM Verified/Tested Temp Range
TPLink TL-WN722N AR9271 Atheros 3.2.0 1.1 & 2.0 L138F Yes 0C to 40C
Netgear WNA1100 AR9271 Atheros 3.2.0 2.0 L138F Yes 0C to 40C
TPLink TL-WN422G V2 AR9271 Atheros N/A N/A N/A No 0C to 40C
TPLink TL-WN727N RT2870sta RALink 3.2.0 2.0 L138F Yes 0C to 40C

Industrial Temperature Rated Adapters

Brand Model Wireless Chipset Chipset Brand Kernel Version USB Port SoM Verified/Tested Temp Range
Embedded Works EW7220UB AR9271 Atheros 3.2.0 2.0 L138F Yes -40C to +85C
N/A WUBA-171GN AR9271 Atheros N/A N/A N/A No -30C to +75C

RALink Based USB WiFi

Details on support offered by the RT2800 (RT2870) chipset:

http://linuxwireless.org/en/users/Drivers/rt2800usb

List of supported USB devices based upon the RALink Chipset:

http://linuxwireless.org/en/users/Drivers/rt2800usb/devices

RALink Kernel and Configuration Changes:

1) Verify that you are currently working with a 3.2.0 kernel version
"git branch"

2) Once verified you then need to use Menuconfig to add support for the RALink device. The following wiki page contains the necessary details to perform this http://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Linux_Kernel
  • "cd /home/mitydsp/projects/linux-davinci/"
  • "make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- menuconfig"

3) To build in support for the RALink devices you need to enable the ATH9K device drivers.

Go into the following menu(s):
  • Device Drivers -> Generic Driver Options
  • Select "*" Userspace firmware loading support
  • Networking Support -> Wireless
  • Select "*" cfg80211
  • Select "*" cfg80211 wireless extensions
  • Select "*" Wireless extensions sysfs files
  • Select "*" Common routines for IEEE802.11 drivers
  • Select "*" Generic IEEE 802.11 Networking Stack (mac80211)
  • Select "*" Minstrel
  • Select "*" Minstrel 802.11n support
  • Select "*" Enable LED triggers
  • Device Drivers -> Network Device Support -> Wireless LAN
  • Select "*" Ralink driver support
  • Go into "Ralink driver support"
  • Select "*" Ralink rt2500 (USB) support
  • Select "*" Ralink rt2501/rt73 (USB) support support
  • Select "*" Ralink rt27xx/rt28xx/rt30xx (USB) support
  • Select "*" rt2800usb - Include support for rt33xx devices
  • Select "*" rt2800usb - Include support for rt35xx devices (EXPERIMEN
  • Select "*" rt2800usb - Include support for rt53xx devices (EXPERIMEN
  • Select "*"rt2800usb - Include support for unknown (USB) devices

4) Exit out of Menu Config and save the new configuration when prompted

5) Now you need to rebuild the kernel with the new configuration
  • "make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage"

6) Once complete a new uImage will be created and placed in the /arch/arm/boot/ directory. Load your SoM with this kernel.

Root File System

You need to be using the Root File system for the 3.2.0 kernel. The "mityomap-base" file system is fine. See the following wiki for information on loading your file system.
http://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Linux_Root_File_System

Please copy the included rt2870.bin file into the /lib/firmware/ directory (make the dir if necessary). Depending on the RALink device a different driver/firmware may be needed.

Atheros Based USB WiFi

Details on support offered by the Ath9k (AR9271) chipset:

http://linuxwireless.org/en/users/Drivers/ath9k_htc

List of supported USB devices based upon the Atheros Chipset:

http://linuxwireless.org/en/users/Drivers/ath9k_htc/devices

Atheros Kernel and Configuration Changes:

1) Verify that you are currently working with a 3.2.0 kernel version
"git branch"

2) Once verified you then need to use Menuconfig to add support for the Atheros device. The following wiki page contains the necessary details to perform this http://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Linux_Kernel
  • "cd /home/mitydsp/projects/linux-davinci/"
  • "make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- menuconfig"

3) To build in support for the Atheros devices you need to enable the ATH9K device drivers.

Symbol: ATH9K [=y]                                                  
Type  : tristate                                                       
Prompt: Atheros 802.11n wireless cards support                         
Defined at drivers/net/wireless/ath/ath9k/Kconfig:6                  
Depends on: NETDEVICES [=y] && WLAN [=y] && ATH_COMMON [=y] && \     
MAC80211 [=y] 
Go into the following menu(s):
  • Device Drivers -> Generic Driver Options
  • Select "*" Userspace firmware loading support
  • Networking Support -> Wireless
  • Select "*" cfg80211
  • Select "*" cfg80211 wireless extensions
  • Select "*" Wireless extensions sysfs files
  • Select "*" Common routines for IEEE802.11 drivers
  • Select "*" Generic IEEE 802.11 Networking Stack (mac80211)
  • Select "*" Minstrel
  • Select "*" Minstrel 802.11n support
  • Select "*" Enable LED triggers
  • Device Drivers -> Network Device Support -> Wireless LAN
  • Select "*" Atheros Wireless Cards
  • Go into "Atheros Wireless Cards"
  • Select "*" Atheros 802.11n wireless cards support
  • Select "*" Atheros ath9k AHB bus support
  • Select "*" Atheros ath9k rate control
  • Select "*" Atheros HTC based wireless cards support
  • Select "*" Linux Community AR9170 802.11n USB support
  • Select "*" SoftLED support

4) Exit out of Menu Config and save the new configuration when prompted

5) Now you need to rebuild the kernel with the new configuration
  • "make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage"

6) Once complete a new uImage will be created and placed in the /arch/arm/boot/ directory. Load your SoM with this kernel.

Root File System

You need to be using the Root File system for the 3.2.0 kernel. The "mityomap-base" file system is fine. See the following wiki for information on loading your file system.
http://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Linux_Root_File_System

Please copy the included htc_9271.fw file into the /lib/firmware/ directory (make it if necessary).

Configure Linux to Use and Connect to WiFi Network

Install necessary tools

I have found the following tools to be necessary to get the WiFi working.

  • WPA_Supplicant (opkg install wpa-supplicant)
  • wireless-tools (opkg install wireless-tools)

Configure WPA Supplicant

NOTE: Wireless Tools (iwconfig) ONLY supports open or WEP encrypted connections

First you will need to edit /etc/WPA_supplicant.conf. By default this file contains a lot of useful information about how to configure a WiFi connection in this file. Please mv this file to something such as WPA_Supplicant_Orig.Conf for reference.

1) Create a new /etc/WPA_Supplicant.conf that is blank

2) Enter the following lines at the top, these are general configuration lines

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=2
fast_reauth=1

3) Now you need to enter information about the specific network you want to connect to. The example below will setup a single connection to a WPA-PSK (TKIP) access point.

# Example of WPA network
network={
        ssid="your_ssid" 
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP
        psk="ascii_passphrase" 
}

# Example of a WPA2 network
network={
        ssid="your_ssid" 
        scan_ssid=1
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP
        psk="ascii_passphrase" 
}

# Example of an open network
network={
        ssid="your_ssid" 
        key_mgmt=NONE
}

4) Save the new/changes to WPA_Supplicant.conf

Deemed Not Necessary: At this point using the wpa_cli front end application for WPA-Supplicant landed me with the following error "Could not connect to wpa_supplicant - re-trying". I found that I may need to make the following changes to the following files:

/usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service
/usr/share/dbus-1/system-services/fi.w1.wpa_supplicant1.service

Change the "Exec=" line to be "Exec=/usr/sbin/wpa_supplicant -u -s -O /var/run/wpa_supplicant" in both files.

Configure /etc/network/interfaces file

Make sure the following entry exists:

# Wireless interfaces
auto wlan0
iface wlan0 inet dhcp
        wireless_mode managed
        wireless_essid any
        wpa-driver wext
        wpa-conf /etc/wpa_supplicant.conf

I believe the wireless_mode and wireless_essid lines should be commented out but am not sure at this time.

Connecting to your Access Point

At this point everything should be configured to support the USB WiFi adapter.

1) Insert the USB WiFi adapter into the USB port
2) You should messages similar to below:

If you only see the first line than you most likely did not build in the necessary kernel components from menuconfig.
If you receive an error about the firmware file you need to create the /lib/firmware/ directory and place it there.

3) Verify that there is a "ifconfig -a" entry for wlan0 but not "ifconfig"

4) Perform a "ifup wlan0" command which will bring up the wireless. Most likely the DHCP will FAIL, we will address this shortly.

5) Verify that there is a "ifconfig" entry for wlan0

6) Execute the "wpa_cli" application. It should state "Selected interface 'wlan0'" when it is started. You will now have a > prompt. At this prompt enter "status"
A) If there is an entry for "wpa_state=COMPLETED" than the WiFi is connected to the access point. If there is NOT an "ip_address=XXX.XXX.XXX.XXX" entry than dhcp failed and needs to be redone, #8 below.
B) If there is only a "wpa_state=DISCONNECTED" you need to enter the following command "reassociate"
C) If the state is "wpa_state=ASSOCIATING" and you keep seeing messages printed baout Association failed perform a "disconnect" and then "reassociate"
D) If the entry has something similar to the following (COMPLETED, with IP Address and proper SSID etc) then the wireless is working.

bssid=00:24:b2:56:cd:3c
ssid=thinklink
id=0
mode=station
pairwise_cipher=TKIP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=10.0.102.39

7) kill the "wpa_cli" application

8) If the wifi needs to acquire a DHCP address enter the following command from your linux prompt

"/sbin/udhcpc -iwlan0" 

If everything works output similar to below will be shown

udhcpc (v1.19.3) started
Sending discover...
Sending select for 10.0.102.39...
Lease of 10.0.102.39 obtained, lease time 7200
adding dns 10.0.0.1
adding dns 24.92.226.12
adding dns 24.92.226.11
adding dns 8.8.8.8
adding dns 8.8.4.4

9) Perform a ping test to verify that your wireless is working.

Helpful commands

  • The "iwconfig" command will shows you connection status as well as signal strength
    lo        no wireless extensions.
    
    wlan0     IEEE 802.11bgn  ESSID:"thinklink" 
              Mode:Managed  Frequency:2.462 GHz  Access Point: 00:24:B2:56:CD:3C
              Bit Rate=2 Mb/s   Tx-Power=20 dBm
              Retry  long limit:7   RTS thr:off   Fragment thr:off
              Encryption key:off
              Power Management:off
              Link Quality=59/70  Signal level=-51 dBm
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
              Tx excessive retries:0  Invalid misc:91   Missed beacon:0
    
    eth0      no wireless extensions.
    
    can0      no wireless extensions.
    
    
  • The "wpa_cli status" command displays what Access Point you are connected to (if any) and the IP address that you were given
    Selected interface 'wlan0'
    bssid=00:24:b2:56:cd:3c
    ssid=thinklink
    id=0
    mode=station
    pairwise_cipher=TKIP
    group_cipher=TKIP
    key_mgmt=WPA-PSK
    wpa_state=COMPLETED
    ip_address=10.0.102.39
    
  • The "iwlist wlan0 scan" command lists all detected wifi access points
          Cell 07 - Address: 00:24:B2:56:CD:3C
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=56/70  Signal level=-54 dBm
                    Encryption key:on
                    ESSID:"thinklink" 
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=0000000014db0617
                    Extra: Last beacon: 410ms ago
                    IE: Unknown: 00097468696E6B6C696E6B
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 030106
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK

USB WiFi Throughput Test Results

The following wiki page will document some testing performed to determine throughput of the USB WiFi adapters used with a MityDSP-L138 SoM.
ARM9 USB WiFi Results

Helpful Webpages

http://ebixio.com/blog/2011/09/15/how-to-make-wpa_cli-talk-to-wpa_supplicant-in-ubuntu/
http://www.thinkwiki.org/wiki/How_to_install_wpa_supplicant
http://cboard.cprogramming.com/networking-device-communication/118431-connect-wireless-network-via-linux-command-line.html
http://linux.die.net/man/5/wpa_supplicant.conf
http://www.digipedia.pl/man/doc/view/udhcpc.8/

htc_9271.fw - Firmware for AR9271 (50.1 KB) Alexander Block, 05/25/2012 05:10 PM

rt2870.bin - Firmware for RALink RT2870 (8 KB) Alexander Block, 07/09/2012 05:15 PM

Add picture from clipboard (Maximum size: 500 MB)