ECE497 Beagle Bone WiFi

From eLinux.org
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


This wiki is for anyone trying to use a WiFi adapter on the Beagle Bone. It is originally created by Michael Junge, EE senior at Rose-Hulman Institute of Technology, class of 2012. As new information is discovered please feel free to edit this wiki.

Required Hardware

You will need a WiFi adapter from Adafruit. (I had to buy mine, however as the class expands Dr. Yoder pay potentially have a few to hand out for experimentation.)

You will also need the A6 hardware version of the BeagleBone. This does not work with the A5 version. (again at a later date this may not be an issue)

You will finally need the A5 software version of Angstrom found from EBC Exercise 03 Installing a Beagle OS. Again make sure it is the A5 software, this does not work with the A6 Rev.

Finally you will need a 5V BeagleBone power supply. The power supply that comes with the Beagle XM Board is suffient as well.

Required Package Updates

When installing packages do not have the WiFi adapter plugged in.

beagle$ opkg update
beagle$ opkg install linux-firmware-rtl8192cu
bealge$ opkg install wireless-tools

Procedure for running WiFi

You must follow this procedure for enabling the WiFi.

1) Plug in the WiFi adapter (do not plug in an Ethernet cable, it may not work properly)

2) Plug in the usb and connect the BeagleBone to your laptop.

3) Plug in the power adapter for the BeagleBone

4) Connect to the BeagleBone either through screen command or the LAN set up by the usb (for connecting through screen or LAN refer to: EBC Exercise 02 Out-of-the-Box, Bone)

5) Run these lines of code:

beagle$ ifconfig wlan0                 to see what wlan0 currently displays
beagle$ iwconfig wlan0                 to see if wlan0 is configured properly  
beagle$ iwconfig wlan0 essid x         x-your own personal ID
beagle$ iwconfig wlan0 password y      y- your own personal password
beagle$ iwconfig wlan0                 to check if your essid and password are correct
beagle$ ifconfig wlan0 up              to enable wlan0
beagle$ ifconfig wlan0 xxx.xxx.x.x     set to your own private network, usually 192.168.1,x
beagle$ ping xxx.xxx.x.1               to check if your wireless is working correctly
beagle$ ping google.com                to check DNS and Ethernet, because of campus security I have not been able to access DNS

Here is my personal screenshot of being connected to my wireless router as noted by wlan0 instead of eth0. The BeagleBone code is in the white box. My laptop is in red. This screenshot shows WiFi works, however it can be a pain to set up. ECE497 Bone WiFi.png

Ad-Hoc Networks

Ad-Hoc Networks are useful for creating a link between two wifi enabled devices without going through an access point (or through Rose-Hulman's internet). Make sure that your wifi dongle supports Ad-Hoc mode (ibss mode) before purchasing. In order to work properly, Ad-Hoc mode must be set up on both the Beagle and the Host computer (thus taking up the wifi module of the host computer, unless a second wifi dongle is used). There instructions will guide you through the process of setting up both sides.

Beagle Bone Ad-Hoc Network

The basic idea on the Bone side is to set the wireless device to Ad-Hoc mode and then configure the network by giving it a name, password (if desired), setting the frequency, etc. Full details of the iwconfig command can be found [here]. We then have to give the network an IP address in order to use it.

beagle$ iwconfig ra0 mode ad-hoc                        sets the device (ra0 in our case, could be wlan0 or some other device) to ad-hoc mode
beagle$ iwconfig ra0 essid "<ESSID NAME>"               sets the device SSID to the given SSID name (make sure to include quotes around the name)
beagle$ ifconfig ra0 192.168.1.1 netmask 255.255.255.0  sets the IP address for the network (can be anything you want)
beagle$ ifconfig ra0 up                                 brings the network up in case it wasn't (usually it has to be up in order for the above changes to work)

In the future, these settings should be saved to /etc/rc.local or placed in a shell script that we run at startup by creating a service (though that sounds way more complicated), but we haven't set that up yet so the instructions aren't posted here.

If all has gone correctly, you should be able to use the ifconfig command to see:

beagle$ ra0       Link encap:Ethernet  HWaddr 00:0C:43:00:15:3A
                  inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
                  UP BROADCAST MULTICAST  MTU:1500  Metric:1
                  RX packets:51016 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:590 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:1000 
                  RX bytes:11735546 (11.1 MiB)  TX bytes:105576 (103.1 KiB)

Check to see if all the settings are the same as what you set them to.

Host Ad-Hoc Network

The Ad-Hoc network must be set up on the host in addition to the Beaglebone. Note that these settings are not permenant.

host$ iw wlan0 set type ibss                     set our wireless card to Ad-Hoc (ibss) mode
host$ ip link ls                                 list available networks (the SSID of the network we just created above should be visible now)
host$ iw wlan0 ibss join <ESSID NAME> <FREQ>     join the SSID at the given frequency (if the frequency is 2.412 GHz put 2412 [MHz] in for FREQ)
host$ ip addr add 192.168.1.3/24 dev wlan0       assign the host a different IP address on the same general network (change the last digit of the IP address you created above)
host$ ssh root@192.168.1.1                       ssh into the Beaglebone's IP
host$ ...
host$ iw wlan0 ibss leave                        leave the Ad-Hoc network

If this doesn't work, restart and try again, making sure that every step along the way is completed properly. Lastly, if it doesn't work and you have ensured that you have tried the same steps as above, check to ensure that your hardware is in fact compatible (supports ad-hoc networking).

Closing Remarks

I have not been able to figure out how to connect to the campus network. I know it has to deal with wpa supplicant. However at this time, I have not done enough research into wpa supplicant to connect successfully.




thumb‎ Embedded Linux Class by Mark A. Yoder