AnsweredAssumed Answered

How do the error counters work?

Question asked by lpcware Employee on Sep 2, 2016

Every CAN controller has two error counters, one for transmit and one for receive. These error counters
are nearly always made available to read by firmware and when certain events happen there are usually
flags in registers and interrupts that can be triggered to notify firmware.
On every failed receive of a frame the receive counter is increased and on every successful receive it is
decreased. On every failed transmit of a frame the transmit counter is increased and on every successful
transmit it is decreased.
If either counter reaches 127 then the CAN controller enters “error passive” state. This means it cannot transmit error frames as potentially it has an internal problem, and that problem will be disrupting communications on the bus. Also, there will be a larger gap between consecutive sent messages to allow for other communication to happen and not “clog” the bus.
If the transmit error counter reaches 256 then the CAN controller enters “bus off” state. It cannot send frames onto the bus. Typically a complete re-initialization of the CAN controller is required to exit this state.



"FAQ contribution from Embedded Systems Academy, experts in CAN bus. For more information visit"