MAVLink CRC
MAVLink services that need to use a Cyclic Redundancy Check (CRC) should choose the CRC32 algorithm described below.
Using the same CRC implementation for all cases means that only one implementation is required. Do not introduce another unless there without a compelling technical reason.
This CRC is used for higher level services (it is not related to the CRC16 used for the checksum in MAVLink serialization).
CRC32 Algorithm
The CRC32 algorithm used by MAVLink is similar to (but different from) the ISO 3309 standard based on the polygon 0x04C11DB7. It is commonly referred to as "the CRC32 based on Gary Brown's work".
The difference of MAVLink's implementation versus the standard are:
- Start at 0 instead of
0xFFFFFFFF
. - Missing final XOR out operation with
0xFFFFFFFF
.
The effects of the initial value and final XOR operation are documented in this brief tutorial on CRC computation of the Linux kernel.
Implementations
This implementation is currently used in:
- File Transfer Protocol (FTP)
- Parameter Protocol > PX4 Implementation (Implementation-specific hash of cached parameters).