Error Detection techniques in CAN bus protocol

Error Detection techniques in CAN

CAN uses many ways to detect errors on the bus. There are majorly five error detection techniques in CAN bus protocol. These include Bit Monitoring, Bit Stuffing, Cyclic Redundancy Check (CRC), Frame Check, and Acknowledgment Check. Each technique contributes to robust error detection by ensuring data integrity, synchronization accuracy, and correct message formatting during transmission.

Checksum Error (CRC error)

The transmitting ECU’s CAN controller calculates a checksum over all bits of the message and sends a checksum in the CRC field. Each receiving ECU also calculates the checksum and compares it to the transmitter’s checksum. The system detects a CRC error if there is a mismatch.

This mechanism ensures that even single-bit errors during transmission can be detected with high reliability.
Upon detecting a CRC error, the receiver generates an error frame to notify all nodes on the bus, prompting the message to be re-transmitted.

Example: Suppose an ECU transmits a CAN frame with the correct data, but due to electrical noise during transmission, one bit flips in the data payload. The receiver’s computed CRC will differ from the one sent by the transmitter, causing a CRC mismatch. As a result, the receiver sends an error frame, and the transmitter re-sends the message to ensure data integrity.

Error Detection techniques in CAN bus protocol

Frame check (Format error)

Frame check is another error detection techniques in CAN protocol. Transmitting (Tx) and receiving (Rx) ECUs check if the frame format is correct. For example, the system detects a dominant (0) bit in the EOF field, which should contain all recessive bits.

Other format violations include incorrect bit lengths in the arbitration, control, or CRC delimiter fields.
When such discrepancies are detected, an error frame is triggered, and the faulty message is discarded and reattempted to maintain bus integrity.

Example: Imagine a situation where an ECU transmits a message, but due to a timing issue or a malfunctioning transceiver, the End of Frame (EOF) field contains a dominant bit instead of the expected recessive bit sequence. The receiving ECUs recognize this format violation and immediately send an error frame, signaling that the message was malformed and must be resent.

Acknowledge (ACK) check

Every receiver ECU that has performed a CRC check successfully overwrites the ACK bit (1) with a dominant bit (0). If the transmitter does not detect a dominant bit in the ACK slot, it assumes that no node received the message correctly. This triggers an error handling process, prompting the transmitter to resend the message after a retransmission delay.

Example: Suppose an ECU transmits a CAN message during system initialization, but all other nodes are still in sleep mode or disconnected. Since none of the receivers are active to acknowledge the message, the transmitter observes a recessive bit in the ACK slot. It then triggers an error frame and schedules the message for retransmission once the bus becomes active again.

Bit Monitoring

Another error detection techniques in CAN frame is Bit Monitoring. Every ECU transmitting CAN messages also monitors the CAN bus. Therefore the transmitting ECU also receives its own message. The system detects a bit error if a transmitted bit differs from a received bit. This mechanism is particularly effective for detecting faults caused by short circuits, electromagnetic interference, or malfunctioning transceivers.

If a discrepancy is found during transmission, the ECU immediately sends an error frame and initiates retransmission of the corrupted message.

Example: Consider an ECU transmitting a CAN message with a recessive bit during the arbitration phase. Due to a wiring fault or noise, the bit is distorted and appears dominant on the bus. Since the transmitted bit does not match the observed bit, the ECU detects a bit error, sends an error frame, and schedules the message for retransmission to ensure accurate communication.

Bit Stuffing and Resynchronization

CAN uses NRZ (No Return to Zero) for bit coding. When the level does not change for more than 5 bits, the transmitter adds a complementary bit to the bit stream. These bits are called stuff bits. They must be extracted from the receiver’s data flow. This process is called bit stuffing.

If the receiver detects six consecutive bits of the same level, it flags a bit stuffing error, indicating data corruption.
Bit stuffing also aids in clock re-synchronization between nodes, ensuring proper timing and alignment of the bit stream across the CAN network.

Example: Suppose an ECU sends a message with five consecutive dominant bits followed by a stuffed recessive bit. If the receiver fails to detect and remove the stuffed bit properly due to timing drift or a corrupted clock, it may interpret six dominant bits in a row. This triggers a bit stuffing error, resulting in an error frame and prompting the message to be resent.

Leave a Reply

Your email address will not be published. Required fields are marked *