MK22 CAN Bus off automatic recovery

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

MK22 CAN Bus off automatic recovery

2,921 次查看
jmartinez1
Contributor II

Hi everyone,

I'm developing a CAN bus app with MK22FX512VLQ12 Kinetis microcontroller with KDS and Processor Expert. I want to handle manually the "Bus off recovery mode" when I detect the "Bus Off" error in the bus. At page 1179, Register CAN0_CTRL1, bit 6 BOFFREC it specified that an automatic recovery request is available (enabled or disabled). My questions are:

1) If I assert this bit so as to enable the automatic recovery mode to, is there any way to detect that the Bus has been recovered successfully? If yes, how?

2) Is the SYNCH bit (CAN0_ESR1 register, page 1186) suitable to detect an automatic bus recovery?

3) And finally, must I reset any register or to do a soft reset of the CAN peripherical?

Thank you very much.

Joaquim.

标签 (1)
0 项奖励
回复
7 回复数

2,520 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Joaquim Martinez,

    1. Assert BOFFREC is Automatic recovering from Bus Off state disabled.

       If you want to enable the automatic recovery mode, you need to negated the BOFFREC bit.

      You can check SYNCH and FLTCONF bit in the CANx_ESR1 register to check the state.

     2. Yes, you can check SYNCH and FLTCONF bit.

     3. I don't think after automatic recovery you need to reset the CAN module. Because after enter bus off mode, the REC and TEC wil be cleared automatically.

     But, if you enable the Bus off interrupt, you need to clear the according flag by yourself, eg, BOFFINT.

Wish it helps you!


Have a great day,
Kerry

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

0 项奖励
回复

2,520 次查看
jmartinez1
Contributor II

Hi Kerry,

Thanks a lot.

A last question: what is the condition that makes can bus goes into bus error in MK22?

I tried to disconnect the can_h, can_l and GND from devices and the interruption is not generated (and I have enable it with Processor Expert).  

Thanks. 

0 项奖励
回复

2,520 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Joaquim Martinez,

  I think this picture may help you to understand:

CAN err.jpg

After you disconnect it, you can check the CANx_ECR, whether it counts or not? If send or receive error, the according counter will add.

Wish it helps you!


Have a great day,
Kerry

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

0 项奖励
回复

2,520 次查看
jmartinez1
Contributor II

Hi Kerry,

Thanks a lot.

Joaquim. 

0 项奖励
回复

2,520 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Joaquim martinez,

  You are welcome, if you still have question, just let me know!

  If your question is solved, please help me to mark the correct answer to close this question.

   Thank you and have a nice day!

 

  


Have a great day,
Kerry

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

0 项奖励
回复

2,520 次查看
jmartinez1
Contributor II

Hi Kerry,

I don't see any button to mark correct answer... Where is it?

Joaquim.

0 项奖励
回复

2,520 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Joaquim Martinez,

    Oh, this is the discussion post, not the question post, so it doesn't have the correct answer button.

   OK, just leave it!

   Thank you!

Best Regards,

Kerry