At the message level:
At the bit level:
Every transmitted message contains a 15 bit Cyclic Redundancy Check (CRC) code. The CRC is computed by the transmitter and is based on the message content. All receivers that accept the message perform a similar calculation and flag any errors.
If a receiver detects an invalid bit in one of these positions a Form Error (also known as a Format Error) will be flagged.
After five consecutive identical bit levels have been transmitted, the transmitter will automatically inject (stuff) a bit of the opposite polarity into the bit stream.
Receivers of the message will automatically delete (de-stuff) such bits before processing the message in any way.
Because of the bit stuffing rule, if any receiving node detects six consecutive bits of the same level, a stuff error is flagged.
The general principle only is described here. More detailed information is available in the ISO standard, and in the data sheets from the device manufacturers.
It's more complex than stated here, but - in principal - receive errors are given a weighting of 1 and are accumulated in a Receive Error Count register; transmit errors are given a weighting of 8 and accumulated in a Transmit Error Count register.
If errors continue to occur, the error counts continue to increase. Any good messages decrement the Error Count registers and, if no further errors are detected, both Error Counts go back to zero.
The accumulated error counts determine the error status of a node.
Error Passive nodes can still transmit and receive messages but are restricted in relation to how they flag any errors that they may detect.
The ISO standard (and some of the device data sheets) explain the precise mechanisms in more detail.
Global errors which occur at all nodes are 100% detectable.
For local errors (i.e. errors which may appear at only some nodes) the CRC check alone has the following error detection capabilities:
The residual (undetected) error probability of the CRC check alone is 3 x 10 to the power -5.
In conjunction with all the other error checking mechanisms, a more realistic value is 10 to the power -11.
Frame Check
There are certain predefined bit values that must be transmitted at certain points within any CAN Message Frame.
Acknowledgement (ACK) Error Check
If a transmitter determines that a message has not been ACKnowledged then an ACK Error is flagged.
Bit Monitoring
Any transmitter automatically monitors and compares the actual bit level on the bus with the level that it transmitted. If the two are not the same, a bit error is flagged.
Bit Stuffing
CAN uses a technique known as bit stuffing as a check on communication integrity.
Error Frame
If an error is detected by any node, using any and all of the five mechanisms described above, the node that detects the error aborts the transmission by sending an Error Frame. This prevents any other node from accepting the message and ensures consistency of data throughout the network.
Error Confinement
Error confinement is a mechanism which is understood to be unique to CAN and provides a method for
discriminating between temporary errors and permanent failures. Temporary errors may be caused by, spurious external conditions, voltage spikes, etc. Permanent failures are likely to be caused by bad connections, faulty cables, defective transmitters or receivers, or long lasting external disturbances.
Error Counts
When an error is flagged, error counts are added to one of two dedicated error count registers within each CAN controller on each node.
Error Active Mode
Nodes usually operate in a state known as Error Active mode. In this condition a node is fully functional and both the Error Count registers contain counts of less than 127.
Error Passive Mode
If the count in either Error Count register in a node exceeds 127, the node will go from Error Active mode to a heightened state of "alert" known as Error Passive mode.
Bus Off Mode
If an error condition persists, such that the Transmit Error Count of a device exceeds 255, the device will take itself off the bus by going to BusOff mode. This means that a permanently faulty device will cease to be active on the bus until reconnected under user control, but communications between the other nodes can continue unhindered.
Error Detection Capabilities
Error detection on CAN is extremely thorough.
* Go back to Intro Page and Main Index