1
\$\begingroup\$

I'm doing some work on STM32 board, and I don't have a CAN transceiver connected to my STM (yet). CAN_RX / CAN_TX pins are just hanging in the air. Is it possible to at least test the loopback mode in this configuration or just send packets and watch them with a scope?

What is the proper hardware setup in this case? Do I need 120 Ohm termination resistor? I guess no because RX/TX is not really a real CAN bus without transceiver.

I've read somewhere that you need pullup resistors on TX/RX pins if running without a transceiver, do I need those?

So far I've tried just doing normal CAN setup like if I would have a transceiver chip connected. But I get timeout during CAN_Init. But it's not really the point of the question.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

You can just connect the CAN_TX line to the CAN_RX lines directly and you should be able to observe CAN frames being sent if the peripheral is correctly configured. However, you will need to put the CAN controller into loop-back mode otherwise it will not generate ACK signals for the messages it is sending itself, and this will cause repeated re-transmissions until the controller goes into it's fault state.

\$\endgroup\$
2
  • \$\begingroup\$ thanks I'll try that \$\endgroup\$
    – floppydisk
    Commented Dec 14, 2022 at 12:43
  • \$\begingroup\$ In loopback mode you usually need to external connection at all. However I'm not familiary with this particular CAN controller, maybe it needs that? \$\endgroup\$
    – Lundin
    Commented Dec 14, 2022 at 13:39
0
\$\begingroup\$

If developing CAN bus applications you will need some manner of listener software - it is pretty much a mandatory tool for getting anything done. These usually come with CAN-to-USB adapters for PC. And from there you can tell the listener to be an active node and ACK all messages - then you need no further nodes on the bus. But obviously a CAN transceiver.

In such cases you do need 2x 120ohm resistors and a physical bus. Usually the most convenient to use a bunch of DB9 IDC connectors with ribbon cable between - DB9 is one of the standardized CAN bus connectors (by CANopen CiA 303-1). Ribbon cables are handy since you can just keep adding more DB9 connectors to it in case you run out of them.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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