CAN enters an abnormal interrupt

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

CAN enters an abnormal interrupt

Jump to solution
1,414 Views
Embedded_novice
Contributor III

我在S32K310芯片上使用CAN1和CAN2,当前只有在CAN1的总线上有两个节点,CAN2上是单节点状态。但是CAN2在没有触发任何故障的情况下重复进入ERR_IRQHandler。这是为什么?Snipaste_2025-10-15_15-07-08.pngSnipaste_2025-10-15_15-07-08.png

0 Kudos
Reply
1 Solution
1,367 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice

Are you testing CAN2 with another node in the bus? Such as CAN analyzer or another CAN device. If CAN2 is not connected, try enabling loopback for single-node tests.

CAN error flag should be cleared like so:

CAN2->ESR1 |= FLEXCAN_ESR1_ERRINT_MASK;  // Clear error interrupt flag

However, I can see ESR1 is empty. Maybe the flag has been cleared before you've stopped execution? 

You can disable reentry by disabling error interrupts for now:

CAN2->CTRL1 &= ~FLEXCAN_CTRL1_ERRMSK_MASK;
CAN2->CTRL1 &= ~FLEXCAN_CTRL1_BOFFMSK_MASK

 Best regards,
Julián

 

View solution in original post

0 Kudos
Reply
2 Replies
1,399 Views
Embedded_novice
Contributor III
请问清除哪个寄存器能够避免中断重入呢?
0 Kudos
Reply
1,368 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice

Are you testing CAN2 with another node in the bus? Such as CAN analyzer or another CAN device. If CAN2 is not connected, try enabling loopback for single-node tests.

CAN error flag should be cleared like so:

CAN2->ESR1 |= FLEXCAN_ESR1_ERRINT_MASK;  // Clear error interrupt flag

However, I can see ESR1 is empty. Maybe the flag has been cleared before you've stopped execution? 

You can disable reentry by disabling error interrupts for now:

CAN2->CTRL1 &= ~FLEXCAN_CTRL1_ERRMSK_MASK;
CAN2->CTRL1 &= ~FLEXCAN_CTRL1_BOFFMSK_MASK

 Best regards,
Julián

 

0 Kudos
Reply