Template:FAQ/Questions/Flockbot serial daemon

What can I do with the GPS data on the gumstix?
If you already have a console connection to your gumstix and you just want to see the NMEA (ASCII text) data coming out of the GPS receiver, you can simply issue the built-in cat command for gumstix serial port /dev/ttyS2, as follows:

cat /dev/ttyS2

You may have to kill (Ctrl+C) and re-issue the command one or more times until you get a stream of NMEA messages of the form:

$GPRMC,011220.00,A,3902.19515,N,07723.09203,W,0.665,73.52,280207,,,A*4D $GPVTG,73.52,T,,M,0.665,N,1.232,K,A*09 $GPGGA,011220.00,3902.19515,N,07723.09203,W,1,06,1.81,108.7,M,-33.4,M,,*6F $GPGSA,A,3,14,12,22,09,11,18,,,,,,,2.64,1.81,1.92*06 $GPGSV,3,1,11,01,21,277,23,14,60,312,31,30,31,130,,31,27,219,16*72 $GPGSV,3,2,11,12,32,088,26,22,84,120,40,21,02,174,,09,20,046,22*7F $GPGSV,3,3,11,11,05,320,30,18,47,130,25,05,36,096,23*4F $GPGLL,3902.19515,N,07723.09203,W,011220.00,A,A*73 $GPZDA,011220.00,28,02,2007,00,00*6B

Ignore any messages of the form:

$GPTXT,01,01,01,NMEA unknown msg*58

as they are an artifact of using the cat command in this environment (it appears that the cat command or something else is sending data to the GPS receiver that it can't deal with).

Refer to the gpsd project's list of NMEA sentences if you need to manually parse the GPSstix NMEA sentences into meaningful data fields.

The cat command has limited usefulness in most situations, however. If you want to process the GPS data on the gumstix itself, you will have to write your own software or use some existing software. Open-source GPS-related applications that have been ported to the gumstix (ARM) architecture and can use GPS data are:

gpsd:

gpsd is a service daemon that can talk to a GPS receiver, parse and collect the data, and distribute the data to other applications. The gumstix Buildroot includes the gpsd Package, ready to build into the root filesystem. To start gpsd on the gumstix and then view the NMEA data stream using the gpspipe client, enter the following commands:

gpsd -n /dev/ttyS2 gpspipe -r

ntpd:

ntpd is a Network Time Protocol (NTP) service daemon that also includes "reference clock drivers" for various types of locally-connected GPS receivers. NTP can accurately set and maintain gumstix system time based on GPS data. The gumstix Buildroot includes the ntp Package, ready to build into the root filesystem, and Steve Falco has a NTP Clock project on this Wiki.

GPSTk:

The GPS Toolkit (GPSTk)application is an open-source, general-purpose, suite of GPS library functions and data-processing that can operate on data supplied by the GPSstix or other GPS receivers. There is a page on this Wiki that give further details here.

How can I redirect the GPS receiver serial port to/from Bluetooth or a network?
If you want to view and use the GPS data (and/or control the GPS receiver) outside of the gumstix/GPSstix (e.g., from an application on a PC or PDA), you will need to redirect gumstix GPS serial port /dev/ttyS2 to the outside world (in/out of the gumstix) over a network connection or a Bluetooth serial connection. There are at least two techniques for this (socat and the Flockbots serialdemon):

socat:

The socat application is a flexible data transfer utility that is included as a Package in the gumstix Buildroot, ready to be compiled. socat is described as follows (from the README file): "socat is a relay for bidirectional data transfer between two independent data channels. ... socat can be used, e.g., as TCP port forwarder (one-shot or daemon), as an external socksifier, for attacking weak firewalls, as a shell interface to UNIX sockets, IP6 relay, for redirecting TCP oriented programs to a serial line, to logically connect serial lines on different computers, or to establish a relatively secure environment (su and chroot) for running client or server shell scripts with network connections ...."

The following command has been verified with socat 1.6.0.0 to redirect the GPS serial port NMEA data to/from the command line (stdin/stdout) - giving a nice, clean display of the NMEA data without the anomalies described for the 'cat' command above:

socat /dev/ttyS2,b9600,raw,clocal=1,echo=0 -

( The "-" at the end of the command is the shortcut for stdio. )

The following procedure has been verified with socat 1.6.0.0 to redirect the GPS serial port over a Bluetooth serial (rfcomm) port to a PC, where the NMEA data was viewed in the VisualGPS application, and UBX data was transferred to/from the GPS receiver using the u-blox u-center application:

Hardware:
 * gumstix connex 400xm-bt, with:
 * Tweener (serial port console so we're independent of other hacking ;)
 * GPSstix (old rev) + passive antenna
 * PC with TRENDnet TBW-104UB Bluetooth USB 2.0 Adapter & BlueSoleil driver

Gumstix Sofware:
 * Buildroot rev 1318
 * socat upgraded to 1.6.0.0, with GOPEN & TERMIOS support added

Bluetooth Configuration: sdptool browse ff:ff:ff:00:00:00 sdptool add --channel=2 SP sdptool setattr 0x010000 0x100 "Ch 1 Serial (getty)" sdptool setattr 0x010001 0x100 "Ch 2 Serial (GPS)" sdptool browse ff:ff:ff:00:00:00 rfcomm -r listen 1 2 & - If a "Gumstix (0)" device is not displayed, F5 to refresh devices - Tools - Configurations - Quick Connect... - Add Gumstix (0) as COM5 - Right-click Gumstix (0), Refresh Services - Right-click Gumstix (0), Connect - Bluetooth Serial Port Service B # ./socat /dev/ttyS2,b9600,raw,clocal=1,echo=0 /dev/rfcomm1
 * On the gumstix, Add a Serial Port (SP) service on channel 2, and run a rfcomm listen service on /dev/rfcomm1 (this leaves the default getty on Bluetooth /dev/rfcom0 alone):
 * On the PC, configure the BlueSoleil Bluetooth environment:
 * On the gumstix, start the GPS serial port redirection:

u-blox u-center Win32 PC Application:
 * Start u-center 4.02
 * Clean up the display (remove gratuitous graphical windows and set up useful windows ;). The following windows are recommended:
 * View - Docking Windows - Data
 * View - Docking Windows - Satellite Level History
 * View - Sky View
 * View - Deviation Map
 * View - Messages View
 * Configure the serial port:
 * Receiver - Port - COM5
 * Receiver - Baudrate - 9600

When you're done you should see a dynamic u-center display that looks like the thumbnail to the right. Now you can use the u-center Messages window to query the GPS receiver for any NMEA and/or UBX message by clicking on the message in the left-hand tree. Once you query for a UBX message that has a corresponding command message (PC to GPS receiver), you can edit the field(s) in the Messages window right-hand pane, then click the 'Send' button at the bottom of the Messages window to send the command to the receiver. u-center and the UBX protocol gives you complete control over the GPSstix receiver as well as detailed receiver internals status.

Flockbots serialdaemon:

The Flockbots serialdaemon (see the bottom of the page) application was created by a group at George Mason University to redirect serial data to/from a network socket. The process to use it with a gumstix/GPSstix was described on the mailing list by gumstix/GPSstix user Landon:


 * "Installed the daemon on my gumstix and fired it up. I already had my configuration working with TCP/IP over bluetooth with the gumstix acting as the BT AP and PC as client.


 * So, after firing up the gumstix serial daemon with the command:

./serialdaemon -serial /dev/ttyS2 -port 5000 -baud 9600


 * Then to test it from my PC that had a active BT link with gumstix, I just did the average:

telnet 192.168.69.2 5000


 * Where the 192.168.69.2 is my gumstix, of course.


 * I could pull the stream of GPSstix NMEA data through a TCP connection which is very convenient.


 * The thing that relates this info to the above text from Alex is that when I connected to the serial using this serial daemon instead of just cat'ing the /dev/ttyS2 is that there were no "unknown NMEA message" GPTXT sentences being spewed by the GPSstix anymore.


 * Something about cat'ing the device that's apparently sending something to the GPSstix that's causing it to burp the unknown NMEA message sentence.


 * Anyway, thanks to the FlockBot people for the serialdaemon code. It seems to work great for the GPSstix over Bluetooth.


 * Landon"

What are some useful PC/PDA-based GPS applications?
If you have managed to redirect the GPS serial port to the outside world, then there are a number of PC/PDA-based software applications that can be used to display, log, and manipulate the gumstix/GPSstix GPS data:

Windows:
 * u-blox u-center GPS Evaluation Software (free) - Indispensible if you want complete control over a u-blox-based GPS receiver (like the LEA-4H on the GPSstix) and/or want to see detailed receiver internal status.
 * VisualGPS (free), VisualGPSXP (shareware) - Displays a graphical GPS constellation sky view (azimuth & elevation), satellite status and position/accuracy statistics. The VisualGPSXP for-pay version supports network connections and has additional displays.

Windows Mobile (Pocket PC):
 * u-blox u-center Mobile GPS Evaluation Software (free) - The PDA version of u-center.
 * VisualGPSce (free) - The PDA version of VisualGPS. Displays a graphical GPS constellation sky view (azimuth & elevation), satellite status and position/accuracy statistics.
 * GPSDash (shareware) - Basic features similar to VisualGPSce, with data charting, moving map, routes, waypoints and time synch features.
 * GPS2Blue (free) - A mult-function PDA app that can redirect Bluetooth GPS data to another computer, log GPS data and synch PDA time.

Open-Source:
 * GPS Manager - A GPS data logger and manager.
 * GPSBabel - A GPS data translation aplication.
 * GpsDrive - Linux/FreeBSD GPS mapping & navigation software.

Note: This is by no means a complete list of all the applications that can use GPS data - in particular this list does not include the large number of mapping and GIS applications.