Article History

December 2011

January 2012↪↩November



Power failure.

Andrew, Liss, and the kids visited.


Started seriously researching what I would need to build my own GPS logger. The three basic parts are a GPS receiver module, a Bluetooth module, and a microcontroller. The uC will manage things (e.g initialisation), send the raw NMEA sentences to the BT module, and write the GPS data to a microSD card.

I started by looking at the OpenLog. It's an SMD ATmega328 on a tiny board and a microSD card socket on the back. But not much is broken out on the small board. So then I thought I could use something bigger and more general, like the Arduino Pro Mini, and just hook up a microSD socket to the same pins. Both the hardware and software are Open Source, so there's no problem with duplicating the functionality in a more accommodating form.

But then I realised a problem with the ATmega chips - they only have one U(S)ART. I want to send and receiver on two channels. There are “soft” serial implementations that can work on any set of general I/O pins, but they require a lot of CPU power and don't really work above about 9600 baud. But the I²C pins are available and I seem to remember JCW making a UART “plug” for the JeeNodes. And look, Sparkfun has a breakout board for an I²C/SPI UART that implements something similar to a 16C450. It has big 64-byte buffers for each direction, and an interrupt pin.

Oh, but the I²C bus is limited to 400 kHz. Estimating that about 4 bytes would need to be transferred to send or receive a byte, that drops the maximum speed to about 100 kbaud. Not quite fast enough for the expected maximum of 115.2 kbaud that may be coming from the GPS receiver when set for 5 fixes per second.

The chip can also operate over SPI, but that's already being used for the microSD socket. That works at up to 2 MHz - plenty of speed. Do I simply need to use a free I/O pin for a second CS (chip select) signal? But will I be able to communicate with the external UART while waiting on the microSD card? This might be messy.

Then I started looking for other microcontrollers to use for this GPS logger; ones with at least two UARTs. Sparkfun has some boards with ARM Cortex-M3-based uC‘s. They all seem to have three U(S)ARTs. I first found some cheapish LPC21xx-based boards. But I investigated how to program them and it ended up bad - they have a JTAG port, but Phillips (NXP) haven’t implemented/documented it properly. Instead, Phillips‘ tools use the serial port to program them. But that’s on Windows, and the free JTAG tools on Linux for the LPC21xx had limitations.

So I looked for other boards and found STM32-based ones. The UARTs can do DMA transfers directly into/from memory, so the serial transfers should be super efficient and reliable if I can get that working. They do work well with JTAG, but the programmers/interfaces are a little pricey. The super-simple one that plugs into the parallel port (!) is $20, while the USB ones are at least $50.

And then there's the compiler/linker/etc issue. All the Arduino stuff is in Debian now, so it's dead simple. Emdebian provides cross-compilers, but only seems to be concerned with targeting machines that can run Linux/GLibC/etc. I found one or two web pages with instructions on building a GNU toolchain for cross-compiling to embedded ARM. I didn't get it to work though.

I'd love to work with embedded ARM processors, but the somewhat-pricey JTAG programmers and complexity of getting a toolchain are a bit of a turn-off.


Found a cheaper STM32F100 board; the STM32F100-HB from “Brave Kit” in Ukraine. Only $15, plus $5.50 postage! I also found some slightly cheaper JTAG adaptors than the Olimex ones on Sparkfun. Still about $50 though.

I investigated the Arduino Mega Pro board, which uses the ATmega2560. This chip has four U(S)ARTS! Plenty! And it's supported by the Arduino environment, so it would be very simple to program. The downside is that it's a rather large board — 9 cm long — with all of the extra I/O pins the chip offers. I don't need them; just enough for two serial ports. And it's not cheap at about $45.

Reading the datasheet for the I²C/SPI UART, I find that my original guess of need to do 4 “byte” transfers just to read or write one byte was actually correct. But additional bytes can be read from/written to the buffers by simply sending acknowledgement pulses, so it's really a 3 byte overhead for any number of bytes. So setting the “trigger level” to 56 characters, the 400 kHz I²C bus could potentially transfer up to 379 kbaud. So the ATmega328-based board using this external UART is looking a little more plausible.

I also investigated the power consumption of the various modules for this GPS logger. The GPS receiver has to be on all the time. The datasheet for it says 29 mA, but the Sparkfun website says 41 mA, which is quite high. To get 24 hours out of a 2000 mAh battery (with 90% efficiency from the boost regulator), I have to get power to around 75-80 mA. So half the power budget is on the GPS receiver module.

The Bluetooth module may consume up to 30 mA in active connection mode. So there goes the rest of the power budget. But wait! There are options to adjust the timing of, or turn off entirely, “inquiry” (discovery) and “page” (connect) windows. And Bluetooth 2.1 added something called “sniff subrating”, where the radio is only on for short windows at set intervals. It can save a lot of power, but only if there isn't too much data being sent, and it has to be negotiated with the connected device.

An ATmega328 running at 8 MHz consumes only 3 mA from 3.3 V. But it will require an external I²C UART, and that adds 6 mA! Also at 8 MHz and 3.3 V, an ATmega2560 consumes 7 mA, while an STM32F100C4T6 may consume around 4-5 mA (it depends what “peripherals” are running).

Went looking on eBay for cheaper JTAG programmers that I can use in Linux with Open Source tools. Even the devices for proprietary software didn't go much below $50. I eventually found a few based on the FTDI 2232 chip, that are supported by OpenOCD. But only a little cheaper than the Olimex ones from Sparkfun. It's surprising, but there's a lot of electronics gear on eBay!


The SSD for Buster finally arrived! But we didn't have any spare SATA data or power cables. So off to Electronic Frontier (Jaycar) for them.

But before I put the drive in, I had to do the mowing. It's long overdue and the weather is again suitable. But we were almost all out of fuel. I mowed almost all of the backyard before it ran out. Dad got more fuel and I finished the backyard before doing the west side and a lot of the front. I was exhausted by then and covered in sweat. When the mower again ran out of fuel (I had only filled to tank to about two thirds), I called it quits. I took the mower around the back, washed it off, and then had a shower myself.

I downloaded an installation image for Debian and put it on a USB flash drive. I booted it in “rescue” mode and partitioned the new SSD, putting /boot (ext3) and root (ext4) filesystems on it, plus a swap partition. I transferred the contents of the old root filesystem from the hard disk. But it wouldn't boot. Ah, the old root fs was ReiserFS (it was a while ago!). So I had to reboot with the flash drive in rescue mode and use a chroot command prompt to build a new kernel containing the ext4 filesystem instead. That mounted the root fs, but didn't seem to get much further. It was late, so I left it at that and went to bed.

Updated to CM 7.1.2 on my Milestone.


Mowed rest of front.


Mum and Dad left in the morning for Paola's wedding in Sydney.


Mum and Dad returned from Paola's wedding. They brought some left-over deserts, yummy!



Some more cleaning up. I did a lot of vacuuming downstairs. While I had a shower, Andrew turned up with his family. They'd brought Mum a birthday card and box of chocolates. We talked and watched silly BLR music videos on the television. Eventually Dad returned with Grandma Tester. He had driven to the Central Coast to pick her up. Then later on Grandpa arrived with Margaret.

We had our usual of Chinese take-away for Mum's birthday dinner. Alissa had to work though, so Andrew and the kids didn't come either.


A late birthday lunch for Mum at Vanilla Bean, this time with Andrew and his family, as well as the grandparents.

I reverted to CM 7.1.1 on my Milestone because I found it wasn't adjusting the display brightness. Using the “GPS Status” app, it appeared to always show 0 lux for the ambient brightness.

I seem to be zeroing-in on the Motorola Atrix for my next mobile phone. It doesn't have a keyboard, but you can get Bluetooth keyboards now. Plus it has a “webtop” feature, which potentially turns this phone into a portable computer. This works with either the multimedia dock and external monitor, keyboard, and mouse, or the “lapdock” to get a netbook with built-in screen, keyboard, and trackpad.

So I went looking on XDA's forums to see what's happening with hacking the Atrix. The good news is that the device is fully unlock-able thanks to Motorola's change of heart about locked bootloaders earlier in the year. Cyanogenmod 7 is in pretty good shape and reportedly improves the performance and battery life of the device a great deal, although it hasn't yet reached the status (quality?) of an “official” device. There's also work on CM9. And there's lots of hacking on webtop to get full Debian, updated Ubuntu, etc.

The bad news is that webtop is not supported in Cyanogenmod. So lots of people are putting up with Motorola's “MotoBlur” launcher and other modifications in order to still be able to use webtop. But apparently people are working on getting it into CM, so it may turn up in some form in the future, maybe even a better form.

So without webtop for perhaps a little while, what are the other advantages of the Atrix? It has a dual-core 1 GHz CPU, 1 GB of RAM, and a nice big 4 inch qHD screen. The other phones I‘ve been interested in lately have been the Google/Samsung Nexus S, and the Sony-Ericsson Xperia Neo. Both only have single-core CPUs with 512 MB of RAM and 800/854×480 displays. They’re both a little lighter, and the Xperia is a little slimmer with its 3.7 inch display. But Sony-Ericsson seems to be totally clueless when it comes to phone docks and doesn't have the best displays. They're also cheaper, but not by much. The Atrix is still looking affordable, especially if I wait a little bit for it to come down more; Atrix ~$360, Nexus S ~$300, Xperia Neo ~$260.


Put up the Christmas tree and a long string of coloured LED lights around the lounge/dining room.

Mowed the back yard after dinner. It was after the sun had set, so I needed some of the outside lights by the end. And by then it was too dark to mow the front. The kids will probably spend some of tomorrow out the back.

Glenn and Tania apparently arrived today, but they didn't visit us.


Christmas day! Everyone soon came over.


After everyone had gone home, Glenn and Tania came over with Anthony and his wife to go find Christmas lights. They were in Anthony's car, following Mum, Dad, Grandma, and myself in our car. We looked at a few places in Kelso before heading over the bridge and spending some time at the council chambers. We checked out Abercrombie and Eglington, before coming back to Windradyne and West Bathurst.


Scott and Shannon arrived in the evening. Andrew and his family had been here a few hours by that time and Dad asked them to have dinner at home. Needless to say, they were not happy about the snub.

I‘m pretty sure it was due to the rowdiness of the kids. I had again been playing with them in the family room and Mum had complained about the noise they made. But did she or anyone else give the children something to occupy them quietly? Did anyone else do *anything* with the kids? No! All they could do was sit on their fat, old arses in the lounge room and shout at them to be quite (and me to keep them quiet). So I wasn’t happy either.


Barbecue lunch in the back yard with everyone.


Grandma left in the morning. Grandpa and Margaret left sometime during the day too. He had a small accident driving over the mountains. He said he'd been stuck behind another car for a while and went to overtake it on the right-hand side when it stopped at an intersection to turn left. Well there was an island there, which he didn't see until it was too late, and a pole in it took off one of his side mirrors. Honestly, he needs to lose his driving license. It'll be a huge blow to his personal freedom and self-esteem, but he's a danger to himself and others on the road. The silly old coot can hardly see anything any more. It's only a matter of time before something worse happens.


Glenn's birthday. We had pizza again for dinner and then ice cream cake.


Scott and Shannon left, back to Canberra.

Mum and Dad weren't originally planning to go down and see the newyears fireworks, but I wanted to go. So we rushed out just after dinner and managed to park on Peel street, in front of one of the houses with Christmas lights we saw on the 26th. We walked down Morrisset street just as the fireworks started. I lost Mum and Dad behind me and continued walking until I was just adjacent to where the fireworks were being fired from. They were exploding above me, very loudly!