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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,126 次查看
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

标记 (3)
0 项奖励
回复
1 解答
1,113 次查看
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 项奖励
回复
2 回复数
1,114 次查看
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 项奖励
回复
1,101 次查看
peter_vranken
Contributor IV
Thanks for your hint. Bus-off recovery is working well now!
0 项奖励
回复