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
UP RUNNING
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:
Link mode: SLAVE ACCEPT
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:

gpsd_2.39-r0.5_armv4t.ipk

gpsd-static_2.39-r0.5_armv4t.ipk

gpsd-gpsctl_2.39-r0.5_armv4t.ipk

gps-utils_2.39-r0.5_armv4t.ipk

libgps18_2.39-r0.5_armv4t.ipk

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

gpsd /dev/rfcomm0

And monitor the output using:

gpsmon

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!

Watch this video on YouTube.

The kernel driver for this is now available here.