We use the fsl_mcan driver below our CANopen stack and the driver is not handling interrupts correct.
- We see that the sometimes when interrupts handler is called the interrupts are not correctly copied from the IR register. When we set a breakpoint behind this copy the IR register is filled with interrupts and the variable is zero.
The problem is that after a few minutes the driver stops with sending messages because the cancellation is not finished. The driver comes back when the first bit in the TXBAR register is set. The adds a new request which clears all the pending flags when finished and runs again for a while until it happen again.
So far we changed the interrupt handler that only the handled interrupts are cleared. And we added the following in the handler of the Tx complete:
This delays the problem. Without the above fix it will last an hour and otherwise it will last a few minutes.