Electronic – CAN bus test via loopback – possible or not

canmicrocontroller

I want to test the integrity of the CAN bus (also my CAN transceiver) periodically using the following method (independent of the other nodes).

Assume two nodes always exist (node A and node B). When node A transmits a message on the bus, node B will receive the message. But can/will node A also receive the message so that I can confirm that the data has gone to the bus and has been received back uncorrupted?

I'm in confusion as to whether the transmitter can be used to receive the same message it transmits, so that the health check of the bus can be independent of the other nodes. Though the message that will be sent on the bus will be received by the other nodes, it doesn't matter, I'll discard such messages in software / acceptance filter, etc. in the receiving nodes.

Whether this method can be used in addition to all the error mechanisms, CRC, etc. provided in the CAN specification itself or are there any other methods for checking the integrity of the CAN bus via software (like internal loopback, echo test, etc.). I'm using the RM57 microcontroller BTW (if it helps).

Thanks

Best Answer

All CAN hardware error checks are performed by hardware - the CAN controllers.

A CAN node cannot ack itself, by design. It will not receive its own messages. CAN is meant to have at least two nodes to work - a CAN bus with just one node is considered faulty, it is common sense. Therefore it doesn't make sense to have an "independent check".

(With one exception: if you enable a debug mode called "loop-back", which most CAN controllers support. Loop-back is a feature which allows the CAN controller to speak with itself without actually sending anything out on the bus. This is used for trouble-shooting and simulation purposes only and isn't meaningful to use in the final application. Typically you use this when you were cheap and only bought 1 evaluation board etc.)

The validation of message reception is done by the receiver acknowledging the message by setting the acknowledge bits in the CAN frame. http://www.can-cia.org/can-knowledge/can/can-data-link-layers/. This is done by the CAN controllers and nothing your software driver or application-level protocol need to concern themselves with, apart from checking the error flags after each transmission.

Now if you want to know if the right CAN node received the message, rather than any node, then that's another story not related to the hardware health of the bus. Such things have to be sorted in the high-level protocol.