3
\$\begingroup\$

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

\$\endgroup\$
7
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ To ensure that the intended node received the mag I have to use Acknowledgments from the receiving nodes \$\endgroup\$ – Akshay Immanuel D Mar 27 '16 at 7:09
2
\$\begingroup\$

Some CAN controllers have loop-back mode. However they do not send message over the line, they handle sending and receiving the message internally. RX line is ignored, that means cannot take any messages from other nodes. I assume you do not want to switch between normal mode and loop-back mode.

I suggest you to implement a higher level protocol to trace and correct errors.

\$\endgroup\$
  • \$\begingroup\$ This question i asked can be answered if someone says whether if a transmitter sends out a msg will it also receive at the same time/not. I feel that a transmitter cannot receive its own msg sent on the bus. That y im in confusion. \$\endgroup\$ – Akshay Immanuel D Mar 23 '16 at 9:59
  • \$\begingroup\$ As far as I know, you cannot do that unless you have another channel in your chips. \$\endgroup\$ – cagatayo Mar 23 '16 at 11:10
  • \$\begingroup\$ You mean that i have another CAN like CAN2,that is also connected to CAN1 bus so that when CAN1 sends data,CAN2 of my uC gets the data? \$\endgroup\$ – Akshay Immanuel D Mar 23 '16 at 11:55
  • \$\begingroup\$ Yes, I mean that. If your mpc/mcu and transceiver have second channels it will be just a matter of connection. You will send your message from channel1 and listen it from channel2. \$\endgroup\$ – cagatayo Mar 24 '16 at 8:26
1
\$\begingroup\$

You don't really need to do this, because your transmitted message must be acknowledged by one of the other nodes. It cannot ack itself. So, if there is no connection, your node will retransmit until it hits the error limit and then go bus-off.

You would do better to detect the bus off state and then devise a way to recover from it.

\$\endgroup\$
  • \$\begingroup\$ Yes,but what if it is my transceiver that is at fault. I want to isolate the possible faults as far as possible so that i can assign a unique ID for each fault. Also if there are more than 2 nodes, 1 node might have failed and another can be functional.ACK is only at the Physical Layer. Before saying someother node is at fault, i want to clear my end possible faults 1st :) \$\endgroup\$ – Akshay Immanuel D Mar 22 '16 at 9:37
  • \$\begingroup\$ As you say, you could do a loopback test. But, be careful as it takes your node "off-line" and it will then not ack messages from the other nodes. \$\endgroup\$ – OXO Mar 22 '16 at 9:55
  • \$\begingroup\$ No No. My Node wont go Bus OFF. The other nodes on the Bus will ACK that they received the msg,but they have no use of such a msg so theyl discard it. My node will receive the msg it transmitted and check if Tx msg==Rx msg \$\endgroup\$ – Akshay Immanuel D Mar 22 '16 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.