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

unruh unruh at wormhole.physics.ubc.ca
Tue Apr 5 15:12:32 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:
>>
>> So you  have the code for this program available? Is it really necessary
>
> Sure, but it is very definitely a hack-in-progress:
>
> http://norloff.org/ntp/nmea-mtk/

Thanks.

>
>> to only send the commands in the window while none are received? (eg if
>> you made a mistake and told it to send more commands than can fit into 1
>> sec, there would never be such a window, and you could never correct
>> your mistake-- which seems a crazy way of setting up a system)
>
> Recovery _could_ be based on the "if without power for more than N 
> hours, reset to board defaults" which the Sure board is obviously doing, 
> but I believe you're most probably right.
>
> I did discover by accident that even without sending a '0' and waiting 
> for CD to drop, the commands were still accepted and acknowledged.
>
>> Also do they really demand that you include the hash code at the end? In
>> the garmin that is optional.
>
> I haven't tried without, and it does protect against some line errors, 
> so why not?

because if you are generating the lines by hand and sending it to the
chip via say minicom with the Y option, calculating the checksum is not
trivial. By the way is it everything between the $ and the * or does it
include the $ and *?

>
> The calculation is after all really trivial:
>
> 	len = strlen(buffer);
> 	// Add trailing '*' if missing:
> 	if (buffer[len-1] != '*')
> 		buffer[len++] = '*';
> 	// XOR sum of all bytes, except the first and last:

OK, you are saying, omit the $ and *

> 	unsigned xor_sum = 0;
> 	for (int i = 1; i < len-1; i++)
> 		xor_sum ^= buffer[i];
> 	// Append the hex checksum + CRLF:
> 	sprintf(buffer + len, "%02X\r\n", xor_sum);
> 	len += 4;
>
> Terje




More information about the questions mailing list