Howto-BeagleBoard networking

This page describes how to set up USB networking on BeagleBoard.

BeagleBoard

BeagleBoard features OMAP3530 architecture developed by Texas Instruments, presents a number of software accessible on-board devices and comes in two main versions, BeagleBoard and BeagleBoard xM. For both versions, in turn, various revisions exist. For the rest of this howto a BeagleBoard C4 revision is assumed.

While the board features a number of "usual" interfaces and connectors, wireless functionality is unfortunately missing, and there is also no common ethernet- (such as RJ45) connector. Instead, the ethernet functionality is routed via a mini USB-OTG port. This slightly complicates matters if you wish to make the board accessible via a network or get internet access when updating board-software.

There are basically two ways to implement network connection on the beagle. The easiest solution is to attach a WiFI adapter to an USB port and to configure it properly. Another way which does not requite additional hardware is to configure a link to a host and to re-use its (i.e. host's) internet connection.

USB connection

Setup scenario: Ubuntu 12.04 notebook playing a host, BeagleBoard having a valid kernel image, bootloader and a filesystem on a memory card (f.e. Ubuntu: Oneiric, Precise, Quantal)

My host notebook does not come with a RS232 serial port, thus an USB/RS232 adapter (plus cable) is used to establish a serial connection between the board and the host. This will serve for now as a terminal connection to command the beagle. For the "network" an USB cable is required which connects the USB-OTG port on the beagle with one of the USB ports of the host.

NOTE, without power management, and any additional devices attached, a labor power supply indicates a power consumption of nearly 350-400mA (resulting in ca 2W in total). During short peaks, this can raise substantially. Also, reusing the USB-OTG port on the beagle for power-supply and networking did not really work for me. Thus, an external power supply (stabilized 5V/1.5A, preferably switching) is recommended.

Network setup

Here, basically tree main steps are required to be performed. First, static ip addresses for both, the host and the beagle are assigned. For example, assume eth2 being the internet connection of the host and having an (static or DHCP leased) IP of 192.168.1.2. Then, we can assign 192.168.0.15 to the usb0 (concrete name may vary) interface of the host and 192.168.0.14 to the usb0 interface of the beagle.

NOTE, this of course assumes usb0 being up on the beagle (ifconfig, and edit /etc/network/interfaces properly if you wish an automatic activation). So, the content of /etc/network/interfaces may look something like:

# When connecting via USB

- auto usb0

- iface usb0 inet static

- address 192.168.0.15

- netmask 255.255.255.0

- gateway 192.168.0.14

Also NOTE, eth2 and usb0 must not be in the same subnet. This did not work for me and disrupted the internet connection of the host when up-ing usb0.

After this procedure, both, the beagle and the host will be able to ping each other. You can switch from a serial (minicom/picocom/gtkterm) terminal to ssh if you wish. The second step is to specify a server for the name resolution, so that the beagle knows what IP is refered by "google.com" or "c1.complang.tuwien.ac.at". In many home-use cases the nameserver is the same as the gateway. If you do not know the nameserver in use, you can use one of the public ones (such as 8.8.8.8, etc.). Specify the nameserver properly on your BeagleBoard (by editing /etc/resolv.conf), which now may look like:

- domain localdomain

- search localdomain

- nameserver 192.168.1.1

NOTE, that this file is not persistent, i.e. you will need to repeat the change after each reboot. However, this is ok for now and can be changed later. Third and last step now consists of propagating traffic from the real internet interface of the host (i.e. in our case eth2) to the interface we use for communication with the beagle (i.e. usb0 in our case). There are various ways how to do this, here the most common (even if slightly deprecated) way, as suggested by various sites on the web:

- iptables --table nat --append POSTROUTING --out-interface eth2 -j MASQUERADE

- iptables --append FORWARD --in-interface usb0 -j ACCEPT

- echo 1 >> /proc/sys/net/ipv4/ip_forward

This of course assumes usb0 on the host to be up and working. After that your BeagleBoard will be able to communicate with the host and to access the internet.

WiFi connection

First, we need to create a configuration to access a wireless network. For that, create /etc/wpa_supplicant/wpa_supplicant.conf and invoke wpa_passphrase to encrypt your personal password to access the network:

- wpa_supplicant >> /etc/wpa_supplicant/wpa_supplicant.conf

If the name of the network contains spaces, use quotes. Open /etc/wpa_supplicant/wpa_supplicant.conf, you see the name of the network together with an encrypted version of your password have been added. Now complete the setup by providing additional information about your network, f.e.:

- ctrl_interface=/var/run/wpa_supplicant

- ap_scan=1

- fast_reauth=1

- network = {

-    key_mgmt=WPA-PSK

-    pairwise=CCMP TKIP

-    group=CCMP TKIP

-    ssid="Mobsters-WLAN"

-    psk=...

}

You can do 'sudo iwlist scanning' (on your host with working WiFi connection to the same network) to obtain encryption for the WiFi network in question. NOTE, ctrl_interface MUST not refer to /sbin/wpa_supplicant (which is a runable binary) but to an interface file (if it doesnt exist, it will be created automatically).

Having done this, we now only need to open a device interface, which in most cases is wlan0. Similar to the USB setup, open /etc/network/interfaces and provide information for wlan0, f.e.:

- auto wlan0

- iface wlan0 inet dhcp

-    wpa-driver wext

-    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

NOTE, wext is a generic driver which may work for most devices. However, if it obviously does not work for you, specify another one (and hope there is a kernel support for it). In my case of a TP-Link WN821N adapter, wpa-driver nl80211 did the trick.

Voila!

Complang
Nikolai Kim
Sitemap
Faculty of Informatics
Vienna University of Technology
top | HTML 4.01 | last update: 2012-08-01 (nkim, Nikolai Kim)