Home Contacts Terms Send money


WiFi USB dongle

This article explains how to use a D-Link USB Wi-Fi adapters on your Acme Board.

The USB Wi-Fi adapter tested is:

Check the Kernel configuration

Access to the Kernel configuration panel using make arch=ARM menuconfig command and enable the following items:

Device Drivers  --->
  [*] USB support  ---> 
    <*> USB Wireless Device Management support
Device Drivers  --->
   [*] Network device support  --->    
     [*]   Wireless LAN  --->
       <*>   Realtek rtlwifi family of devices  ---> 
          <*>   Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter
          [*]   Debugging output for rtlwifi driver family (NEW)

Compile the Linux Kernel and reboot the board. To know how to compile the Linux Kernel follow the articles available on the tutorials page index)

Install the Realtek firmware

~# apt-get update
~# apt-get install firmware-realtek

Insert the Wi-Fi USB adapter on your Acme Board. These messages should appear on the debug port or by typing dmesg command:

~# dmesg
usb 2-3: new full-speed USB device number 3 using at91_ohci
usb 2-3: not running at top speed; connect to a high speed hub
usb 2-3: New USB device found, idVendor=2001, idProduct=330d
usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-3: Product: 802.11n WLAN Adapter
usb 2-3: Manufacturer: Realtek
usb 2-3: SerialNumber: 00e04c000001

Please note the idVendor=2001 and idProduct=330d of the USB dongle.

Use this number to tell to Linux which kernel driver to use with it:

~# echo 2001 330d > /sys/bus/usb/drivers/rtl8192cu/new_id
rtl8192cu: Chip version 0x11
rtl8192cu: MAC address: c0:a0:bb:e1:9d:98
rtl8192cu: Board Type 0
rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
root@ariag25:~# usb 2-3: Direct firmware load failed with error -2
usb 2-3: Falling back to user helper
rtlwifi: Loading alternative firmware rtlwifi/rtl8192cufw.bin
rtlwifi: wireless switch is on

When you get the right messages try to type this command:

debarm:~# cat /proc/net/wireless
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
 wlan0: 0000    0.    0.    0.       0      0      0      0      0        0

Install the Wireless-tools

To configure and use the Wi-Fi adapter you need to install the Wireless tools for Linux, a package of Linux commands intended to support and facilitate the configuration of wireless devices.

To install this package type:

debarm:~# apt-get update
debarm:~# apt-get install wireless-tools

When finished type:

debarm:~# iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
wlan0     unassociated  Nickname:"rtl_wifi"
          Mode:Auto  Access Point: Not-Associated   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

which provides info about the wireless extensions of each network adapter (in this case wlan0).

Network configuration

As a first configuration example, we'll show you how to get access to an open Wi-Fi LAN. Edit the file /etc/network/interfaces and add these lines:

auto wlan0
iface wlan0 inet dhcp
  wireless-essid [your_essid] 
  wireless-mode managed 

Restart the network services typing:

debarm:~# /etc/init.d/networking restart
Listening on LPF/wlan0/5c:d9:98:a7:3a:fe                                        
Sending on   LPF/wlan0/5c:d9:98:a7:3a:fe                                        
Sending on   Socket/fallback                                                    
DHCPDISCOVER on wlan0 to port 67 interval 5                     
DHCPOFFER from                                                      
DHCPREQUEST on wlan0 to port 67                                 
DHCPACK from                                                        
bound to -- renewal in 8171 seconds.                                
debarm:~# ifconfig
wlan0     Link encap:Ethernet  HWaddr 5c:d9:98:a7:3a:fe                         
          inet addr:  Bcast:  Mask:        
          inet6 addr: fe80::5ed9:98ff:fea7:3afe/64 Scope:Link                   
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                    
          RX packets:4057 errors:0 dropped:0 overruns:0 frame:0                 
          TX packets:327 errors:0 dropped:0 overruns:0 carrier:0                
          collisions:0 txqueuelen:1000                                          
          RX bytes:287147 (280.4 KiB)  TX bytes:21864 (21.3 KiB)         

Connect to a WEP-protected LAN

Edit the file /etc/network/interfaces and set wireless-key:

auto wlan0
iface wlan0 inet dhcp
  wireless-essid [your_essid]
  wireless-key [your_wep_key]

Restart the network services as in the previous section.

Install the wpa_supplicant for encrypt access

Wpa supplicant is a software implementation of an IEEE 802.11i supplicant for Linux that manages the authentication on the Wi-Fi link.

To install these packages type:

debarm:~# apt-get update
debarm:~# apt-get install wpasupplicant

Now add in the file /etc/network/interfaces the configuration for the wlan0 network adapter to add Wi-Fi Protected Access (WPA) or Wi-Fi Protected Access II (WPA2).

auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid [your_essid]
wpa-ap-scan 2
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk [your_hex_key]

Change the fields [your_essid] with the SSID of your access point and [your_hex_key] with the WPA-PSK key.

To generate a WPA-PSK key from WPA ascii key use this command:

wpa_passphrase [your_essid] [your_ascii_key]

For example on my access point called "acme" that uses the ascii key "netusg20" the command is this:

debarm:/etc/init.d# wpa_passphrase acme netusg20

Copying the psk code the /etc/network/interfaces file becomes:

auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid acme
wpa-ap-scan 2
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk 38c309a773a6c936c31aeb8bcb5bc44d60539715524e77464759f29095bfc1f3

Now type:

debarm:~# /etc/init.d/networking restart

After a while if the dhcp are working well you will obtain your interface up.

You can also detach the eth0 lan cable to try to access your board directly from the Wi-Fi link.

debarm:~# iwconfig wlan0
wlan0     IEEE 802.11bg  ESSID:"acme"  Nickname:"rtl_wifi"
          Mode:Managed  Frequency:2.447 GHz  Access Point: 00:21:29:69:C2:D8   
          Bit Rate:54 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Related links

DWA-131 : D-Link Wireless N Nano Adapter EURO 24.00

D-Link USB WiFi mini adapter.

The packaging could be different than in photo.

How to use it | Product info

WIFI-2 : OEM WiFi USB module EURO 7.00

OEM Small USB 2.0 IEEE 802.11 b/g/n Wi-Fi compliant module based on the RaLink RT5370N chip. It works at 3.3V and can be configured also in Access Point mode.

This model requires an external antenna.

| Product description... |

AN-WIFI-01 : WiFi PCB external antenna EURO 3.50

WiFi PCB antenna with 11 cm cable and UMC 2mm connector to be plugged on WIFI-2 module.

AN-WIFI-02 : WiFi antenna and SMA clable EURO 7.00
  • RF cable with panel mountable SMA connector and UMC 2mm connector to be plugged on a WIFI-2 module.
  • WiFi rubber antenna

Acme Systems srl
Via Aldo Moro 53 - 00055 Ladispoli (RM) - Italy
P.IVA/C.F. 08114831004
Tel + - Fax +39.06.622.765.31
Iscritta al Registro delle Imprese di Roma al n. 08114831004

Atmel© Certified Partner

Acme Systems provides this documentation "as is" without warranty or guarantees of any kind. We not provide any direct support for the Open Source preinstalled software but, through these pages and forum posts, all of the information required to obtain the sources, install, use and update the Open Source software that can be run on the Acme boards. Please note that all of the preinstalled software, used on the Acme Systems products, are Open Source so you have to check the license terms provided by the authors (usually the GPL) before using it in any commercial or non-commercial product, by yourself. Before to contact us please note that WE ARE MAINLY HARDWARE DESIGNERS and NOT LINUX GURUS and therefore could be better to post your questions to the Acme Systems forum and ensure that all of the site contributors and large software community can read and reply to your questions.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.