Explain the five error detection mechanisms in CAN. Why are there five?
CAN implements five independent error detection mechanisms at the protocol level, providing a residual error probability of less than 4.7 x 10^-11 (one undetected error in 1000 years of continuous operation at maximum bus load). Each mechanism catches a different class of fault:
1. Bit Error: After each bit, the transmitter reads the bus and compares it to what it sent. If it sent dominant but read recessive (or vice versa), a bit error is flagged. The exception is during the arbitration field and ACK slot, where reading a different value is expected behavior (arbitration loss and receiver acknowledgment respectively). Bit errors catch transceiver faults and gross bus disturbances.
2. Stuff Error: CAN uses bit stuffing — after 5 consecutive bits of the same polarity, the transmitter inserts a complementary stuff bit. If the receiver detects 6 consecutive same-polarity bits, it flags a stuff error. Bit stuffing ensures enough signal transitions for receiver clock synchronization, and a stuff error typically indicates noise corruption or clock drift.
3. CRC Error: The transmitter computes a 15-bit CRC over the frame content (SOF through data field) using the polynomial x^15 + x^14 + x^10 + x^8 + x^7 + x^4 + x^3 + 1 and appends it. The receiver independently computes the CRC and compares. A mismatch flags a CRC error. This catches any combination of burst errors shorter than 15 bits and virtually all longer error patterns.
4. Form Error: Certain fields in the CAN frame have fixed values — the CRC delimiter, ACK delimiter, and EOF must all be recessive. If any of these fixed-form bits is dominant, a form error is flagged. This catches framing desynchronization and gross protocol violations.
5. ACK Error: After transmitting the CRC, the transmitter drives the ACK slot recessive and checks whether any receiver pulls it dominant. If the ACK slot remains recessive, no node acknowledged the frame — either no receivers exist, or all receivers detected an error. The transmitter flags an ACK error and retransmits.
The reason for five mechanisms is defense in depth. Each one targets a different failure mode — transceiver faults (bit error), clock drift (stuff error), data corruption (CRC), framing loss (form error), and receiver absence (ACK error). Together, they make CAN one of the most reliable serial protocols ever designed for real-time systems.
Source: CAN Q&A
