CAN0_ORed_Err_Wakeup_IRQHandler() is triggered and FLEXCAN_GetErrorCounters is returning 0

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

CAN0_ORed_Err_Wakeup_IRQHandler() is triggered and FLEXCAN_GetErrorCounters is returning 0

531 Views
ED86
Contributor I

I am working with flexcan drivers on s32k116. I have a CAN network with 2 nodes in total. I was trying different test cases trying to test durability of drivers and related code. There was a case in which the CAN0_ORed_Err_Wakeup_IRQHandler() is being triggered but FLEXCAN_GetErrorCounters(base) is returning 0. Also, other interrupts are not being triggered during this case as the CAN0_ORed_Err_Wakeup_IRQHandler() is triggered again and again.

I have attached screenshots of callstack from IDE and the snippet where the FLEXCAN_GetErrorCounters(base) is being used by driver layer.

 

0 Kudos
3 Replies

499 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

what s32ds and SDK version are you using?
I can imagine a case with ECR is zero when module recovers from bus off state. So it would be better to check rather errors flags for which error interrupt is enabled instead of ECR.
If you read ESR1 in your situation which one are set?

BR, Petr

0 Kudos

462 Views
ED86
Contributor I

Thank you for your reply. Apparently following things were found.

1. Interrupt bit was being set in ESR1 and ECR was 0 in SDK due to which Error handler was not being called and Interrupt was not being cleared.

2. Interrupt was being cleared only by '|=' operation and not by '=' in "FLEXCAN_ClearErrIntStatusFlag".

Both of these things were found in SDK v3.0.2 and v4.0.3

0 Kudos

441 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) here a driver is not ideally written for K11x devices, flags should be checks instead of error counter. However a reading ESR1 clears error status bits, so should be properly handled.

2) '|=' operation should not be used for flag clearing. Do you see it in driver somewhere?

BR, Petr

0 Kudos