[ntp:questions] Sure GPS: Programming it now works

unruh unruh at wormhole.physics.ubc.ca
Wed Apr 6 23:43:13 UTC 2011

On 2011-04-05, Terje Mathisen <"terje.mathisen at tmsw.no"> wrote:
> unruh wrote:
>> On 2011-04-04, Terje Mathisen<"terje.mathisen at tmsw.no">  wrote:
>>> Terje Mathisen wrote:
>>>> I.e. the proper programming setup seems to be:
>>>> 1: Listen to incoming chars.
>>>> 2: After a CRLF sequence, start a timer: If a new char arrives within
>>>> less than 40 ms, goto 1.
>>>> 3: Send '0', start timer waiting for CD to drop.
>>>> 4: If CD drops before any new chars arrive, we are ready to send our
>>>> command, so send it out before the 100 ms gps timeout.

OK, I have now run some experiments with the Sure connected to the USB
port on a linux system, using minicom terminal program. 

a) It works to program the card.

b) The "wait for a break in reception" is not necessary from what I can
see. I watched the lights on the card and tried sending commands both
when the yellow light was on (nmea sentence being sent to the computer)
and off, and it made no difference. 

c) I put the command string into a file. I calculated the checksum of
the command with a little program I wrote and put in the full command,
including the <CR><LF>  (^M^J) (Using ^V^M to generate the <CR>. vi
automatically insers a <LF> at the end of the line. I checked it with
hexedit to make sure tha the <CR><LF> was in the file

Then in minicom, ^AY asks for the file to send, and I selected the file
with the command. The red light on the Sure card blinks when it receives
the command. In addition, the card returns a $PMTK response. 

d) On the USB you are not allowed to change the baud rate ( only on the
serial port apparently). Also the Version number query did not work
($PMTK001,604,1*30 response-- invalid packet)
Whether that is a problem with the USB or with the chip I do not know. 

e) WAAS was on by default. That agrees with my results which showed a 1
sigma error circle of about 1.5m which is what WAAS would give. I do not
know if the SBAS was on by default as I set it befor querying it, but I
suspect it was. 

f) The checksum seems to be needed. I tried a PMTK without the checksum,
and got no response from the unit at all. This is a pain, but the little
checksum program writes it out.

The only problem with doing it this way is that the result sentences are
burried in the 6 sentences per second that the chipset sends out by


#include <stdio.h>
#include <string.h>

int main(int argc, char * argv[])
	unsigned int chk=0;
	int i;
	if(argc<2 || argc>3)
	{fprintf(stderr," Useage chksum <string>\n");
	for (i=0;i<strlen(argv[1]);i++)
		chk ^=argv[1][i];
	printf ( "Checksum= %02X\n",(int)chk);

gcc -o chksum chksum.c
chksum PMTK000
chksum= 32

Somewhat more awkward than Terje's program, but it works.

More information about the questions mailing list