cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Errors

Posted on July 26, 2017 at 16:02

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 #can
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 REPLY 1
Erwan YVIN
ST Employee
Posted on August 08, 2017 at 10:41

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 Flag

If the WRN_EN bit in MCR is asserted, the TWRN_INT bit is set when the TX_WRN flag transition

from ‘0’ to ‘1’, meaning that the Tx error counter reached 96. If the corresponding mask bit in the

Control Register (TWRN_MSK) is set, an interrupt is generated to the CPU. This bit is cleared by

writing it to ‘1’. Writing ‘0’ has no effect.

1 = The Tx error counter transition from < 96 to  96

0 = No such occurrence

RWRN_INT

RWRN_INT �? Rx Warning Interrupt Flag

If the WRN_EN bit in MCR is asserted, the RWRN_INT bit is set when the RX_WRN flag transition

from ‘0’ to ‘1’, meaning that the Rx error counters reached 96. If the corresponding mask bit in the

Control Register (RWRN_MSK) is set, an interrupt is generated to the CPU. This bit is cleared by

writing it to ‘1’. Writing ‘0’ has no effect.

1 = The Rx error counter transition from < 96 to  96

0 = No such occurrence

  Best regards

              Erwan