CRC calculation from the Heatbeat messages

Hello,

i try to program my own tranceiver for MAVLink messages.
I started with the heatbeat messages.

I found on net a interesting side

hdr len seq sys cmp id payload (len 9)-------------------------- crc—
0 1 2 3 4 5 6 7 8 9 a b c d e f 10
FE 09 4E 01 01 00 00 00 00 00 02 03 51 04 03 1C 7F

But my CRC calculation is not correct.
I tryed severals online CRC-16/X-25 calculator but i get always other values back.
I know the first byte (0xFE) is no part of the CRC calculation.
I know for the CRC calculation we need byte 1 until byte E.
After this a EXTRA byte (for Heatbeat it is 0x50) must calculated with the resulte from Byte 1 until E to get the compleat CRC16.

Can someone say that i make wrong or where i habe a problem?
Is the sample on the linked homepage maybe wrong?

Thanks

Bernhard

why don’t you take a look at the pymavlink generated C/C++ code?

Hi,
I try but here i got again other values.
I can’t say what is correct.
;-(

Maybe someone has a log file from the serial interface

@wolf4124 did you find a solution to this?

I am trying to build a MAVLink parser myself and I am having similar issues.

No need to build a mavlink parser. Use pymavlink to generate one for you. It support multiple programing languages as well.

1 Like

Am building a Cross-Platform Flutter app to read and display information the Flight Controller.

Flutter uses Dart and, unfortunately, Dart is not one of the supported languages :sob:

Then the easiest way is to add Dart support to pymavlink!

Huh, I didn’t know you could do that.

Do you have any links to some documentation on how I would add Dart support to pymavlink?

You need to take a look at past (merged) PRs that added support for a new language. And then it`s a question of creative copy-and-paste

:+1:

Dart is close enough to Java that I probably don’t need to be too creative :smiley: