CAN Busoff Recovery problems

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

CAN Busoff Recovery problems

1,896 Views
xiaohui200808
Contributor III

Hello

     Iam now use S12ZVC ,theproblem is when Busoff happened  the MSCAN could generate a CANerror interrupt .when busoff selfrecovery  MSCAN will generate an  CANerror interrupt then.  The MCU will enter a cycle :busoff happened 、recovery、busoff happened 、recovery

Could you help me, please

Original Attachment has been moved to: wd1111111.rar

Labels (1)
3 Replies

1,100 Views
RadekS
NXP Employee
NXP Employee

Hi xiaohui,

Your code contains CAN0CTL1_BORM=0; command. That means that only way how the MSCAN module may leave the bus-off state is when the module detects 128 occurrences of 11 consecutive recessive bits.

 

If you want to use CAN bus-off recovery upon user request (CAN0MISC_BOHOLD  = 0x01;), you have to enable that feature by setting BORM bit in a CANCTL1 register.

 

According to your second thread, you want to use stop mode. I would like to recommend switch MSCAN module into sleep mode prior entering to MCU stop mode. This will prevent against generating error frames on the CAN bus due to unexpected stop mode.

Please use commands below prior entering into stop mode.

CAN0CTL0_SLPRQ = 1;         //sleep mode request

while(CAN0CTL1_SLPAK == 0); //wait for acknowledge of sleep mode

This will manage that MCU will finish all scheduled frames in TX buffers and waits until receiving frame ends (it wait for bus idle).

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,100 Views
xiaohui200808
Contributor III

Hello

       I tried my code again .if I set  CAN0CTL1_BORM=0; the MSCAN leave the bus-off state is when the module detects 128 occurrences of 11 consecutive recessive bits.Then it will enter busoff again  

If I set  CAN0CTL1_BORM=1;the MSCAN will  leave the bus-off state is when(CAN0MISC_BOHOLD  = 0x01;)initialize MSCAN. and the module detects 128 occurrences of 11 consecutive recessive bits.  But it will enter Busoff again .Leave the Busoff  enter the Busoff    

0 Kudos

1,100 Views
RadekS
NXP Employee
NXP Employee

Hi Xiaohui,

The bus-off state is a situation where TX/RX error counter reaches more than 255 value.

Every CAN bus error adds some points to error counter – typically 8 points per TX error, 1 point per RX error.

So, when the MCU recovery from the bus-off state, but the source of error is still there, it will just end in the bus-off state again.

What is a source of CAN bus error in your case?

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos