Cyclic redundancy check (CRC) in CAN frames

CAN data frames and remote frames contain a safeguard based on a CRC polynomial: The transmitter calculates a check sum from the transmitted bits and provides the result within the frame in the CRC field. The receivers use the same polynomial to calculate the check sum from the bits as seen on the bus-lines. The self-calculated check sum is compared with the received on. If it matches, the frame is regarded as correctly received and the receiving node transmits a dominant state in the ACK slot bit, overwriting the recessive state of the transmitter. In case of a mismatch, the receiving node sends an Error Frame after the ACK delimiter.

In Classical CAN, a 15-bit CRC polynomial is used (x15 + x14 + x10 + x8 + x7 +x4 +x3 + x0). It features a Hamming distance of six. This means that five randomly distributed bit failures are detectable. The polynomial is also able to detect burst-errors up to 15 bit. However, this is only true for a fixed data length. However, the number of transmitted bits in the CAN frames varies depending on the automatically introduced stuff-bits. This leads to a cut of the Hamming distance to two for some dedicated bit patterns. Still, any single bit-error is detected, and the probability of undetected multiple bit-errors is very low.

Fixed stuff-bits and stuff-bit counter

To improve the error detection capability, the CAN FD protocol has introduced fixed stuff-bits in the CRC field. In the Classical CAN message there are not such fixed stuff-bits. Due the longer frames (more than 8-byte payload), a 17-bit (x17 + x16 + x14 + x13 + x11 + x6 + x4 + x1 + x0) respectively a 21-bit polynomial (x21 + x20 + x13 + x11 + x7 + x4 + x3 + x0) is used. The 21-bit CRC is specified for data frames with a length of larger than 16 byte. In order to detect any single bit-error, an additional safeguard is necessary: the 3-bit stuff-bit counter (SBC). The gray-coded SBC is protected by a parity bit and the following fixed stuff-bit is so-to-speak a second parity bit, because the fixed stuff-bits always have the opposite value of the previous bit.

The safeguards specified for CAN FD frames lowers the probability of undetected faulty messages significantly.

ISO CAN FD and non-ISO CAN FD

The first version of the CAN FD protocol did not provide the SBC (stuff bit counter). It is incompatible to the CAN FD protocol standardized in ISO 11898-1. CiA recommends using the following terminology:

  • ISO CAN FD for implementations compliant to ISO 11898-1:2015
  • Non-ISO CAN FD for predecessor implementations without SBC

Note that non-ISO CAN FD products are still on the market. CiA recommends using only ISO CAN FD products for serial product designs. Nevertheless, you can develop software and test physical layer prototypes using non-ISO CAN FD devices, because the protocol changes are user-transparent. Just a few bits more are transmitted, which are not visible at the user interface. But you should never mix ISO CAN FD and non-ISO CAN FD devices. Of course, if you only transmit Classical CAN frames, it works.