The $ and * are just formal parts of the NMEA protocol im not certain that it would be necessary to implement their function into realterm unless you see a reason to make a NMEA mode or something. I have used this function, in the past, to calculate a NMEA checksum for the purpose of comparing with the checksum in the NMEA message. Take the XOR of all bytes between (but not including) the $ and * chars and you get "R" which is printed as two bytes "52" which is the hex representation of "R". I'm not entirely sure why but NMEA and some other protocols take it one step further and convert that checksum byte into a hex value and tack on the 2 ascii chars that make up the hex value to the end of the message instead of the 1 byte. I think alot of simpler microcontroller communications use simple XOR checksums) (This alone may be handy to include in realterm. The most significant character appears first. The hexadecimal result is converted to two ASCII characters (09, AF). The checksum is simply an XOR of every byte in the message. Calculating and Validating NMEA Checksums Error correction and detection in NMEA data is handled through the use of checksums. The checksum is the 8-bit exclusive of all characters in the message, including the commas between fields, but not including the and asterisk delimiters. Here is how the NMEA protocol generates a checksum: After some investigation just now I realized that realterm does not have the option to generate a checksum like the NMEA protocol uses. For this to work you'll need to be using a browser that supports JavaScript and DHTML (most modern browsers do). The checksum is simple, just an XOR of all the bytes between the and the (not including the delimiters themselves), and written in hexadecimal. Sorry, I realize I did explain my feature request poorly. This is a simple calculator to compute the checksum field for the NMEA protocol. Unless one was really paranoid about the CR/LF chars becoming corruptm, that is if realterm's CRC is including those chars in the calculation. Not so hard, right? We need to exclusive OR (XOR) all of the characters (INCLUDING the commas) between the '$' and the '*'.You may be right about it being a bug, im not aware of any cases where CR/LF would be before a CRC. A checksum is required on some sentences. The checksum field consists of a '*' and two hex digits representing an 8 bit exclusive OR of all characters between, but not including, the '$' and '*'. There is a provision for a checksum at the end of each sentence which may or may not be checked by the unit that reads the data. NMEA decided that the two checksum bytes should be equal to the ASCII representation of the value of each of the calculated nibbles from before. The method to calculate checksum is mentioned in the manual of Display as 'CHKSUM: Checksum byte this byte is calculated by taking each byte and XOR’ing all bytes in the message from (and including) the COMMAND byte to the last parameter byte. Programs that read the data should only use the commas to determine the field boundaries and not depend on column positions. This is a simple calculator to compute the checksum field for the MediaTek / ETEK chipsets command extensions to. Here's the main blurb from the NMEA documentation about the checksum and how to calculate it: This is especially important if you plan on writing an application that is reading $GPGGA, $GPGLL or $GPRMC sentences for timekeeping purposes and want to validate the sentence you read for time is legit or not.Īfter reading some documentation on NMEA sentence types and, more importantly, about checksums, the process is actually quite easy and can be coded up fairly easily. Another feature I wanted to add to my NTP/GPS project I'm doing with my Raspberry Pi is to validate the NMEA sentences I'm reading in by checksum'ing the NMEA sentence and comparing it with the XOR checksum provided from the GPS receiver.
0 Comments
Leave a Reply. |