2017-07-26 07:02 AM
I've inherited some CAN driver code and I'm looking at the error handling. Currently the only error that is enabled is BO (Bus Off). When this error is seen the CAN peripheral is reinitialized and all error flags in IR are reset. Anybody have any experience with any of the other error flags? Should I enable any of the others? Maybe it's enough to have just BO enabled because eventually any kind of serious error will trip BO??
Thanks.
Mike
#ir #bo #can2017-08-08 01:41 AM
Hello Mike ,
Bus Error is a serious error.
CAN Bus is entering in Bus off
if the Transmit Error Counter exceed 255.
you can check in
ESR field descriptions. (Cf RM0045)
There are some useful
TWRN_INT
TWRN_INT �? Tx Warning Interrupt FlagIf the WRN_EN bit in MCR is asserted, the TWRN_INT bit is set when the TX_WRN flag transitionfrom ‘0’ to ‘1’, meaning that the Tx error counter reached 96. If the corresponding mask bit in theControl Register (TWRN_MSK) is set, an interrupt is generated to the CPU. This bit is cleared bywriting it to ‘1’. Writing ‘0’ has no effect.1 = The Tx error counter transition from < 96 to  960 = No such occurrenceRWRN_INTRWRN_INT �? Rx Warning Interrupt FlagIf the WRN_EN bit in MCR is asserted, the RWRN_INT bit is set when the RX_WRN flag transitionfrom ‘0’ to ‘1’, meaning that the Rx error counters reached 96. If the corresponding mask bit in theControl Register (RWRN_MSK) is set, an interrupt is generated to the CPU. This bit is cleared bywriting it to ‘1’. Writing ‘0’ has no effect.1 = The Rx error counter transition from < 96 to  960 = No such occurrenceBest regards
Erwan