How to get CAN error state?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to get CAN error state?

ソリューションへジャンプ
3,271件の閲覧回数
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 解決策
2,798件の閲覧回数
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,798件の閲覧回数
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,798件の閲覧回数
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,799件の閲覧回数
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,798件の閲覧回数
kbj
Contributor IV

Hi Jiri,

Thanks for your help.

I will try it.

Best Regards,

Byungju.

0 件の賞賛
返信