Length, termination, biasing and bit timing
RS-485 and CAN are the two most widely used differential buses in industry and cars. Data travels over a twisted pair as the voltage difference between two wires, so noise affecting both equally cancels out and hundreds of metres can be reached. For them to work properly, three things must be respected: a daisy-chain topology, termination at the ends and a relationship between speed and length.
In RS-485 the nodes hang in line from a twisted pair with a termination resistor equal to the cable impedance (120 Ω) at each end. When nobody transmits, the bus floats; a pair of biasing resistors (one to positive on A and one to ground on B, at a single point) sets an idle state of at least 200 mV so that receivers do not read noise.
In CAN the bus is also a twisted pair terminated with 120 Ω at each end, but arbitration is bit by bit: every node must see each bit at the same time, so the signal must travel to the end and back before the sample point. That is why the maximum length drops sharply as speed rises. The bit time is divided into quanta (tq) and set with a prescaler and two segments.
| RS-485 | CAN | |
|---|---|---|
| Bus access | Master-slave: one asks and the others answer | Multi-master with arbitration by identifier priority |
| Speed and distance | Up to 10 Mbit/s over a few metres; 1200 m at 100 kbit/s or less | 1 Mbit/s at about 40 m; 50 kbit/s at 1 km |
| Error detection | Provided by the protocol (Modbus CRC) | Built in: CRC, acknowledge and automatic retransmission |
| Nodes | 32 unit loads (256 with 1/8 transceivers) | Up to about 110 in practice |
| Protocols | Modbus RTU, Profibus DP, BACnet MS/TP, DMX512 | CANopen, J1939, DeviceNet, NMEA 2000 |
Related: UART and baud rate, crystal oscillator, TVS protection and optocouplers.