AnsweredAssumed Answered

bxCAN - handling transmission errors

Question asked by mjbcswitzerland on Mar 3, 2014
Hi All

If a CAN message is sent to the CAN bus and gets no acknowledge it is repeated infinitely by the bxCAN module.
Therefore, to detect that it has failed I have configured an interrupt on an error condition - specifically on the passive error which is generated when the message is repeated 128 times.

This works as expected on the first message that doesn't have an acknowledgement. The mailbox with the problem is shown by the TERRx bit in the CAN_TSR register and so an abort can be requested. This cancels the mailbox transmission and also the TERRx flag can be reset.

To reset the error interrupt, the error flag is reset by writing the corresponding bit in CAN_MSR.

The problem is however that the EPVF bit is still set in the error status register. Since the error interrupt is only asserted on a state change it never arrives again and following transmissions with no acknowledgement can't be aborted using the interrupt error detection.

Sometimes after sending some additional messages that are acknowledged it is observed that the EPVF flag resets (itself). Then one transmission error detection works again.

The question is therefore how is it possible to reset the EPVF error flag so that following errors can be detected? There is no information about how this is supposed to be performed but it seems absolutely necessary to be able to get a following interrupt.

In the meantime I will be trying to maybe use the "Last error code" interupt instead.

Regards

Mark


Outcomes