world leader in high performance signal processing
Trace: » wifi_over_usb

Wifi over USB

In this page, we tested a USB extend wifi card TL-WN821N via BF548-EZKIT USB Host controller. We use 2010R1 uclinux-dist.

You can find other linux supported usb wlan cards' info including drivers and firmwares from linux-wireless.

Kernel Configure

  1. wireless network stack:
    Networking  --->
      [*] Networking support
          Wireless  --->
               <M>   cfg80211 - wireless configuration API
               [*]   cfg80211 wireless extensions compatibility
               [*]   Wireless extensions sysfs files
               {*}   Common routines for IEEE802.11 drivers
               <M>   Generic IEEE 802.11 Networking Stack (mac80211) 
  2. device drivers:
    Device Drivers  --->
       Generic Driver Options  --->
          [*]   Userspace firmware loading support
          [*]   Include in-kernel firmware blobs in kernel binar
       [*] Network device support  --->  
          [*]   Wireless LAN  --->
               <M>   Atheros Wireless Cards  ---> 
               <M>   IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)
       [*] USB support  --->
          --- USB support 
          <*>   Support for Host-side USB  
          [*]     USB device class-devices (DEPRECATED)
          <*>   Inventra Highspeed Dual Role Controller (TI, ADI, ...)
                   *** Blackfin high speed USB Support ***
                   Driver Mode (USB Host)  --->      
  3. user apps:
    Network Applications  ---> 
       [*] iperf
       [*] wireless_tools support
       [*]   iwconfig 
       [*]   iwgetid
       [*]   iwlist 
       [*]   iwpriv   
       [*]   iwspy
       [*]   iwevent 
       [*]   ifrename    

Setup Wifi

  1. Build TL-WN821N drivers: you can get it from linux wireless - ath9k_htc
  2. Add ath9k_htc firmware to rootfs: you need get firmware ar7010_1_1.fw from here
    $ cd uclinux-dist
    $ mkdir romfs/lib/firmware
    $ cp ~/ar7010_1_1.fw romfs/lib/firmware
    

It is essential to know that firmware is not loaded by the kernel, but instead in userspace. The kernel merely makes appropriate preparations in /sys/class/firmware/… and an appropriate hotplug script must start then. Refer to linux-2.6.x/Documentation/firmware_class.

The firmware loading is triggered when modprobe is issued.

  1. Connect to AP:
    root:/> modprobe ath9k_htc
    root:/> iwconfig wlan0 essid my_linksys
    root:/> ifconfig wlan0 192.168.3.101 up
    root:/> iwconfig wlan0
    wlan0     IEEE 802.11bgn  ESSID:"my_linksys"  
              Mode:Managed  Frequency:2.437 GHz  Access Point: 00:1A:70:D4:94:C7   
              Bit Rate=1 Mb/s   Tx-Power=20 dBm   
              Retry  long limit:7   RTS thr:off   Fragment thr:off
              Encryption key:off
              Power Management:off
              Link Quality=64/70  Signal level=-46 dBm  
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
              Tx excessive retries:0  Invalid misc:8   Missed beacon:0
    root:/> ping 192.168.3.100
    PING 192.168.3.100 (192.168.3.100): 56 data bytes
    64 bytes from 192.168.3.100: seq=0 ttl=128 time=24.000 ms
    64 bytes from 192.168.3.100: seq=1 ttl=128 time=40.000 ms
    
  2. iperf test:
  • Server side (a Linux PC with Intel WiFi link 5100)
    linux-pc:/$ iwconfig
    wlan0     IEEE 802.11abgn  ESSID:"my_linksys"  
              Mode:Managed  Frequency:2.437 GHz  Access Point: 00:1A:70:D4:94:C7   
              Bit Rate=1 Mb/s   Tx-Power=15 dBm   
              Retry min limit:7   RTS thr:off   Fragment thr=2352 B   
              Power Management:off
              Link Quality=100/100  Signal level:-22 dBm  Noise level=-83 dBm
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
              Tx excessive retries:0  Invalid misc:0   Missed beacon:0
    
    linux-pc:/$ ./iperf -s
    ------------------------------------------------------------
    Server listening on TCP port 5001
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    
  • Client side
    root:/> iperf -v
    iperf version 2.0.4 (7 Apr 2008) pthreads
    
    root:/> iperf -c 192.168.3.100 -i 1------------------------------------------------------------
    Client connecting to 192.168.3.100, TCP port 5001
    TCP window size: 16.0 KByte (default)
    ------------------------------------------------------------
    [  5] local 192.168.3.102 port 43562 connected with 192.168.3.100 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  5]  0.0- 1.0 sec    712 KBytes  5.83 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  1.0- 2.0 sec    672 KBytes  5.51 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  2.0- 3.0 sec    736 KBytes  6.03 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  3.0- 4.0 sec    656 KBytes  5.37 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  4.0- 5.0 sec    632 KBytes  5.18 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  5.0- 6.0 sec    616 KBytes  5.05 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  6.0- 7.0 sec    752 KBytes  6.16 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  7.0- 8.0 sec    688 KBytes  5.64 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  8.0- 9.0 sec    720 KBytes  5.90 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  9.0-10.0 sec    392 KBytes  3.21 Mbits/sec
    [ ID] Interval       Transfer     Bandwidth
    [  5]  0.0-10.0 sec  6.42 MBytes  5.39 Mbits/sec