nRF24L01+ wireless transceiver on the mini2440!

Over the festive period Will and I ported Neil MacMillan’s nRF24l01 driver for the Atmel AT90 to the mini2440. Neil has an excellent description of the radio and his driver on his website. The exact series of events are hazy, but they went something like this:

1) Configure SPI and enable a pullup for the IRQ pin in the mini2440 kernel.

2) Modify the spidev module to expose the IRQ using the userspace I/O system.

3) Write new SPI functions to interface between the radio and Neil’s driver.

4) Write a threaded interrupt handler to deal with the IRQ from the radio.

6) Port the driver to an ATmega16 development board and configure this as a receiver for testing.

5) Write a user space program to configure the radio as a transmitter and transmit a test message to the ATmega16 dev board.

We used the following development environment:

..and here are the modules on the dev boards:

The code for all of this (alpha at best) is available here:

The next stage is to improve the speed of the driver. We currently estimate a maximum bandwidth of ~10B/s with jiffies set to 1000 which is a fraction of the true potential. One of the ideas so far is to move the SPI routines, the chip enable toggling and the interrupt handling back into the kernel, and then interface with something like a netlink socket. If anyone has any helpful advice we’d be pleased to hear from you.

More details will be posted on our forthcoming website which is TBA.

Bluetooth GPS on the mini2440 with GPSd

For a long time i’ve had a SiRF 3 bluetooth GPS which i’ve just connected to the mini2440 using a ludicrously cheap USB bluetooth adapter from DealExtreme. Including shipping it cost £1.38 delivered!! Here’s what you get for your money:

The chip is a Conwise CW6626. Anyway, what matters most is that if you have bluetooth configured it works out of the box!

Connecting to the GPS is easy. First check the interface:

hciconfig -a

If it says down bring it up:

hciconfig hci0 up

After executing the above I got the following:

root@mini2440:~# hciconfig -a
hci0:    Type: USB
BD Address: 00:15:83:15:A3:10 ACL MTU: 672:3 SCO MTU: 128:2
RX bytes:348 acl:0 sco:0 events:11 errors:0
TX bytes:38 acl:0 sco:0 commands:11 errors:0
Features: 0xff 0x3e 0x85 0x30 0x18 0x18 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy:
Name: ''
Class: 0x000208
Service Classes: Unspecified
Device Class: Phone, Cordless
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)

Now turn your GPS on and do a scan:

root@mini2440:~# hcitool scan
Scanning ...
00:0D:B5:32:2C:02    BT-GPS-322C02

Now fill in /etc/bluetooth/rfcomm.conf with the details. Here’s mine:

# RFCOMM configuration file.
rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device 00:0D:B5:32:2C:02;

# RFCOMM channel for the connection
channel    1;

# Description of the connection
comment "BT-GPS-322C02";

Next bind the device:

rfcomm bind rfcomm0

And check the device output using:

cat /dev/rfcomm0

Next i bitbaked gpsd, by simply typing:

bitbake gpsd

In my OE installation (see the various posts about setting this up).

Once this builds you can install the appropriate ipks. From memory I think i installed the following:






This pulled in a whole load of other packages. Next you can start gpsd by typing:

gpsd /dev/rfcomm0

And monitor the output using:


If all has gone well you should get a text output of the parsed NMEA data:

Anyway..that’s just the tip of the iceburg. If you want to learn more have a look at the gpsd website and the bluetooth page i have based this post on.

Qt Embedded 4.6.0 + Qwt + kxps5 accelerometer!

After testing the operation of the kxps5 accelerometer with i2c-tools i wrote a test application using the i2c-dev interface. If you want to test your code before you write a kernel driver this is definately a good place to start. Once i had the configuration registers set properly and i had a routine for reading the acceleration vectors I stripped down a ds1621 kernel driver to a bare minimum, and then built it back up again to work with the kxps5. I then bitbaked the kxps5 driver as a kernel module, along with hwmon and it works perfectly! 🙂 Next i cross compiled qwt 5.2.0 and plotted the acceleration as function of time. The video below is taken with antialiased lines which slows down the refresh rate but makes them look nice. If you plot it without this enabled it runs very smoothly. Here you see the kxps5 running without an external low pass filter (the internal filter is 1kHz) and despite this the output is pretty stable. What impressed me the most is the sensitivity. When placed on a desk the free fall interrupt indicator lights up if you drop one of the little nuts from the friendlyarm LCD about 10cm away from the device!


The kernel driver for this is now available here.

Bitbaking the kernel, Angstrom and qt4-embedded all at once

This is what i should have done to begin with! The instructions are very similar to previous ones except this time we clone the right git repository!

On a fresh copy of Fedora 11 I updated the system and installed the packages reccommended by OE:

su -cyum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip
python-psyco perl texinfo texi2html diffstat openjade docbook-style-dsssl
docbook-style-xsl docbook-dtds docbook-utils sed bison bc glibc-devel glibc-static
gcc binutils pcre pcre-devel git quilt groff linuxdoc-tools patch linuxdoc-tools
gcc-c++ help2man perl-ExtUtils-MakeMaker”

I then made a folder called OE in my home directory and git cloned the mini2440 repo:

cd ~

mkdir OE

cd OE

git clone git:// openembedded

I then setup the source-me.txt similar to before:

gedit source-me.txt

I put the following in:

export OETREE="/home/doug/OE"


echo Setting up dev env for Ångström

if [ -z ${ORG_PATH} ] ; then
export ORG_PATH

if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then


export LANG=C

su -c 'sysctl vm.mmap_min_addr=0'

echo "Altered environment for OE Development"

Now all you need to do is setup the local.conf. Simply edit the example and copy it to the right place:

cd openembedded
gedit mini2440_local_conf_example.conf

Read this file and edit as appropriate. I have attached mine as an example. Now copy it to the conf/local.conf

cp mini2440_local_conf_example.conf conf/local.conf

If you want qt4-embedded or any other package included in the build simply edit the recipe in:


I added qt4-embedded:

#Angstrom bootstrap image

IMAGE_PREPROCESS_COMMAND = "create_etc_timestamp"


DEPENDS =  "task-base-extended
esekeyd u-boot-utils tslib
i2c-tools i2c screen rsync nfs-utils
directfb gdbserver directfb mtd-utils

IMAGE_INSTALL = "task-base-extended
psplash-zap qt4-embedded
esekeyd u-boot-utils tslib-calibrate tslib-tests
i2c-tools i2c screen rsync nfs-utils-client
directfb gdbserver directfb mtd-utils
rsvg pango

export IMAGE_BASENAME = "mini2440-image"

inherit image

Then all you have to do is source the script from wherever you put it:

source source-me.txt

and run bitbake:

bitbake mini2440-image

from the ~/OE/openembedded/ directory..

If you get an error trying to build a package try cleaning it:

bitbake -c clean INSERTPACKAGENAME

Then try and build the image again. Maybe you won’t have this problem. I guess it’s either because the checksum parser failed to build or my hdd is dodgy. It only happened once on binutils but worked fine after cleaning it.

A few hours later if all goes well you should have images in:


Obviously that directory depends on what you setup in the local.conf.

Good luck!