Quadcopter part 3: wireless on the beaglebone

UPDATE: It looks like updating the kernel is an easier solution than replacing the RealTek driver, see part 3.1 for more information.
UPDATE 2: The reason that the wireless performance is so poor on my setup, would be (according to the Adafruit site) because of signal interference with the HDMI circuits. The small USB wireless dongles in particular would be very susceptible to this because of their close proximity. See part 3.2 on how I tried to fix it.

In my previous mail I gave you the parts for my quadcopter project. That list also contained this LogiLink NANO WL0085a wireless dongle. These dongles arrived in the mail today, and right away I set out to try one on the beaglebone black boards, the one that I have already flashed with the debian image I found on the beagleboard website.

It was supposed to just work straight out of the box… It didn’t. This post will describe the things I had to do to make it work.

First thing, the dongle needs to be plugged in before you power on the device. For some reason, it won’t be detected when plugged in after bootup.
And secondly, make sure the beaglebone black is powered via the 5V DC connector. I was able to salvage an adapted from an old discarded routed that had the same connector. Although it was only rated for 1.2A, it does seem to power it properly.

Now, the dongle was receiving power, the networking parameters set, and still it wouldn’t connect to the wireless network here at home. So on with the hunt for a solution I first looked for the device information:

root@beaglebone:~# lsusb
Bus 001 Device 002: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

With this in hand, Google points me to website stating that the realtek driver provided in the beaglebone image doesn’t work.

So I download the driver sources from the RealTek Drivers page, and copy the zip file to the beaglebone. I didn’t bother with setting up the whole toolchain and kernel headers on my local machine so I could cross compile a simple loadable kernel module for the arm, I decided it would be easier to set it up on the beaglebone itself, and have it compile there.
Before you are able to compile a kernel module, you also need the linux headers. Normally this would just be an “apt-get install linux-headers-3.8.13-bone50“, but this package doesn’t exist. So I had to go look elsewhere for it. And here it is: linux-headers-3.8.13-bone50_1.0precise_armhf.deb. Just install if like you would install any other debian package: “dpkg -i xxxxxx.deb“.

Back to the Realtek driver directory, there is a subdirectory called “driver”, cd into it, and unpack the tar ball. cd into the extracted directory and type in “make ARCH=arm“.

Error.

root@beaglebone:~/Projects/quadcopter/debian_image/realtek_driver/RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/driver/rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911# make -C /lib/modules/3.8.13-bone28/build M=/root/rfm12b-linux modules
make[1]: Entering directory `/usr/src/linux-headers-3.8.13-bone28'
CC [M] /root/rfm12b-linux/rfm12b.o
In file included from include/linux/timex.h:65:0,
from include/linux/jiffies.h:8,
from include/linux/ktime.h:25,
from include/linux/timer.h:5,
from include/linux/workqueue.h:8,
from include/linux/srcu.h:34,
from include/linux/notifier.h:15,
from include/linux/memory_hotplug.h:6,
from include/linux/mmzone.h:761,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /root/rfm12b-linux/rfm12b.c:20:
/usr/src/linux-headers-3.8.13-bone28/arch/arm/include/asm/timex.h:18:24: fatal error: mach/timex.h: No such file or directory

A discussion I found online (here) suggested I just create an empty timex.h file in the linux headers, because it serves no purpose anyway:

root@beaglebone:~# cd /usr/src/linux-headers-3.8.13-bone50/arch/arm/include/
root@beaglebone:/usr/src/linux-headers-3.8.13-bone50/arch/arm/include# mkdir mach
root@beaglebone:/usr/src/linux-headers-3.8.13-bone50/arch/arm/include# touch mach/timex.h

The code compiles, run “make install” to install the module and blacklist the old ones like so:
cd /etc/modprobe.d
echo "install rtl8192cu /bin/false" >wifi_blacklist.conf
echo "install rtl8192c_common /bin/false" >>wifi_blacklist.conf
echo "install rtlwifi /bin/false" >>wifi_blacklist.conf

I rebooted the board, and there I had it: a wireless connection! But results are still a bit depressing. It is very slow, and it occasionally drops out. I read elsewhere online that later versions of the kernel (>=3.12) should work alot better, but I’m not sure whether there is a beaglebone standard image available for that. Maybe I have to cook my own instead, and set up a buildroot (or something) instead.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.