Error Detection Mechanism in CAN Communication
- AutoEconnect Sessions
- Mar 18
- 2 min read
Updated: Mar 21

CAN Error Handling & Message Retransmission šš”
In a CAN network, error detection and handling are crucial to ensure data integrity. If a node does not receive an ACK, the message is retransmitted. Letās dive into how errors are detected and managed.
āø»
1ļøā£ Error Detection Mechanisms in CAN
CAN uses multiple error detection techniques:
1. Bit Error:
⢠Each node monitors the bus while transmitting.
⢠If it sends a dominant bit (0) but detects a recessive bit (1), an error is detected.
2. Stuff Error:
⢠To maintain synchronization, after 5 consecutive bits of the same value, an opposite bit is inserted (bit stuffing).
⢠If a node detects more than 5 consecutive bits of the same value, an error is
triggered.
3. CRC Error (Cyclic Redundancy Check):
⢠The sender adds a CRC checksum to the message.
⢠The receiver recalculates the CRC; if it doesnāt match, a CRC error occurs.
4. Frame Error:
⢠Certain fields in the CAN frame must always be recessive (1) (e.g., ACK delimiter).
⢠If a dominant bit is detected in these fields, a frame error occurs.
5. ACK Error:
⢠If no receiver sends an ACK bit (dominant state), the transmitter detects an ACK
error.
āø»
2ļøā£ Error Handling in CAN
When an error is detected, the node follows these steps:
āļø Error Frame Transmission
⢠The node sends an error frame (6 dominant bits) to notify all other nodes.
⢠This forces all nodes to discard the erroneous message.
āļø Automatic Message Retransmission
⢠The sender automatically retries sending the message after detecting an error.
⢠The retransmission happens immediately after the bus is free (unless the node enters
a critical error state).
āļø Error Counters & Bus-Off State
⢠Each node maintains Transmit Error Counter (TEC) & Receive Error Counter (REC).
⢠If TEC > 127, the node goes into Error Passive Mode (still communicates but doesnāt
actively disturb the bus).
⢠If TEC > 255, the node enters Bus-Off Mode, meaning it stops transmitting
completely.
⢠To recover from Bus-Off mode, the node needs to wait and then reinitialize
communication.
āø»
3ļøā£ What Happens If a CAN Node Keeps Failing?
š“ If no receiver sends an ACK, or the message is repeatedly corrupted, the sender will continuously retransmit the message until it enters Bus-Off Mode.
š“ This prevents a faulty node from disrupting the entire network.
āø»
4ļøā£ Summary
ā CAN has robust error detection (Bit Error, CRC, Stuffing, ACK errors, etc.).
ā If an error occurs, the message is discarded, and the sender retransmits it.
ā A node can enter Bus-Off Mode if it continuously fails, preventing it from disturbing the network.


Comments