# Compute check sum method

Hello,

I am not able to clearly understand how to compute the check sum of an hexadecimal trame as the following one:

80 01 00 01 01 01 00 01 03 0E 00 07 01 12
or
37 01 00

Someone could help me with some explanations?

Thank you,
Pm

There are pretty much an infinite possible check sum algorithms so some context is required. What is generating these frames?

The fact that it is displayed as HEX is irrelevant. They are just numbers. They could equally well be displayed as decimal, binary or octal.

...R

Thank you for your answer.
I need to calculate the checksum to set parameters (baud rate and sample rate) of a Venus GPS manufactured by sparkfun. The manuel describing the different trames is here : https://www.sparkfun.com/datasheets/GPS/Modules/AN0003_v1.4.14_FlashOnly.pdf

The problem is summerized in the attached picture. When I want change GPS settings I have to sent a new trame and modify the checksum according to the modification. And I am not able to understand how the CS is computed!

Thank you,
Pm

Messages with pre-calculated checksums

Thank you very much,
Pm

The message bytes shown in your original post are identical to “message ID” and “payload” of an example message described in the application note linked in your second post. That example message is labeled, “Software Version,” and it appears on page 33 of the pdf. The checksum shown for that message is 0x98.

The application note says that the checksum is

… the 8-bit exclusive OR of only the payload bytes which start from Message ID until the last byte prior to the checksum byte.

Starting with an initial checksum byte of zero, and XOR’ing each byte of the payload in turn, yields a final checksum byte of 0x98, in agreement with the example.

Surely you’ve tried this already. If you’ll post the code that you used to attempt to calculate the checksum, we might be able to see what’s not working.

@powergravity, please do not cross-post. Thread locked.