-
Julian Oes authored
The description of the CRC does not seem to match the implementation. The description specifies X.25, however, the code implementing the CRC check does not do the final xor out operation. This means the result is actually the same as CRC-16/MCRF4XX. I found this a while back trying to implement it using a table, and then stumbled on the same observation here: https://discuss.px4.io/t/mavlink-crc-computation-standard-in-mavlink-1/5962 The difference between X.25 and MCRF4XX is just the last xor step: X.25: width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0xffff check=0x906e residue=0xf0b8 name="CRC-16/IBM-SDLC" MCRF4XX: width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0x0000 check=0x6f91 residue=0x0000 name="CRC-16/MCRF4XX" This is based on: https://reveng.sourceforge.io/crc-catalogue/16.htm Here are two links to play around with it: https://godbolt.org/z/brzPs3 https://crccalc.com/?crc=Loremipsumdolorsitametconsectetu&method=crc16&datatype=ascii&outtype=hex
Julian Oes authoredThe description of the CRC does not seem to match the implementation. The description specifies X.25, however, the code implementing the CRC check does not do the final xor out operation. This means the result is actually the same as CRC-16/MCRF4XX. I found this a while back trying to implement it using a table, and then stumbled on the same observation here: https://discuss.px4.io/t/mavlink-crc-computation-standard-in-mavlink-1/5962 The difference between X.25 and MCRF4XX is just the last xor step: X.25: width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0xffff check=0x906e residue=0xf0b8 name="CRC-16/IBM-SDLC" MCRF4XX: width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0x0000 check=0x6f91 residue=0x0000 name="CRC-16/MCRF4XX" This is based on: https://reveng.sourceforge.io/crc-catalogue/16.htm Here are two links to play around with it: https://godbolt.org/z/brzPs3 https://crccalc.com/?crc=Loremipsumdolorsitametconsectetu&method=crc16&datatype=ascii&outtype=hex
Loading