Hello,
We use the fsl_mcan driver below our CANopen stack and the driver is not handling interrupts correct.
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.
FYI,
We figured something out and that is solving this problem.
We have seen that sometimes the interrupt handler was called with the IR register not set. Probably that are the tx interrupts that we are missing.
We added the following code in the interrupt handler:
The implementation of the MCAN_FinalizeTransmit function is as follows:
To be completely sure we also call MCAN_FinalizeTransmit when an rx interupt occurs.
Dear Teus,
I have some question regarding this issue.
Which baudrate are you using?
Which is the state of the FIFOs when this error appears? Is it full?
Which is the value of the error counter register (ECR) when this error appears?
Best Regards,
Alexis Andalon
Dear Alexis,
Thanks for your help at first.
For more information about the register see the screenshots in the appendix / below. CAN1 is the pheripheral with the problems. The screenshots are taken on the moment the problem happend.
Best Regards,
Teus
Hi Teus,
As I could check in the registers of the CAN1 you have a FIFO with size of eight elements, and is full in the moment in which the error is present. Check the RXF0C and the RXF0S to confirm this information.
So I think something is wrong with the stack you're using. I will suggest to put a watermark in the FIFO and enable the interruption to see when this being filled more that what you want.
Best Regards,
Alexis Andalon