While having a GPS-receiver inside your GP2X is nice, it's even more nice if you're able to switch it off: the GP2X isn't that easy on the batteries and the GPS-module adds a 100mA to the usage of the GP2X. I first of all tried finding some unused GPIO to see if I could use that, but to no avail. I then decided to add a microcontroller into the equation: normally, the GPS-module would stay off and the serial line would be free for debugging, but as soon as you set the serial port to 4800 baud and sent a 'magic string', the microcontroller would turn on power to the GPS-module and the serial port would become a GPS-port. That way I could keep the software simple too: non-GPS-aware software doesn't have to be modified and GPS-aware stuff only has to send the magic string first.
I decided on a ATTiny13, because I had these lying around and they're just
8-pin DIP-units with an integrated oscillator. Some hacking and
firmware-programming later, my GP2X looked like this:
My GP2X now is a 3-CPU unit ;)
As far as I know, I'm the first to connect a GP2X to a GPS-device, so the
software for this is a bit... errm... missing. I am planning on creating
some kind of moving-map-thingie tho', using SDL that should be a breeze.
I did test the stuff using some usb-telnet-piping-fifo-gpsd-magic: by
piping the nmea-strings to my PC, I can run software there and test the setup:
I really think I'm completely out of space in my GP2X now :) While I should be able to put in a few more chips, something like an internal GPS-antenna unfortunately can't be fit there. Luckily, I'm not quite sure about what more I can think of to put inthere :)
The GP2Xs processor should have 4 serial ports. 3 of them seem to get detected by the GP2X-kernel: ttyS0, ttyS1 and ttyS2. Unfortunately, I could only get the first one to work: I tried everything I could using stty but the tx interrupt count of the other two ports remained a steady zero, which basically means I don't even have to try and look for the places where I can electrically pick up the signals. Too bad, I'd rather have a dedicated serial port for the GPS-receiver.
If you decide to build this too and want the software for the microcontroller, please drop me a mail. The code hasn't been cleaned up enough for a public release, so I won't put it online till I know there's a demand for it.