maximum degree of generator polynomial (CRC) in CAN Bus

76 Views Asked by At

I am beginner in CAN and I have one question.

I have seen in documentation that generator polynomial in CRC ist (x^15 + x^14 + x^10 + x^8 + x^7 +x^4 +x^3 + x^0) and amount of Bits for CRC in CAN Bus is 15. So how does it write this polynomial into CAN Data Frame when it has only 15 Bits ? We start with x^0 and ends with x^15 means we need 16 Bits instead of 15. Or does it add automatically x^0 into generator polynomial ?

Thanks in advance

I have searched in Google, but could not find the answer

1

There are 1 best solutions below

0
Mark Adler On

The polynomial of an n-bit CRC is an nth-degree polynomial, and so has n+1 terms. The CRC register is n bits. It is the contents of the CRC register that is written, so 15 bits in this case.

When a bit is shifted out of the register, and that bit is a one, then the polynomial is subtracted (exclusive-ored) from the register and the shifted-out high bit, where the high term of the polynomial (xn) cancels out the bit that was shifted out. This is updates the register-plus-shifted-out-bit to be its modulus of that polynomial. That high bit is always cancelled, so it does not need to be stored, nor sent.

This is analogous to computing an integer sum modulo some number. Let's say modulo 13. Each time you add a small increment to the sum, you see if the result is 13 or more. If it is, you subtract 13.