How to get CAN error state?

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

How to get CAN error state?

跳至解决方案
3,257 次查看
kbj
Contributor IV

Hi,

I use S32DS for ARM.2018.R1 and SDK EAR 0.8.6.

On FlexCAN, How to get CAN error state (CAN BUS OFF)?

I can't find the function to get CAN error state.

1.PNG

Best regards,

Byungju.

标记 (4)
1 解答
2,784 次查看
jiri_kral
NXP Employee
NXP Employee

Hi Byungju, 

sure - there is interrupt specially for Bus Off - CAN0_ORed_IRQHandler and for other errors you can implement 

CAN0_Error_IRQHandler. 

You can install your handler by INT_SYS_InstallHandler();

More details about CAN interrupts you can find on Chapter 53.1.4 FlexCAN Interrupts (S32K1xx Series Reference Manual, Rev. 7, 04/2018 - page 1630).  SDK example lpit_periodic_interrupt_s32k144 is good example how to add custom interrupt handler. 

Hope it helps. 

Jiri 

 

在原帖中查看解决方案

4 回复数
2,784 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

it looks like that this feature is not implemented in SDK. You can get this info from register directly:

CAN0->ESR1 & CAN_ESR1_FLTCONF_MASK

Jiri

0 项奖励
回复
2,784 次查看
kbj
Contributor IV

Hi Jiri,

Thanks for your response.

Can I set a callback or interrupt when a CAN error occurs?
If so, how do I set it up?

Best regards,

Byungju.

0 项奖励
回复
2,785 次查看
jiri_kral
NXP Employee
NXP Employee

Hi Byungju, 

sure - there is interrupt specially for Bus Off - CAN0_ORed_IRQHandler and for other errors you can implement 

CAN0_Error_IRQHandler. 

You can install your handler by INT_SYS_InstallHandler();

More details about CAN interrupts you can find on Chapter 53.1.4 FlexCAN Interrupts (S32K1xx Series Reference Manual, Rev. 7, 04/2018 - page 1630).  SDK example lpit_periodic_interrupt_s32k144 is good example how to add custom interrupt handler. 

Hope it helps. 

Jiri 

 

2,784 次查看
kbj
Contributor IV

Hi Jiri,

Thanks for your help.

I will try it.

Best Regards,

Byungju.

0 项奖励
回复