1
\$\begingroup\$

I am testing a CAN bus network with 3 nodes. What I mean by node is a esp32 which has a CAN controller and a tja1051 transceiver module. There seems to be no problem when here are just two nodes but when I connect my 3rd node to transmit a message with the other 2 set up to just receive it does not work.

For context I am using sandeepmistry CAN library on the arduino IDE, and I can only monitor two esp32s at a time. I am doing all of this on a breadboard(s) so it is possible there is a connection issue, but I have probably spent a good hour in total making sure everything is in the right place. One source of error that I recognize is that I am using 100 ohm resistors instead of 120 ohms but I have read that it is fine to use no resistors? I am powering one of the esp32 with the 3v3 pin (since I can only power 2 at a time) and all the grounds are common. Additionally I am pretty sure that there is no problem with the transceiver modules, I have swapped them around and it seems to work with just 2 nodes. I am using the code provided in the following link https://www.circuitstate.com/tutorials/what-is-can-bus-how-to-use-can-interface-with-esp32-and-arduino/ It is very similar to the example code provided by sandeepmistry. Currently when I want to make a node transmit messages or receive messages I use canSender() or canReceiver() functions in the loop.

Oddly when I monitor two of the esp32s I can see that the 3rd node seemingly manages to send messages but when the code on the other esp32 I am monitoring loads, the 3rd node just stops working (the CAN.write(...) program lines dont run).

I would greatly appreciate any help reducing the possible sources of error.

Edit: I went back to using only 2 nodes and the problem persisted. I believe the problem is the 3rd esp32 because when I switch esp32 (using the same transceiver) it miraculously works. I have messed around using different pins for rx and tx using CAN.setPins() and nothing works.

\$\endgroup\$
17
  • \$\begingroup\$ Are the termination resistor on the modules or separate terminations on bus? \$\endgroup\$
    – Justme
    Jan 10 at 10:44
  • \$\begingroup\$ I have a small breadboard dedicated for the 2 termination resistors, not using the module resistors (I have made sure) \$\endgroup\$
    – cr1tical1
    Jan 10 at 10:52
  • \$\begingroup\$ Are you using 3 unique ID addresses? \$\endgroup\$
    – Andy aka
    Jan 10 at 10:59
  • \$\begingroup\$ @Andyaka what addresses ?! \$\endgroup\$
    – Maple
    Jan 10 at 11:05
  • 1
    \$\begingroup\$ This could be caused by anything. You need to listen on the CAN traffic and see if there are error frames, before anything else. That could in turn be caused by numerous other issues. \$\endgroup\$
    – Lundin
    Jan 10 at 11:47

1 Answer 1

0
\$\begingroup\$

The problem was in fact with the 3rd esp32, a Duinotech esp32 wroom 32. Not sure if it is a problem with the manufacturer or if I simply got unlucky. I replaced the esp32 and it works fine now.

\$\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.