MCAN on MPC5775B: What to do after CAN bus-off? CAN bus-off recovery strategy?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCAN on MPC5775B: What to do after CAN bus-off? CAN bus-off recovery strategy?

Jump to solution
750 Views
peter_vranken
Contributor IV

Dear NXP Team,

This is the first time I write code for the MCAN device. It is basically working but I
wonder how to handle the bus-off. For other device I know a configuration setting like
"bus-off auto-recovery" and I didn't have to write code for a remedial action. The HW
itself did all what is appropriate to re-sync with the bus and start over.

In the RM of the MCAN device (MPC5775B, section 43), I didn't find any word on bus-off
recovery, neither automatic nor as a how-to-do section. So I wonder what is the right
strategy? As a matter of fact, at the moment, not having coded anything particular, the
device is stuck after intentionally caused errors on the bus.

Would it be sufficient to set and reset the init bit, like this:

/* Demand init mode by setting the bit INIT and wait for acknowledge. */
pCanDevice->CCCR |= M_CAN_CCCR_INIT_MASK;
while((pCanDevice->CCCR & M_CAN_CCCR_INIT_MASK) == 0u)
    ;

/* Leave the init mode and let the device re-synchronize with the bus. We need to wait
for the state transition. */
pCanDevice->CCCR &= ~M_CAN_CCCR_INIT_MASK;
while((pCanDevice->CCCR & M_CAN_CCCR_INIT_MASK) == 1u)
    ;

Or what otherwise to do, after a bus-off has been signaled?

 

Kind regards,

Peter

Tags (3)
0 Kudos
1 Solution
737 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I think steps are given in the note in PSR register description.

PetrS_0-1679997968255.png

BR, Petr

View solution in original post

0 Kudos
2 Replies
738 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I think steps are given in the note in PSR register description.

PetrS_0-1679997968255.png

BR, Petr

0 Kudos
725 Views
peter_vranken
Contributor IV
Thanks for your hint. Bus-off recovery is working well now!
0 Kudos