Ralink RT73 USB WiFi Integration: Difference between revisions

From RidgeRun Developer Wiki
mNo edit summary
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<seo title="Ralink RT73 USB WiFi Integration | Integrate a WiFi Dongle" titlemode="replace" keywords="GStreamer, Linux SDK, Linux BSP,  Embedded Linux, Device Drivers, Nvidia, Xilinx, TI, NXP, Freescale, Embedded Linux driver development, Linux Software development, Embedded Linux SDK, Embedded Linux Application development, GStreamer Multimedia Framework."  description="Integrate a WiFi dongle with a LeopardBoard DM365 with this helpful white paper. Check out the hardware, board's driver, wpa configuration and more."></seo>
= Introduction  =
= Introduction  =


Line 24: Line 26:


<br>  
<br>  
[[File:BELKIN_F5D7050.jpg|thumb|center|300px|Figure 1. Belkin F5D7050A dongle. (source: [http://www.belkin.com/IWCatProductPage.process?Product_Id=179211 Belkin])]]
[[File:BELKIN_F5D7050.jpg|thumb|center|300px|Figure 1. Belkin F5D7050A dongle. (source: [https://web.belkin.com/support/ab/c/# Belkin])]]




For our example it will be used a Belkin F5D7050A which uses a Ralink RT73 chipset.
For our example it will be used a Belkin F5D7050A which uses a Ralink RT73 chipset.
= Hardware configuration =
Make sure your hardware is configured in USB host mode.  See [[How to configure DM365 for USB host, device and OTG support]] for details.


= Board's driver configuration  =
= Board's driver configuration  =
Line 106: Line 112:
</pre>
</pre>


Now, your board have been configured in order to detect your wifi dongle, run the '''make''' command and install your images into the board. The next step will be to startup the wireless dongle.
Once you finish the previous steps you must add the wifi adapter's firmware to your file system, that will let the driver to get access to the firmware necessary to start the hardware. In order to do that you must copy the ''rt73.bin'' file into ''/lib/firmware'' and the ''rt73sta.dat'' file into ''/etc/Wireless/RT73STA'' (if the previous folders don't exist you can create them). You can find these files by downloading the wifi dongle's driver, at the time of writing the latest version can be found in [[https://web.belkin.com/support/ab/c/# belkin]].
 
Now, your board have been configured in order to detect your wifi dongle, run the '''make''' command and install your images into the board. The next step will be to configure and startup the wireless dongle.


= Starting up the wireless network =
= Starting up the wireless network =
Once you have your wifi dongle's driver installed successfully the next step is to get it up and begin the wireless transmission. If you want to know if your wifi adapter was installed without errors you can type ''iwconfig'' and then your wifi interface will be shown
<pre>
/ # iwconfig
lo        no wirnet eth0: DaVinci EMAC: ioctl not supported
eless extensions.
eth0      no wireless extensions.
wlan0    IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated 
          Tx-Power=0 dBm 
          Retry  long limit:7  RTS thr:off  Fragment thr:off
          Encryption key:off
          Power Management:on
</pre>
Now you can startup the wireless interface by doing
<pre>
/ # ifconfig wlan0 up
phy0 -> rt2x00lib_request_firmware: Info - Loading firmware file 'rt73.bin'.
rt73usb 1-1:1.0: firmware: requesting rt73.bin
phy0 -> rt2x00lib_request_firmware: Info - Firmware detected - version: 1.7.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 102.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4, CWmax: 5, Aifs: 2, TXop: 188.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10, Aifs: 3, TXop: 0.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10, Aifs: 7, TXop: 0.
</pre>
So, once you type the ''ifconfig'' again you will see your wireless interface up. In order to get your wireless interface running automatically each time your board starts with a specific wireless network you can modify the ''wpa_supplicant.conf'' and ''interfaces'' files as is shown next.
== Setting the wpa configuration ==
The program we will need to connect to the access point is called wpa_supplicant. Supplicant is the IEEE 802.1X/WPA component that is used in the client machines. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver [http://www.pantz.org/software/wpa_supplicant/wirelesswpa2andlinux.html].
You need to configure your wpa supplicant in order to get access into a WPA network which is our case. So, you need to edit the wpa configuration file located in ''/etc/wpa_supplicant/wpa_supplicant.conf'' as is shown below
<pre> 
network={
        ssid="Network_ID"
        key_mgmt=WPA-PSK
        proto=WPA2
        psk="Your_network_password"
        pairwise=CCMP
        group=CCMP
        priority=5
}
</pre>
You only must set the network ''ssid'' and the password to access it. You can see the available wireless networks by typing the ''iwlist scan'' command, this command will show you all the available networks and their characteristics.
== Setting the interface configuration ==
Finally you must edit your ''interfaces'' file in order to get your wireless interface up automatically each time you start you board.
Editing the ''/etc/network/interfaces'' file
<pre>
auto wlan0
iface wlan0 inet dhcp
        pre-up wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -
        post-down killall `pidof wpa_supplicant`
        script /etc/udhcp.script
</pre>
These code lines will automatically startup your wireless interface (called ''wlan0''), run the wpa supplicant's configuration and get an IP address for the connection.
Once you finish editing the files you can restart your board and the wireless interface will be showed up in the ''ifconfig'' prompt and will be ready to start any network transfer.
[[Category:WiFi]]

Latest revision as of 11:32, 25 August 2017


Introduction

This white paper will show how to integrate a wifi dongle with a LeopardBoard DM365. Although the process is given for a specific board and wifi adapter, it is possible to translate it to others boards and wifi adapters.

The wifi dongle used was a BELKIN F5D7050A (shown in Figure 1). Usually no matter the wifi adapter you use, the main characteristic you must know is its chipset model, in the case of BELKIN's adapters discussed there are three chipsets used according with the part number of the dongle:


Table 1. Belkin's chipsets
Part number Chipset used
F5D7050A Ralink RT73
F5D7050B Ralink RT73
F5D7050C Zydas 1211B


Figure 1. Belkin F5D7050A dongle. (source: Belkin)


For our example it will be used a Belkin F5D7050A which uses a Ralink RT73 chipset.

Hardware configuration

Make sure your hardware is configured in USB host mode. See How to configure DM365 for USB host, device and OTG support for details.

Board's driver configuration

In order to get you board ready to run the driver for the wifi adapter you must install some elements from your SDK. You can follow the next steps:

1. Activate the Ralink rt2500 (USB) support option as a module in

       -> Kernel configuration                                                                                                                                                              
         -> Device Drivers                                                                                                                                                                 
           -> Network device support (NETDEVICES [=y])                                                                                                                                      
             -> Wireless LAN (WLAN [=y])                                                                                                                                                   
               -> Wireless LAN (IEEE 802.11) (WLAN_80211 [=y])                                                                                                                             
                 -> Ralink driver support (RT2X00 [=y]) 

2. Activate Generic IEEE 802.11 Networking Stack (mac80211) in

       -> Kernel configuration                                                                                                                                                              
         -> Networking support (NET [=y])                                                                                                                                                   
           -> Wireless (WIRELESS [=y])

3. Selects cfg80211 - wireless configuration API in

       -> Kernel configuration                                                                                                                                                              
         -> Networking support (NET [=y])                                                                                                                                                   
           -> Wireless (WIRELESS [=y])

4. Activate Wireless LAN (IEEE 802.11) in

       -> Kernel configuration                                                                                                                                                              
         -> Device Drivers                                                                                                                                                                  
           -> Network device support (NETDEVICES [=y])                                                                                                                                      
             -> Wireless LAN (WLAN [=y])

5. Selects Minstrel in

        -> Kernel configuration                                                                                                                                                              
         -> Networking support (NET [=y])                                                                                                                                                   
           -> Wireless (WIRELESS [=y])

6. Activate the openssl-0.9.8k option in

       -> File System Configuration                                                                                                                                                        
         -> Select target's file system software

7. Activate wpa_supplicant-0.6.9 in

       -> File System Configuration                                                                                                                                                        
         -> Select target's file system software

8. Activate CRC ITU-T V.41 functions as a module in

       -> Kernel configuration                                                                                                                                                             
         -> Library routines

9. Install the wireless_tools 29 from

       -> File System Configuration                                                                                                                                                         
         -> Select target's file system software

Once you finish the previous steps you must add the wifi adapter's firmware to your file system, that will let the driver to get access to the firmware necessary to start the hardware. In order to do that you must copy the rt73.bin file into /lib/firmware and the rt73sta.dat file into /etc/Wireless/RT73STA (if the previous folders don't exist you can create them). You can find these files by downloading the wifi dongle's driver, at the time of writing the latest version can be found in [belkin].

Now, your board have been configured in order to detect your wifi dongle, run the make command and install your images into the board. The next step will be to configure and startup the wireless dongle.

Starting up the wireless network

Once you have your wifi dongle's driver installed successfully the next step is to get it up and begin the wireless transmission. If you want to know if your wifi adapter was installed without errors you can type iwconfig and then your wifi interface will be shown

/ # iwconfig 
lo        no wirnet eth0: DaVinci EMAC: ioctl not supported
eless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bg  Mode:Managed  Access Point: Not-Associated   
          Tx-Power=0 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

Now you can startup the wireless interface by doing

/ # ifconfig wlan0 up
phy0 -> rt2x00lib_request_firmware: Info - Loading firmware file 'rt73.bin'.
rt73usb 1-1:1.0: firmware: requesting rt73.bin
phy0 -> rt2x00lib_request_firmware: Info - Firmware detected - version: 1.7.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 102.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4, CWmax: 5, Aifs: 2, TXop: 188.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10, Aifs: 3, TXop: 0.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10, Aifs: 7, TXop: 0.

So, once you type the ifconfig again you will see your wireless interface up. In order to get your wireless interface running automatically each time your board starts with a specific wireless network you can modify the wpa_supplicant.conf and interfaces files as is shown next.

Setting the wpa configuration

The program we will need to connect to the access point is called wpa_supplicant. Supplicant is the IEEE 802.1X/WPA component that is used in the client machines. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver [1].

You need to configure your wpa supplicant in order to get access into a WPA network which is our case. So, you need to edit the wpa configuration file located in /etc/wpa_supplicant/wpa_supplicant.conf as is shown below

   
network={
        ssid="Network_ID"
        key_mgmt=WPA-PSK
        proto=WPA2
        psk="Your_network_password"
        pairwise=CCMP
        group=CCMP
        priority=5
}

You only must set the network ssid and the password to access it. You can see the available wireless networks by typing the iwlist scan command, this command will show you all the available networks and their characteristics.

Setting the interface configuration

Finally you must edit your interfaces file in order to get your wireless interface up automatically each time you start you board.

Editing the /etc/network/interfaces file

auto wlan0
iface wlan0 inet dhcp
        pre-up wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0 -
        post-down killall `pidof wpa_supplicant`
        script /etc/udhcp.script

These code lines will automatically startup your wireless interface (called wlan0), run the wpa supplicant's configuration and get an IP address for the connection.

Once you finish editing the files you can restart your board and the wireless interface will be showed up in the ifconfig prompt and will be ready to start any network transfer.