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,287 Views
Embedded_novice
Contributor III

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

0 Kudos
Reply
1 Solution
1,240 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,272 Views
Embedded_novice
Contributor III
请问清除哪个寄存器能够避免中断重入呢?
0 Kudos
Reply
1,241 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
%3CLINGO-SUB%20id%3D%22lingo-sub-2186374%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ECAN%20enters%20an%20abnormal%20interrupt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186374%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20am%20using%20CAN1%20and%20CAN2%20on%20S32K310%20chip%2C%20currently%20there%20are%20two%20nodes%20on%20the%20bus%20only%20on%20CAN1%20and%20single%20node%20state%20on%20CAN2.%20But%20CAN2%20is%20repeatedly%20entering%20ERR_IRQHandler%20without%20triggering%20any%20fault.%20why%20is%20this%3F%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snipaste_2025-10-15_15-07-08.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snipaste_2025-10-15_15-07-08.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360838iE1A0DDA44E9FA18D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Snipaste_2025-10-15_15-07-08.png%22%20alt%3D%22Snipaste_2025-10-15_15-07-08.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2187810%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20CAN%20enters%20an%20abnormal%20interrupt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187810%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F213197%22%20target%3D%22_blank%22%3E%40Embedded_novice%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAre%20you%20testing%20CAN2%20with%20another%20node%20in%20the%20bus%3F%20Such%20as%20CAN%20analyzer%20or%20another%20CAN%20device.%20If%20CAN2%20is%20not%20connected%2C%20try%20enabling%20loopback%20for%20single-node%20tests.%3C%2FP%3E%0A%3CP%3ECAN%20error%20flag%20should%20be%20cleared%20like%20so%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3ECAN2-%26gt%3BESR1%20%7C%3D%20%3CSPAN%3EFLEXCAN_ESR1_ERRINT_MASK%3C%2FSPAN%3E%3B%20%20%2F%2F%20Clear%20error%20interrupt%20flag%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EHowever%2C%20I%20can%20see%20ESR1%20is%20empty.%20Maybe%20the%20flag%20has%20been%20cleared%20before%20you've%20stopped%20execution%3F%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20disable%20reentry%20by%20disabling%20error%20interrupts%20for%20now%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3ECAN2-%26gt%3BCTRL1%20%26amp%3B%3D%20~%3CSPAN%3EFLEXCAN_CTRL1_ERRMSK_MASK%3C%2FSPAN%3E%3B%3CBR%20%2F%3E%3CSPAN%3ECAN2-%26gt%3BCTRL1%20%26amp%3B%3D%20~FLEXCAN_CTRL1_BOFFMSK_MASK%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3BBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186585%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20CAN%20enters%20an%20abnormal%20interrupt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186585%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3EWhich%20register%20can%20be%20cleared%20to%20avoid%20interrupt%20reentry%3F%3C%2FLINGO-BODY%3E