Wireless on Raspberry Pi with Buildroot

March 31, 2014

To save some work, I started with RaspberryPi-Buildroot which already has everything needed to build for the Raspberry Pi. This has been my starting point for several projects. Definitely a job well done.

For a USB wireless adapter, I'm using this tiny little thing: Edimax EW-7811Un 150 Mbps Wireless 11n.

So far, I have not had any power issues running completely off USB power without a hub and the connection seems rather stable. Be careful with other wireless adapters that require more power than the Raspberry itself can supply. Remember, the Raspberry uses power as a USB device and then reuses that power to be a USB host. By definition, it can't supply all the power necessary to be a solid USB host.

Assuming you already have basic networking working on the Raspberry, there are a couple more things you need to enable. Enable wireless tools and wpa_supplicant in buildroot.

Screenshot from 2014-03-30 20:57:38.png

Also, you need to enable the necessary wireless support and drivers in the kernel. Beyond the basics, you need CONFIG_RTL8192CU=m for the wireless adapter mentioned.

Here's my basic kernel wireless network configuration.

Screenshot from 2014-03-30 21:09:06.png

Configure the wireless adapter driver.

Screenshot from 2014-03-30 21:16:04.png

Once you have it configured, dmesg should look like this:

$ dmesg
...
[    3.062508] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[    3.174684] usb 1-1.2: New USB device found, idVendor=7392, idProduct=7811
[    3.184709] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.195244] usb 1-1.2: Product: 802.11n WLAN Adapter
[    3.203343] usb 1-1.2: Manufacturer: Realtek
...
[    8.510592] usbcore: registered new interface driver rtl8192cu
...
$ lsmod
Module                  Size  Used by
...
8192cu                452008  0

Now, for the necessary configuration to setup the wireless interface.

/etc/network/interfaces

...
 
auto wlan0
iface wlan0 inet dhcp
    wireless-essid wrt2
    pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant.conf -dd
    post-down killall -q wpa_supplicant
...

Once you know your ssid and password, generate the psk used in the following file by running:

$ wpa_passphrase <ssid> [passphrase]

/etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
 
network={
ssid="<ssid>"
scan_ssid=1
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=<result of wpa_passphrase>
}

Now, you can simply ifup to bring up the interface as necessary.

$ ifup wlan0

A quick iwconfig reveals some of the properties.

$ iwconfig
lo        no wireless extensions.
 
wlan0     IEEE 802.11bg  ESSID:"<ssid>"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.417 GHz  Access Point: 00:XX:XX:XX:XX:XX   
          Bit Rate:54 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          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
 
eth0      no wireless extensions.

This particular wireless adapter has a blue LED (hidden) that you can see flashing when it is in operation.

Here is the Raspberry Pi in full wireless action mounted on a plate discussed in a previous post. Note that I'm using a transparent looking USB extension cable for the wireless adapter for easier access.

IMG_2854.JPG

Related Posts

1 Comment

Comment April 17, 2016 by Mr.Ahmad T
what is it ? I am looking for a wireless usb plugs for my laptop . I had a problem on my laptop usb port. Can you help me please!