Howto-BeagleBoard DSP programming

This page renders basics about DSP programming on the BeagleBoard.

Introduction

Ok, this is a tough dog, so conserve your patience, and be sure to have enough of coffee, candies, cigarettes, etc, whatever is suitable to decrease your frustration level.

Basically, you have a choice here. If you want to have a smooth installing/ running system, i can only recommend Ubuntu. Honor to whom honor is due, thank Robert Nelson, which provides great Howto's and scripts, the installation takes time, but saves nerves. Following his advices on the BeagleBoardUbuntu wiki you will install a great working Ubuntu distro with just a couple of scripts. Great. Assuming a necessary kernel configuration, you can optionally create a DSPbridge library which makes it possible to run sample programs. This all will not require you to collect tens of different versions of the same TI-package, and to try building them hard way. Bad news for user-space developers though, as of mid-2012 there is no support for TI's DSP-link and still no clear description/reliable information about how to program the DSP the "easy" way.

An alternative to (great BeagleBoard-) Ubuntu is the well-known Angstrom distro. This distro is built within OpenEmbeeded framework and provides a very flexible way of building and deploying embedded applications. The build process is fully automatized, which includes fetching, compiling, packaging and deploying steps. However, the support is very limited, and usually most you can get are comments like "Please, follow instructions on the 'How to build Angstrom' page.". Not really informative. Angstrom/OpenEmbedded, will allow you to build the latest/stable kernel with DSP-bridge/DSP-link support which will allow you to access and to communicate with the DSP. Thus, for the further description we will concentrate on OpenEmbedded/Angstrom-distro.

First of all we will require a kernel that allows us to load DSP-link modules (which we will create later). Browsing, fetching, patching different versions from different well known locations by hand is extremely tedious, error-prone, with a high probability, that it just "isn't what i hoped it to be". Fortunately, you can avoid this easily, by checking out OpenEmbedded framework first, then Angstrom's setup-scripts, and finally integrating them into the 'angstrom' directory within OE.

Following these instructions and bitbaking ti-dsplink ('bitbake ti-dsplink' :=)) will create all modules (together with the corresponding kernel!) for you. However, you eventually will need to adjust recipes in order for the stuff being built properly. In my case, the source-URI for the TI-codegen tools was wrong (this is because there is officially no free download of them, you will need to register and to login at TI's developer site). If it also happens to you, simply adjust the URI, and be sure it is fetched (source/downloads directory), unpacked (build/.../work/.../ti-cgt_XXXX directory) and the LICENCE.txt is in place. Beside this, the build proceeds (in my case) flawlessly.

If you want to experiment with various (newer) versions of the TI-codegen/ DSP-link/C6Run packages, feel free to do so, the kernel is available in the sysroot directory. But be warned, many versions of the TI-tools (XDCtools, LinuxUtils, LocalPowerManager, DSPBios) are incompatible with each other/ kernel. You will have a hard time to find out the right combo and an even harder one to build C6Run properly so that generated modules work when ran on the beagle. However, if you are successful, integrate changes with OE and contribute!

Addionally, you can create a complete image (for me, console-image was satisfactory) and populate your SD card with the kernel, rootfs and generated modules.

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. Afther 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)