- Home
- Learn Linux
- Learn Electronics
- Raspberry Pi
- Programming
- Projects
- LPI certification
- News & Reviews
These are the steps involved in getting a Belkin USB network adapter to work on the Raspberry Pi.
I have deliberately done this all on the command line rather than using a GUI application. As this will show some of what is going on behind the scenes.
This is the configuration for a single wireless network. If you are changing wireless networks a lot then you may want to consider a GUI application to manage the wireless connections for you, although that can still be handled via the command line.
This is based on the Raspberry Pi Debian image.
This is for the Wireless G (54Mbps) USB adapter, which has now been superseded by Wireless N adapters. It was a common adapter. Networking adapters can sometimes use the same name, but have a very different chipset. This is for the model with model number F5D7050 and IDP81976-D. I have two of these adapters both of which have identical model numbers. These are still available very cheaply online.
The 802.11g networking standard works at a maximum of 54Mbps although actual throughput will be lower. Which compares with up to 150Mbps for 802.11n. Wireless G adapters will still work with a Wireless N router but will be limited to the speed of G adapter. 54Mbps should be sufficient for most uses (at the time of writing still much faster than most broadband connections), but you may want to consider a faster adapter if streaming HD video over a local network.
The steps may differ depending upon what wireless adapter you have. Whilst Linux has good support for most network adapters some may not work with the Raspbery Pi if there is no support for the ARM architecture.
First to find out the actual chipset and look for errors. These steps are not really required if you know that you have the same chipset. This helps to show some of the investigations in getting a wireless driver working.
First connect the USB adapter. You can see the usb devices connected (on PCs with internal cards then the lspci command provides similar details).
$lsusb
Bus 001 Device 009: ID 050d:705a Belkin Components F5D7050 Wireless G Adapter v3000 [Ralink RT2571W]
Bus 001 Device 008: ID 04ca:0020 Lite-On Technology Corp.
Bus 001 Device 007: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse
Bus 001 Device 006: ID 04cc:1521 ST-Ericsson USB 2.0 Hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
It's obvious which is the Adapter - "Belkin", with Device number 009. The device number is allocated to the device based on the order it was connected or detected by Linux. The key thing to take from this, other than checking it's actually detected, is the part in brackets - indicating that whilst the device is a Belkin product it uses the Ralink RT2571W chipset.
The next thing to check is for any kernel messages. The dmesg command can be used to view the ring buffer which holds the most recent kernel messages. The relevant parts are shown below.
$ dmesg
...
usb 1-1.3.3: new high speed USB device number 9 using dwc_otg
usb 1-1.3.3: New USB device found, idVendor=050d, idProduct=705a
usb 1-1.3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1.3.3: Product: Belkin 54g USB Network Adapter
usb 1-1.3.3: Manufacturer: Belkin
cfg80211: Calling CRDA to update world regulatory domain
usb 1-1.3.3: reset high speed USB device number 9 using dwc_otg
ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
Registered led device: rt73usb-phy0::radio
Registered led device: rt73usb-phy0::assoc
Registered led device: rt73usb-phy0::quality
usbcore: registered new interface driver rt73usb
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
It's clear from these messages that there is a problem with the Firmware.
Firmware is code that runs on the device itself, but to save money, rather than including storage on the device itself it is sent by the driver to the device during initialisation. The issue with Firmware is it is not free software, you don't normally have to pay, but it's not free in the sense of being open source or having the ability to modify it. Therefore it does not meet the requirements to be included in the Debian image.
If you are able to connect the ethernet port to a wired network then do so now (if not instructions are provided later for downloading using another computer). Even if not using the network connection to download the Firmware you may still want to follow the first step.
If you have a different chipset then a Google against your chipset name with the words Linux and Firmware should help find the right package name if there is one available.
Firstly we are going to update the software sources to install packages from the non-free repositories.
nano /etc/apt/sourceslist
Find the Debian entries (If not in the UK then you will probably want to change the hostname for the server):
deb http://ftp.uk.debian.org/debian/ squeeze main contrib
deb http://ftp.uk.debian.org/debian/ squeeze main
change to:
deb http://ftp.uk.debian.org/debian/ squeeze main contrib non-free
deb http://ftp.uk.debian.org/debian/ squeeze main contrib non-free
Then issue:
sudo apt-get update
To update the software list and then
sudo apt-get install firmware-ralink
To install the appropriate firmware for the ralink adapters.
If you don't have an Internet connection on your Pi (which is reasonable considering the point of this is to provide wireless Internet) then you'll need another computer that is.
Download the following file on the other computer:
http://ftp.uk.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-ralink_0.28+squeeze1_all.deb
This needs to be transferred to the Raspberry Pi. This can either be saved to a USB memory stick which is then connected to the Pi - or by saving to the SD card that is used for the Raspberry Pi.
If using a Linux computer to download the package then you can copy it directly into the normal root file system (eg. home/pi). If you are using Windows then it will only allow you to write to the boot partition (/boot). I wouldn't recommend storing anything else in the boot partition, but we can use it just to get this file onto the Pi so that we can get the network connection established.
Install the file using:
dpkg --install firmware-ralink_0.28+squeeze1_all.deb
The firmware-ralink_0.28+squeeze1_all.deb file can now be deleted.
The drivers in the Kernel are compiled as modules which can be loaded as required. This provides a means of supporting many thousands of different drivers without having to load them all directly into the kernel. Normally this works fine and if I inserted my wireless adapter after booting into Debian Linux then it does, but for some reason it did not work with this. I'm not sure the exact reason, but it appears to be that the usbcore module needs to be loaded before the wireless driver.
In this case the wireless driver is loaded through the rt73usb module. The usbcore module needs to load before it loads the rt73usb driver, but that was not happening on my system.
The modprobe program is responsible for loading the kernel modules based on what devices are available on the system. It usually manages on it's own, but can be prompted to load specific modules.
I therefore added the usbcore module to the /etc/modules to ensure it was loaded before the wireless modules.
sudo nano /etc/modules
add the entry
usbcore
before the entry for vchiq (used for the graphics system)
After the module has been loaded you can see the wireless driver in use by using the lsmod command.
$ lsmod
Module Size Used by
arc4 764 2
rt73usb 18768 0
rt2x00usb 6532 1 rt73usb
rt2x00lib 25780 2 rt73usb,rt2x00usb
mac80211 171628 2 rt2x00usb,rt2x00lib
cfg80211 123084 2 rt2x00lib,mac80211
fuse 49036 1
evdev 6404 5
When the driver is active the wireless interface is allocated as wlan0
This can be seen using the iwconfig command:
iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11bg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:on
The wireless details need to be added to the /etc/network/interfaces
sudo nano /etc/network/interfaces
First add the entry to the auto entry so that it is activated when the system starts.
auto lo wlan0
Then add the following at the bottom of the file
iface wlan0 inet dhcp
wpa-ssid
wpa-psk
with he appropriate ssid and wireless key passphrase (without the angled brackets).
This assumes that DHCP is being used.
The iwconfig command can be used to configure the wireless parameters dynamically without needing a reboot.
The ifconfig does the same for the network IP address etc.
If you have any problems then trying to activate using the ifup (interface up) command can be helpful in showing where the problem is:
ifup wlan0
It's also useful to double check what you configured in the files. I spent a few minutes trying to work out why it wouldn't connect before I realised I'd put in the SSID of my old router (replaced over a year ago).
To search for wireless networks
iwlist scan | less
or if you just want to find the SSID
iwlist scan | grep SSID
How to configure the interface for a static IP address instead of a dynamic (DHCP) IP address.