How to get CAN error state?

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

How to get CAN error state?

Jump to solution
2,108 Views
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.

1 Solution
1,635 Views
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 

 

View solution in original post

4 Replies
1,635 Views
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 Kudos
1,635 Views
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 Kudos
1,636 Views
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 

 

1,635 Views
kbj
Contributor IV

Hi Jiri,

Thanks for your help.

I will try it.

Best Regards,

Byungju.

0 Kudos