19/10/2009
In the intricate world of modern automotive engineering, the Controller Area Network (CAN) bus stands as the undisputed champion for in-vehicle communication. Its widespread adoption stems from its remarkable efficiency and, crucially, its inherent robustness. This resilience is particularly vital for safety-critical applications, where data integrity is paramount. At the heart of this robustness lies a sophisticated error handling mechanism, designed not just to detect but also to effectively manage and mitigate communication faults. Understanding these mechanisms is not merely academic; it's essential for anyone involved in vehicle diagnostics, maintenance, or system development. When things go awry, be it due to faulty cables, electrical noise, improper termination, or malfunctioning nodes, the CAN bus's ability to identify, classify, and resolve these errors ensures the continued performance and safety of the entire system.

- Understanding CAN Bus Errors
- The Mechanics of CAN Error Handling
- Delving into CAN Error Types
- CAN Node States and Error Counters
- Practical Insights: Generating and Logging CAN Errors
- Troubleshooting Common CAN Bus Issues
- A Brief Look at LIN Bus Errors
- Real-World Applications: Why Log CAN Errors?
- Frequently Asked Questions (FAQs)
Understanding CAN Bus Errors
CAN bus errors are disruptions to the normal communication flow between Electronic Control Units (ECUs) on the network. The CAN protocol is specifically designed to be highly fault-tolerant, meaning it can detect and manage errors without necessarily bringing down the entire system. This advanced error handling identifies and rejects erroneous messages, allowing the sender to re-transmit the data. Furthermore, it helps to identify and even disconnect CAN nodes that consistently transmit faulty messages, preventing them from jamming the bus. This proactive approach is fundamental to the reliability of CAN systems, particularly in the demanding automotive environment.
The Mechanics of CAN Error Handling
Error handling is an integral part of the CAN standard, built directly into every CAN controller. This ensures that every CAN node on the network handles fault identification and confinement identically, leading to a standardised and predictable response to errors. Let's walk through a simplified example to illustrate this complex process.
A Step-by-Step Example of Error Detection
Imagine a scenario where CAN node 1 transmits a message onto the bus. As it sends each bit, it also 'reads back' the signal to verify its transmission:
- CAN node 1 transmits a message onto the CAN bus and simultaneously reads every bit it sends.
- It discovers that one bit it sent as 'dominant' was read back as 'recessive'. This immediately flags a Bit Error.
- In response, node 1 raises an Active Error Flag to inform all other nodes. Practically, this involves sending a sequence of 6 dominant bits onto the bus.
- These 6 dominant bits are seen as a 'Bit Stuffing Error' by the other nodes on the network, as they violate the bit stuffing rule.
- Nodes 2 and 3, upon detecting this, also simultaneously raise their own Active Error Flags.
- This sequence of raised error flags collectively forms part of a 'CAN error frame'.
- CAN node 1, the original transmitter, increases its 'Transmit Error Counter' (TEC) by 8.
- CAN nodes 2 and 3, the receivers, increase their 'Receive Error Counter' (REC) by 1.
- CAN node 1 automatically re-transmits the original message, and this time, it succeeds.
- As a result, node 1 reduces its TEC by 1, and nodes 2 and 3 reduce their REC by 1.
This example highlights several crucial concepts: error frames, distinct error types, and the dynamic nature of error counters and node states. We will delve into these in more detail.
The CAN Bus Error Frame
When a CAN node detects an error, it doesn't just silently record it; it actively signals the error to the entire network by transmitting an 'error frame'. This is a critical mechanism for ensuring network-wide awareness of a corrupted message.
Bit Stuffing Explained
Before understanding error frames, it's important to grasp bit stuffing. This subtle but vital part of the CAN standard dictates that whenever a CAN node sends five consecutive bits of the same logic level (dominant or recessive), it must insert an extra bit of the opposite level. This 'stuff bit' is automatically removed by receiving nodes. Its primary purpose is to ensure continuous synchronisation of the network by guaranteeing regular transitions in the signal, and to prevent long sequences of identical bits from being misinterpreted as error frames or interframe spaces.
Active Error Flags
As per our example, when a CAN node detects an error during message transmission, it immediately transmits a sequence of 6 bits of the same logic level. This sequence is a deliberate violation of the bit stuffing rule, and it's referred to as raising an 'Active Error Flag'. This flag is visible to all CAN nodes, effectively 'globalising' the error discovery. Other nodes will interpret this as a Bit Stuffing Error and, in turn, raise their own Active Error Flags. It's important to differentiate between the 'primary' Active Error Flag (from the node that first discovered the error) and the 'secondary' Active Error Flags (from subsequent reacting nodes). The result is a dominant bit sequence from 6 to 12 bits long, depending on how quickly other nodes react and how their flags overlap.
Here are three common scenarios for active error frames:
- Example 1: 6 bits of error flags. All CAN nodes simultaneously discover an error and raise their flags at the same time. The flags overlap, resulting in a total sequence of 6 dominant bits. This is less common but can occur with Form Errors or specific Bit Errors.
- Example 2: 12 bits of error flags. CAN node 1 discovers a Bit Error and sends 6 dominant bits. Other nodes only detect the Bit Stuffing Error after these 6 bits are read, then raise their own 6 dominant bits, resulting in a total of 12.
- Example 3: 9 bits of error flags. CAN node 1 has already sent 3 dominant bits when it detects a Bit Error and begins its 6 dominant bits. Halfway through, nodes 2 and 3 recognise the Bit Stuffing Error (3 original + 3 new dominant bits) and begin raising their flags. The combined sequence becomes 9 bits long.
The active error frame sequence is always terminated by 8 recessive bits, marking its end. Regardless of where in the original message the error is discovered, the outcome is the same: all nodes discard the erroneous CAN frame, and the transmitting node is then free to attempt re-transmission.
Passive Error Flags
A CAN node can also enter an 'Error Passive' state (which we'll discuss shortly). In this state, it can only raise 'Passive Error Flags'. Unlike active flags, a Passive Error Flag is a sequence of 6 recessive bits. Their impact on the bus differs significantly:
- Example 4: Transmitter is Error Passive. If a transmitting node raises a Passive Error Flag in response to an error, this sequence of 6 recessive bits is detected as a Bit Stuffing Error by other nodes. If these other nodes are still in their Error Active state, they will then raise Active Error Flags (6 dominant bits). So, a passive transmitter can still signal an erroneous frame.
- Example 5: Receiver is Error Passive. If a receiving node raises a Passive Error Flag, it's practically 'invisible' to other nodes. Since dominant bits always 'win' over recessive bits on the CAN bus, the recessive sequence from the passive receiver is simply overwritten by any dominant bits from active nodes. This means an Error Passive receiver loses the ability to destroy frames transmitted by other CAN nodes.
Delving into CAN Error Types
The CAN bus protocol specifies five distinct error types, each indicating a specific kind of anomaly detected on the network. While Bit Errors and Bit Stuffing Errors are evaluated at the bit level, the remaining three are checked at the message level.
Here's a breakdown of the five CAN error types:
| Error Type | Detection Mechanism | Evaluated At |
|---|---|---|
| Bit Error | Transmitter reads back a different bit level than transmitted. | Bit Level |
| Bit Stuffing Error | Receiver detects 6 consecutive bits of the same logical level. | Bit Level |
| Form Error | Receiver finds invalid logical levels in fixed format fields (SOF, EOF, delimiters). | Message Level |
| ACK Error | Transmitter does not read a dominant bit in the ACK slot. | Message Level |
| CRC Error | Receiver's CRC calculation does not match the transmitter's CRC value. | Message Level |
Bit Error
Every CAN node constantly monitors the signal level on the bus. This means a transmitting CAN node also 'reads back' every bit it sends. If the transmitter reads a different data bit level than what it transmitted, it detects this as a Bit Error. Exceptions apply: a bit mismatch during the arbitration process (when sending the CAN ID) or in the Acknowledgement (ACK) slot (where a recessive bit from the transmitter is intentionally overwritten by a dominant bit from a receiver) is not interpreted as a Bit Error.
Bit Stuffing Error
As discussed, bit stuffing requires that after every five consecutive bits of the same logical level, the sixth bit must be a complement. This ensures continuous synchronisation. If a sequence of 6 bits of the same logical level is observed on the bus within a CAN message (specifically, between the Start of Frame (SOF) and Cyclic Redundancy Check (CRC) field), the receiver detects this as a Bit Stuffing Error (or Stuff Error). All CAN nodes automatically remove these extra bits.
Form Error
This message-level check leverages the fact that certain fields or bits within the CAN message must always be of a specific logical level. For instance, the 1-bit SOF must always be dominant, while the entire 8-bit End of Frame (EOF) field must be recessive. Additionally, the ACK and CRC delimiters must be recessive. If a receiver detects that any of these critical bits are of an invalid logical level, it flags a Form Error.
ACK Error (Acknowledgement)
When a transmitter sends a CAN message, it places a recessive bit in the ACK field. All listening CAN nodes that successfully receive the message are expected to send a dominant bit in this field to acknowledge its reception (regardless of whether they are interested in the message's content). If the original transmitter does not read a dominant bit in the ACK slot, it detects this as an ACK Error. This typically indicates that no node on the bus successfully received the message.

CRC Error (Cyclic Redundancy Check)
Each CAN message includes a 15-bit Cyclic Redundancy Checksum field. The transmitting node calculates this CRC value and adds it to the message. Every receiving node also calculates its own CRC based on the received data. If the receiver's CRC calculation does not match the transmitter's CRC value, the receiver detects this as a CRC Error. This indicates that the message has been corrupted during transmission.
CAN Node States and Error Counters
The sophisticated CAN error handling system isn't just about detecting and re-transmitting messages; it also aims to prevent a continuously faulty node from jamming the entire bus. This is achieved through CAN node states and error counters. These mechanisms ensure that short-lived disturbances (like electrical noise) don't result in lost data, but persistent issues lead to a problematic node gracefully reducing its privileges or even disconnecting.
The Three States of a CAN Node
Every CAN controller keeps track of its own state and acts accordingly. There are three possible states for a CAN node:
- Error Active: This is the default state for every CAN node. In this state, the node can transmit data and, crucially, raise 'Active Error Flags' (6 dominant bits) when it detects errors.
- Error Passive: A node enters this state if its error counters exceed a certain threshold. In this state, the CAN node can still transmit data, but it now raises 'Passive Error Flags' (6 recessive bits) when detecting errors. Furthermore, an Error Passive node must wait for an additional 8 bits (known as the Suspend Transmission Time) on top of the standard 3-bit intermission time before it can resume data transmission. This allows other CAN nodes more opportunity to take control of the bus.
- Bus Off: This is the most severe state. If a node's Transmit Error Counter exceeds a very high threshold, it enters the Bus Off state. In this state, the CAN node completely disconnects itself from the CAN bus and can no longer transmit data or raise any error flags. This effectively quarantines a severely malfunctioning node to prevent it from disrupting the entire network.
How Error Counters Influence State
Every CAN node maintains two internal error counters: a Transmit Error Counter (TEC) and a Receive Error Counter (REC). These counters are dynamically adjusted based on the errors detected and the node's role (transmitter or receiver) in the error event.
- A CAN node enters the Error Passive state if either its REC or TEC exceeds 127.
- A CAN node enters the Bus Off state if its TEC exceeds 255.
TEC/REC Counter Dynamics
The rules for increasing and decreasing these counters are precise. For instance, if a CAN node transmits a message and detects a Bit Error (making it the 'discoverer' of the error), its TEC increases by 8. Other nodes that merely receive the resulting Active Error Flag (a Bit Stuffing Error) will increase their REC by 1. This differential increase ensures that a transmitting node that consistently causes errors will quickly escalate through the Error Passive and eventually Bus Off states, isolating the problem. Conversely, if a receiver malfunctions and incorrectly detects errors in valid messages, it might be the one raising a primary error flag, leading to its own TEC increasing.
Successful transmissions or error-free periods will cause the counters to decrease, allowing a node to recover its state if the underlying issue is resolved or intermittent.
Practical Insights: Generating and Logging CAN Errors
Understanding the theory is one thing, but seeing CAN bus faults in action provides invaluable insight. Practical tests demonstrate how different scenarios lead to specific error types and how the CAN bus reacts.
Test Scenarios and Their Implications
These tests highlight common real-world issues and the corresponding CAN bus responses.
Test #1: Absence of Errors
As a baseline, a perfectly functioning CAN bus should show no errors. When a transmitter sends data to a receiver, and both are correctly configured and terminated, the log files should confirm an absence of any CAN errors. This serves as a benchmark for comparison when troubleshooting.
Test #2: Missing Termination Resistor
Termination resistors are crucial for signal integrity on a CAN bus. Removing termination in the middle of a session has an immediate and severe impact. The transmitting node will begin logging Bit Errors as it attempts to send recessive bits but reads dominant ones (due to signal reflection). The receiving node will detect Bit Stuffing Errors because the lack of termination causes sequences of 6 or more consecutive dominant bits. This is a common issue in test bench setups, where termination might be overlooked, leading to confusion as the bus appears inactive or erratic.
| Node Role | Observed Error Type |
|---|---|
| Transmitter | Bit Errors |
| Receiver | Bit Stuffing Errors |
Test #3: Incorrect Baud Rate
Configuring a receiving node with a significantly different baud rate (e.g., 493.827K vs. 500K) from the transmitter causes immediate communication issues. The transmitter will experience ACK Errors, as its timing is out of sync with the receiver's acknowledgment. The receiver, due to misinterpretation of the bit timings, will log Bit Stuffing Errors. Even smaller baud rate discrepancies in real-world scenarios can lead to intermittent frame loss, making precise bit timing configuration vital.
| Node Role | Observed Error Type |
|---|---|
| Transmitter | ACK Error |
| Receiver | Bit Stuffing Errors |
Test #4: Absence of an Acknowledging Node
In a setup where a transmitting node sends frames but there are no other CAN nodes configured to acknowledge them (e.g., all other nodes are in 'silent mode' or disconnected), the transmitter will detect ACK Errors. This causes its Transmit Error Counter to rapidly increase, leading it to raise Active Error Flags. These flags, in turn, are recorded by monitoring devices as Form Errors (specifically, due to dominant bits observed in the EOF field which should be recessive). After a series of retransmissions and flag raising, the transmitter will eventually enter Error Passive mode, and potentially Bus Off, if the issue persists. This is a very common scenario in single-node test setups.
| Node Role | Observed Error Type |
|---|---|
| Transmitter | ACK Errors |
| Receiver (monitoring) | Form Errors |
Test #5: CAN Frame Collisions (No Retransmission)
CAN IDs are designed to be unique, with lower ID values having higher priority. If two nodes transmit frames with the same CAN ID simultaneously, a frame collision occurs. If one of the transmitters has retransmission disabled, both transmitters will detect a Bit Error. They will then raise Active Error Flags, which are seen as Bit Stuffing Errors by receivers. The node with retransmission enabled will attempt to re-transmit and succeed, while the other waits for its next scheduled transmission. This highlights the importance of unique CAN IDs, especially when integrating third-party devices into an existing bus, as collisions can disrupt safety-critical communications.
| Node Role | Observed Error Type |
|---|---|
| USB-to-CAN transmitter | Bit Error |
| CANedge transmitter | Bit Error |
| CANedge receiver | Bit Stuffing Error |
Test #6: CAN Frame Collisions (With Retransmission)
If both colliding transmitters have retransmission enabled, the situation becomes more complex. The initial collision leads to Bit Errors and both nodes raising Active Error Flags (detected as Bit Stuffing Errors by receivers). This triggers a sequence of repeated retransmission attempts from both nodes, creating a 'retransmission frenzy'. Both transmitters will quickly raise their TECs and enter Error Passive mode, stopping active flag raising. Eventually, one transmitter will succeed in sending a full message, which temporarily resolves the jam. However, if the underlying cause (overlapping CAN IDs) isn't fixed, another collision will likely occur shortly after. This demonstrates how effective CAN's error handling is at preventing complete bus jams, even in severe collision scenarios.

| Node Role | Observed Error Type | Initial Count |
|---|---|---|
| USB-to-CAN transmitter | Bit Errors | x 16 |
| CANedge transmitter | Bit Errors | x 16 |
| CANedge receiver | Bit Stuffing Errors | x 16 |
Troubleshooting Common CAN Bus Issues
Encountering CAN bus errors is a frequent occurrence during vehicle development, testing, and even general data logging. The severity can range from a complete communication breakdown to subtle, intermittent message loss. Effective troubleshooting requires a systematic approach.
Here are some common root causes and strategies for troubleshooting:
| Issue Type | Description | Troubleshooting Tips |
|---|---|---|
| Acknowledgement Errors from 'Silent Mode' | Occurs when a single CAN node broadcasts data, but no other node on the bus is configured to acknowledge messages (e.g., external logger in silent mode). Transmitter sees ACK errors and retransmits endlessly. | Disable 'silent mode' on loggers/interfaces in test setups. Consider 'restricted mode' which allows acknowledgment without transmission. For field deployments, silent mode is recommended to prevent interference. |
| Bit Timing Discrepancies | Nodes operate at the same nominal baud rate (e.g., 500K), but subtle differences in their bit timing configuration (sample points, segment lengths) lead to intermittent errors and frame loss. | Ensure all nodes use precisely matched bit timing settings. Consult device documentation for advanced bit rate configuration. An oscilloscope can reveal timing mismatches in waveforms. |
| Physical Layer Issues | Faulty wiring, loose connectors, damaged cables, or incorrect termination resistors. | Visually inspect all wiring and connectors. Check termination resistors (typically 120 Ohms) at both ends of the bus. Use a multimeter for continuity and resistance checks. |
| Electrical Interference (EMI) | External electromagnetic interference from other vehicle systems or poor shielding. | Ensure proper cable shielding and grounding. Investigate potential sources of EMI in the vicinity of the CAN bus wiring. |
| Overloaded Network | Too many messages, or a single device monopolising the bus, leading to congestion and delays. | Analyse bus load percentage using diagnostic tools. Optimise message frequency and prioritisation if possible. |
| Faulty ECUs | A malfunctioning Electronic Control Unit sending corrupted data or failing to communicate correctly. | Isolate suspect ECUs if possible. Check for diagnostic trouble codes (DTCs) related to ECU internal faults. |
Acknowledgement Errors from 'Silent Mode'
One of the most frequent causes of CAN bus errors, particularly for users trying to log data from a single CAN bus node (like a sensor module) using an external logger, is the 'silent mode' feature. If the logger is in silent mode, it does not acknowledge (ACK) any CAN messages. Consequently, if there's only one other node on the test bench network, the transmitting node will never receive an acknowledgment. This leads to continuous ACK Errors, a rapid increase in its TEC, and repeated retransmissions, often filling log files with redundant data or causing apparent communication failure. The straightforward solution in such test scenarios is to disable silent mode on the logger or interface. Some advanced loggers also offer a 'restricted' mode, which allows them to acknowledge messages without actively transmitting their own frames, a useful compromise. For field deployments where a logger is connected to an active vehicle CAN bus, enabling silent mode is generally recommended to ensure the external device does not interfere with the vehicle's safety-critical CAN communication, especially if bit timing is not perfectly matched.
Bit Timing Discrepancies
While connecting a 500K CAN node to a 250K bus will obviously fail completely, a more subtle and frustrating issue arises from small differences in bit timing configuration. Two nodes might both be set to 250K, yet experience intermittent frame loss (e.g., 0-1% of messages) due to slight mismatches in their sample points or segment lengths within the bit. This leads to sporadic CAN bus errors. Resolving this often requires adjusting the advanced bit timing parameters of one of the CAN nodes (e.g., an external logger) to precisely match the existing bus. This ensures optimal synchronisation and reduces error occurrences.
A Brief Look at LIN Bus Errors
Similar to CAN, the Local Interconnect Network (LIN) protocol also incorporates error detection mechanisms, though it is simpler due to its master-slave topology. The CANedge devices, for example, support logging of both CAN and LIN error frames.
| LIN Error Type | Description |
|---|---|
| LIN Checksum Error | A LIN node calculates a different checksum than the one embedded in the LIN frame by the transmitter. Often indicates incorrect frame table configuration in the receiving node. |
| LIN Receive Error | Occurs if a specific part of the LIN message does not match the expected value, or if there's a mismatch between transmitted and read data on the bus. |
| LIN Synchronization Error | Indicates an invalid synchronisation field at the start of the LIN frame, or a large deviation between the node's configured bit rate and the detected bit rate. |
| LIN Transmission Error | Logged for SUBSCRIBER messages if no other nodes respond to the request from the master. |
Real-World Applications: Why Log CAN Errors?
Logging CAN error frames provides invaluable data for diagnostics and troubleshooting in various professional settings.
OEM Prototype Vehicle Diagnostics
Automotive Original Equipment Manufacturers (OEMs) frequently log CAN error frames during late-stage prototype testing in the field. By recording both standard CAN signals (speed, RPM, temperatures) and granular error frame data, engineering teams can troubleshoot complex, intermittent issues that might only occur rarely (e.g., once or twice a month). Standard CAN interfaces are often ill-suited for such long-term, scalable deployments, making dedicated CAN loggers essential for identifying subtle communication layer problems in prototype systems.
Remote Troubleshooting in Machinery
For industrial machinery OEMs or aftermarket users, capturing rare CAN error events in deployed machines is critical. Devices capable of recording CAN data and error frames, and then automatically uploading this data to a cloud server via WiFi or cellular networks, enable remote diagnostics. When errors are automatically identified and alerts sent, engineering teams can immediately begin diagnosing and resolving issues without physically visiting the machine. This significantly reduces downtime and maintenance costs.
Frequently Asked Questions (FAQs)
Should one always log CAN errors?
No, error frame logging is a highly specific functionality. It's primarily relevant during diagnostics by OEM engineers or advanced users when actively troubleshooting communication issues. For typical aftermarket users, or general data logging, it's often not necessary. Furthermore, if systematic errors are occurring, error frames can quickly inflate log file sizes. However, with modern loggers, the ability to enable/disable error frame logging remotely offers flexibility.
Does a CAN logger support all CAN/LIN error types?
Most professional CAN loggers are designed to record all specified CAN and LIN error types. However, they typically do not record their own internal error counter status, as this is usually deemed less relevant for external logging purposes.
Will a CAN logger raise error flags?
A CAN logger's ability to raise error flags depends on its configuration. In its 'normal' mode, where it can also transmit messages, it is capable of raising error flags onto the CAN bus. If configured in 'restricted' mode, it can listen to and acknowledge CAN frames but will not raise Active Error Flags. In 'monitoring' or 'silent mode', it can listen to bus traffic without acknowledging messages or raising Active Error Flags. However, the logger will generally always record any internal CAN/LIN error frames it detects.
What information can be recorded regarding a CAN error?
If a CAN frame is erroneous and results in an error frame, a CAN logger typically records the error type and a timestamp. It generally does not record any data related to the erroneous frame itself. An exception often applies to acknowledgement errors, where the logger might still record the unacknowledged CAN frames, including retransmission attempts.
Is error handling a cybersecurity risk?
Some researchers have indeed highlighted the potential for 'bad actors' to exploit the CAN bus error handling functionality to induce remote 'bus off' events for safety-critical ECUs. This underscores the critical importance of robust cybersecurity measures for CAN bus data loggers and interfaces, especially those with remote data transfer and update capabilities. Secure design is paramount to prevent such malicious exploitation.
If you want to read more articles similar to Demystifying CAN Bus Errors in Automotive Systems, you can visit the Automotive category.
