cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L496 Resetting CAN TEC/REC Counters

Elliott99
Associate II

I have a system in which the power source to the CAN transceiver interfaced to the on-chip CAN peripheral is common between multiple MCU's vis-a-vis a connector. I have experienced issues wherein if the connection is broken and then re-connected between the multiple nodes, upon reconnection I get an indefinite amount of CAN Error Interrupts firing due to Bit Dominant Errors. I perform the manual reset operation as proscribed in the reference manual (I have ABOM disabled):

"If ABOM is cleared, the software must initiate the recovering sequence, by requesting
bxCAN to enter and to leave initialization mode. Note: In initialization mode, bxCAN does not monitor the CANRX signal, therefore it cannot complete the recovery sequence. To recover, bxCAN must be in normal mode"

However, resetting the peripheral does not reset the REC/TEC counters. To do so, I have seen a possible solution is to enter the peripheral into LOOPBACK mode and just receive frames from "myself" until the counters get low enough the Bus-Off, Error Passive, and Error Active flags are all cleared. 

Is it possible to just disable/re-enable the clock gate to the CAN peripheral to quickly clear these counters?


1 REPLY 1
SofLit
ST Employee

Hello,


@Elliott99 wrote:

However, resetting the peripheral does not reset the REC/TEC counters. 


How did you perform the reset?


@Elliott99 wrote:

To do so, I have seen a possible solution is to enter the peripheral into LOOPBACK mode and just receive frames from "myself" until the counters get low enough the Bus-Off, Error Passive, and Error Active flags are all cleared. 


It could be a possible solution based on error confinement mechanism:

SofLit_0-1731150361925.png

 


@Elliott99 wrote:

Is it possible to just disable/re-enable the clock gate to the CAN peripheral to quickly clear these counters?


No I don't think disabling/enabling CAN clock will reset these counters as the registers keep their values when CAN Clock is disabled. You need to reset the peripheral for that.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.