AnsweredAssumed Answered

FlexCAN stuck in interrupt loop

Question asked by Christian Mächler on Mar 24, 2018
Latest reply on Mar 29, 2018 by Christian Mächler

Hi,

 

There is a bug in the FlexCAN module of SDK 1.8.7 where the controller gets stuck in an interrupt loop.

This issue often occurs when using the RX FIFO but can also occur when using message boxes.

 

Explanation:

Under certain circumstances the FLEXCAN_IRQHandler can reset the status of a message box to FLEXCAN_MB_IDLE without resetting the IFLAG of the message box.

In this case, when the FLEXCAN_IRQHandler exists, the CAN interrupt is immediately called again (since the IFLAG of the message box is still active) and executes the FLEXCAN_IRQHandler again.

 

The FLEXCAN_IRQHandler realizes that the IFLAG of the message box is set, but since the status of this message box was already reset to FLEXCAN_MB_IDLE, the FLEXCAN_IRQHandler does not service the message box and exits without resetting the IFLAG. In that case the CAN interrupt is called again and so on.

The controller is then stuck in an interrupt loop.

 

Solution:

This failure can be avoided by adding

 

else
{
FLEXCAN_ClearMsgBuffIntStatusFlag(base, mb_idx);
}

 

after line 1196 of flexcan_driver.c#

Outcomes