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.
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.
This failure can be avoided by adding
after line 1196 of flexcan_driver.c#