Tuesday, February 16, 2010

How to bring up WIFI connection on Embedded Linux

This is how I bring up the wlan connection up on a mini2440 dev board running Linux by using command lines.

The hardware board is a Sumsung ARM9 based dev board running Linux kernel 2.6.29. The wifi card is a TP-Link WN321G usb adapter.

First of all, I have to make sure the driver is compiled into the kernel. The driver for this adapter is "Ralink rt2501/rt73 (USB) support". This is what I chose when I configure the kernel before building it.

When the system boots up, I see something like this:

[root@FriendlyARM /]# usb 1-1: new full speed USB device using s3c2410-ohci and
address 2
usb 1-1: New USB device found, idVendor=148f, idProduct=2573
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1: Product: 54M.USB.......
usb 1-1: Manufacturer: Ralink
usb 1-1: configuration #1 chosen from 1 choice
wmaster0 (rt73usb): not using net_device_ops yet
wlan0 (rt73usb): not using net_device_ops yet

This is enough to tell that the card is detected by the system.

Then the following commands are used to bring the connection up:
ifconfig eth0 down --->bring down the ethernet interface
ifconfig wlan0 up --->bring up the wifi interface
iwlist wlan0 scanning | grep ESSID ---> scan the essids of available wifi network (option)
iwconfig wlan0 key "ABCD..." --->this is the key for secured wifi network. I'm using a 128bit WEP, so the key is a 26 digits HEX. For text key, you can use:
iwconfig wlan0 key s:"text passwd"
iwconfig wlan0 essid "Home AP" --->set the wifi network to connect to
iwconfig wlan0 ap auto --->connect to the wifi network
ifconfig wlan0 192.168.1.15 ---->set the IP of the wifi interface. (don't have to do this if you are using dhcp)

After all of these, use ping to see if you are connected or not.

Looks like the WN321G is not very sensitive to signals. So if you are not connected and you are sure you have followed the commands, try a different location where signal is stronger.

These process can be intergrated into the system's startup scripts. It'll be in /etc/init.d/rcS file for mini2440.



1 comment:

  1. Hi Honeybee i am using mini2440, now i want test wifi on my device so installed driver but i dont have wlan configuration script.

    How to create script ....Please help me

    ReplyDelete