In a number of MCU families there are built in CAN bus controllers, which include self testing function of loop back. Loop Back mode can be configured as External Loop Back and Internal Loop Back. Here's a figure of how controller treats RX and TX lines in both these modes: CAN bus loop back modes
As it says in my particular datasheet,
This mode is provided for hardware self-test. To be independent from external stimulation, the CAN ignores acknowledge errors (recessive bit sampled in the acknowledge slot of a data/remote frame) inLoop Back Mode. In this mode the CAN performs an internal feedback from its Tx output to its Rx input. The actual value of the CAN_RX input pin is disregarded by the CAN. The transmitted messages can be monitored at the CAN_TX pin.
So acknowledge errors are ignored, right. Is there still need for connection of an external transceiver circuit, along with a teramination resistor of 120 Ohms (or two in parallel for complete bus), or can that be disregarded or do you even recommend to leave the MCU's RX and TX pins floating?
-
\$\begingroup\$ Loopback mode is a debug mode which is essentially just good for one thing: testing code until you have proper hardware in place. So no, you don't need any transceiver or termination. Keep in mind however that in loopback mode the CAN controller might ACK itself. When running on a real CAN bus you must have an external node to make those ACK. \$\endgroup\$Lundin– Lundin2025年03月24日 10:59:59 +00:00Commented Mar 24 at 10:59
1 Answer 1
As your datasheet says: Internal loop back, nothing happens on the Tx pin. Rx pin is ignored. External loop back, the Tx pin shows what is being transmitted internally. Rx pin is ignored.
All you need is to ensure that the Rx pin is not floating as a part of good GPIO pin configuration and circuit wiring practice, to avoid potential oscillations and power drain. Which is nothing to do with the CAN function.
Of course if you actually intend to use the interface then a transceiver chip and possibly a termination resistor will be needed : these internal test modes do not care if it is present.
Explore related questions
See similar questions with these tags.