8
\$\begingroup\$

I have been trying to set up a CAN network using PIC18F25K80 microcontrollers and an MCP2551 to communicate between them. Can I use two simple wires as a CAN bus by just connecting the CANL, CANH of the transceivers? I couldn't even transmit data with the set up I have made with two wires! Should I terminate them with some resistance?

\$\endgroup\$
3
  • \$\begingroup\$ Try using twisted pair and preferably screened twisted pair \$\endgroup\$
    – Andy aka
    Commented Apr 3, 2013 at 10:49
  • \$\begingroup\$ If bus length is small then it might work but it's always better to have termination. \$\endgroup\$
    – Swanand
    Commented Apr 3, 2013 at 12:24
  • 2
    \$\begingroup\$ @Swanand: No. Terminating the line is only part of the purpose of the resistors. The other part is to ensure the passive state of the bus. In this sense, they are like the pullup resistor of a open collector bus. Without the resistor, the passive state is undefined. \$\endgroup\$ Commented Apr 3, 2013 at 13:08

2 Answers 2

5
\$\begingroup\$

There is an assumption of a common 0V between the two circuits, or at least a difference between the 0Vs of the circuits within the common mode difference voltage.

For correct CAN transmission, you need

  • continuous wiring between the two nodes, CANH to CANH and CANL to CANL. Not crossed over, not shorted, not open circuit. Twisted pair is not absolutely necessary at lower data rates/very short cables eg few cm at 50kbaud in the lab.
  • at least one termination resistor, will not work at all without one. As data rates/cable lengths go up, you really should have one at each end, of the right value, 120R.
  • at least one receiver running at the same data rate (and other bit timings) to send the ACK pulse, otherwise you get infinite repeats from the transmitter of the first message.
  • common 0V reference between all nodes
\$\endgroup\$
1
  • \$\begingroup\$ I have found that a common 0v is very important for higher speeds. In a system we had, a GND difference of just 0.3v between noted was enough to cause a significant number of message errors. Reducing that difference by adding thicker wires reduced the number of errors. \$\endgroup\$ Commented Apr 3, 2013 at 20:16
5
\$\begingroup\$

The CAN bus requires terminating with 120 ohms.

Enter image description here

I use the split termination method, with a low (10 nF) ceramic capacitor to the Vref pin on the last device on the bus. It's pin 5 on the MCP2551.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Split termination with capacitor to ground is fine, but connecting that capacitor to Vref of the MCP2551 makes no sense. You are looking for a AC ground. At best that is a voltage source and it will work as well as real ground, but that pin has limited current capability and is not meant to absorb transients. \$\endgroup\$ Commented Apr 3, 2013 at 13:11
  • 2
    \$\begingroup\$ You attach the middle of the split to the Vref, and the capacitor from the middle to GND. \$\endgroup\$ Commented Apr 3, 2013 at 20:41
  • \$\begingroup\$ I have left the Vref pin unconnected, and used standard termination using 120ohm res, but still couldn't communicate between the boards. \$\endgroup\$ Commented Apr 16, 2013 at 6:11

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