1
\$\begingroup\$

A termination resistor in CAN ( .. or other differential pair communication like RS485 ) is necessary to absorb reflection. The value is related to wire length, electrical frequency, baud rate. It does not seem to be related the number of devices.

However, I heard some rumor in my workforce that termination is not needed if only 2 devices are connected. Well, in my experience, it doesn't work occasionally but I'm confused whether was a my mistake.

Do I really need termination resistors on CAN if only two devices are connected?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ There are cases where one may not use a standard two 120 ohm resistor to terminate the bus, but “only two devices” isn’t sufficient reason. Furthermore some type of pull down resistance is mandatory as the 1 bit is undriven- the resistor must pull the lines together to create this condition. \$\endgroup\$
    – Bryan
    Commented Jul 15, 2022 at 3:50
  • \$\begingroup\$ @Bryan what about RS485? \$\endgroup\$
    – Jade Kim
    Commented Jul 15, 2022 at 3:55
  • 1
    \$\begingroup\$ Rs 485 has some different considerations as both 1 and 0 are driven, and the speed can be easily an order of magnitude faster - but again the decision to terminate or not to terminate wouldn’t solely depend on the number of devices. Contrary to CAN a relatively short, relatively low speed 485 bus between peers who tolerate line breaks can run just fine with no termination or pull-up/down resistors. If this question isn’t well answered by the weekend I’ll offer a detailed analysis as to why I make these claims \$\endgroup\$
    – Bryan
    Commented Jul 15, 2022 at 4:02
  • 1
    \$\begingroup\$ CAN is rugged so it might be able to "limp home" if one resistor is missing. If both are missing, it rarely works. Always provide two of them, everything else is quackery and may or may not work given the circumstances. \$\endgroup\$
    – Lundin
    Commented Jul 15, 2022 at 8:40

2 Answers 2

3
\$\begingroup\$

Termination resistors and why you need them

CAN and RS485 phsical layers use square pulses at high frequency to move data about - in fact the frequency of these pulses is high enough that you must consider the wires they travel upon as a transmission line. To borrow from the "water analogy" of electricity (pressure==voltage, flow==current) the transmission line effects of a water pipe can be seen when you have a water hammer occur: all the piping in the house shakes because the shockwaves travel through the piping (yes I know this isn't perfectly analogous, and yall have my apologies).

https://en.wikipedia.org/wiki/Transmission_line

Really every wire is a transmission line, however the effects only become important when the wavelength is close to the length of the wire or shorter. The heuristic rule is that if your wavelength is 10% of your wire length then you must start accounting for transmission line effects. Let's have a poke at some common CAN and RS485 wavelengths in typical twisted pair with a velocity factor of 0.65 and we will assume the fundamental frequency is half the data rate ie. a 1 bit followed by a 0 bit is one complete cycle:

\$\lambda=\frac{v}{f}, v=0.65*3.0*10^8\$

125kbit/s: 3120 meters

1Mbit/s: 390 meters

10Mbit/s: 39 meters

30Mbit/s: 13 meters

So given our 10% rule, we see that we're obligated to think about transmission lines anywhere between 39m and 312m with CAN busses and 1.3m to 3.9m with high speed 485 busses. This seems a little long compared to my real world CAN experiences, and probably the readers as well, so lets look at some of the disingenuous assumption of frequency tricked us with:

It is inappropriate to characterise the spectrum of these data signals by their data rate alone; these aren't sine waves, they're sharp edged square waves. A better number is to use the \$BW=\frac{0.35}{Rise Time}\$ rule-o-thumb (good ref here: https://www.edn.com/rule-of-thumb-1-bandwidth-of-a-signal-from-its-rise-time/). Now whats the rise time? CAN is slow and defines a sampling time well towards the end of the bit period: can bit timing from wikipedia can bus article

UART signals like RS485 are sampled differently, and this is a bit of a gap in my knowledge - I know common UART implementations use 16x oversampling to determine the bit value and recover the clock phase (and rate?), though I'm unaware of universal timing requirements or rules of thumb so I go by 1/10th the bit period as a MAXIMUM rise time, and I try to achieve this for CAN as well.

This means our peak frequencies are closer to: \$f=\frac{.35}{\frac{1}{10*Rate}}\$ So 125kbit/s is now 437kHz, of which 10% wavelength is 44.6m, 7 times shorter than the naive assumption.

What do termination resistors do? Termination resistors absorb the stored energy in the transmission line. A termination resistor matched to the transmission line's characteristic impedance will absorb every last drop without reflecting any energy. When there's no reflections the voltage measured at any point along the transmission line is the voltage the transmitter intended to send. In the presence of reflections, the voltage at any point will be the sum of the transmitted wave and the reflected wave; here's a great picture of what that looks like (from a previous SE-EE post: RS485 Cable Lengths and Reflections):

unterminated bus reflections simulation

You can see that the nice flat square wave levels have been replaced by ringing as the reflected waveform bounces back and forth along the line.

CAN Bus specifically

CAN bus has it's own issues compared to RS485 (or ethernet or RS232) in that the recessive state of the bus is not driven by the transceivers. This choice was made so that if two nodes began to transmit on the bus, one node could win arbitration by driving a dominant state while the other reuested a recessive state - both transceivers monitor the bus and if the recessive request is overruled the losing node will back off. The implementation of this is shown here in an LTC2875 datasheet snip:

can tranceiver output stage

CANH can be pulled high and CANL can be pulled low to indicate the dominant state, but the termination resistor load on the bus must bring the differential bus voltage low enough to become the recessive state. With no or negligable load on the bus the voltage cannot relax fast enough to trigger the recessive state and all recevier nodes plus the transmitter node will flag an error, and eventually all transmitters will go BUS OFF as they continue to lose arbitration or detect form errors.

But one time my friend made it work with no resistors, this is all wrong!

This analysis neglects things like receiver load, which could satiate a low speed CAN bus' requirement for some pulldown. Not everything here is perfect, but it's a good start, and a great reason to use termination resistors, and at no point has the number of devices come into play.

dangling refs

https://en.wikipedia.org/wiki/CAN_bus#Bit_timing https://www.analog.com/en/products/ltc2875.html

\$\endgroup\$
3
  • \$\begingroup\$ But RS-485 does not mean UART. And nothing prevents from driving RS-485 bus with dominant and recessive states too. \$\endgroup\$
    – Justme
    Commented Jul 16, 2022 at 20:25
  • \$\begingroup\$ @Justme good point about uart - rs485 signalling is used for encoders and other digital signals, with their own rise time requirements, though I’m a bad person and I’d probably hand wave those to 10% as well. As for recessive states on the bus - I have experience with the bus being tri stated, however I’ve never met a transceiver that communicates that to the host. Can you elaborate on recessive state applications in 485 busses? \$\endgroup\$
    – Bryan
    Commented Jul 16, 2022 at 20:47
  • \$\begingroup\$ I like your very detailed answers. maybe i can persuade my colleagues and partners with this. Thanks a lot. \$\endgroup\$
    – Jade Kim
    Commented Jul 17, 2022 at 9:58
3
\$\begingroup\$

The number of devices is irrelevant.

Bus type is.

CAN bus is open drain type, which relies on the termination resistors to return the dominant bus voltage back to recessive bus voltage. So it does not work without proper termination, as termination is not only used for transmission line effects.

RS-485 on the other hand will often work for short lengths without termination, depending on many details of course.

\$\endgroup\$
1
  • \$\begingroup\$ i'm appreciated for your simple summarized answers \$\endgroup\$
    – Jade Kim
    Commented Jul 17, 2022 at 9:53

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.