Electronic – Where to use CAN v RS485

canrs485

Not sure whether this is too broad a question but…
Why would one choose CAN Bus over RS485, or vice versa, as a system interconnect?
I have a MCU SBC with multiple interfaces including the two mentioned. Feeding into that I have various sensors/transducers (up to 20 in total).

RS485 is the most common, but some also have CAN. The ones with CAN also have RS485.

In certain cases we cannot hang 2 device sets which have differing protocols if they automatically send NACK packets, because one device's perfectly good NACK is another's bad packet (and so sends a NACK…)

Given that all devices have short packets, and interconnects of length less than one metre, what other factors would mandate which to use?

Best Answer

The main difference is that CAN supports multi-master operation through non-destructive arbitration. It has a wired-AND structure. In other words, with RS485 you need to have a mechanism for coordinating devices to ensure that more than one device does not try to transmit at the same time. With CAN bus this is not a problem.

The usual way to solve this issue with RS485 is to define a single master device (your SBC for example) that polls each sensor on the network. This can work fine. The main disadvantage compared with CAN is that there is a single point of failure (your master) though in your case that isn't a real problem, since if the master goes down then there is nothing to use the sensor data anyway. Depending on your sampling/polling scheme CAN may also offer better latency, since sensors can autonomously transmit data as soon as it is available.

As other answers note, CAN also defines more layers of the protocol than RS485, but in practice you can emulate much of this functionality apart from that which relies on the bus level arbitration.