CAN-bus is the most commonly used communication protocol in modern automotive, heavy industry, and motorsport data and control systems. Here we will explore what physically makes up a CAN-bus and how the system works.
Physical Build Up
Physically a CAN-bus is a system made up of controllers (nodes) connected by twisted wire pairs. We recommend 1 twist per inch of wire. The wires are twisted because the signals transmitted on the wires are made from measurements on both wires, therefore when the wires are twisted together they are both subject to the same interference and the chance of discrepancy is greatly reduced. Most commonly the wires are green and white or green and blue. The common color convention is green as CAN-lo and white or blue as CAN-hi. Modern OEMs, however, will use many colors and color combinations.
On the far reaching ends of a CAN bus there are termination resistors these are usually 120 Ohm. The purpose of a termination resistor is to eliminate erroneous faint messages on the bus so that only strong signal messages can get to controllers. It is important to note that some controllers will have termination resistors built into their CAN input. Another common rule to try and maintain strong signals is to try and keep branch lengths down to less than 18 inches.
How it Works
As stated before, the two wires in the twisted pair are referred to as CAN-lo and CAN-hi. The difference between CAN-lo and CAN-hi is what makes up the signal in a CAN message. These signals are bits(1,0.) If you were to monitor voltage on a bus while a “1” signal was being continuously transmitted you would see about a 5v difference. On the opposite end a “0” signal would read about 0v difference between wires. The messages on a bus are commonly made up of 8, eight-bit “words” or 4, sixteen-bit “words”.
The most obvious thing that separates a CAN-bus from something like Serial communication is that the messages are being sent between multiple controllers all the time. All of these controllers receive every message on the CAN-bus, however the programming on the devices tell them what messages to pick out and what to ignore. No controllers will send out a message while they see another message on the bus. To avoid this all messages come equipped with an identifier (referred to as an ID.) The lower the identifier the more dominant the message is. For example the ECU sends out a message with a low identifier (more dominant.) All other controllers will see that message identifier and go into receiving mode until the bus is clear. It is important to note that although you have identifiers to help controllers keep message transmission under control it is normal practice to only have a bus running at 80% capacity.
All bus’s have a specific baud rate which is more or less the number of symbols per second. In OEM’s these rates vary but is most common to see 125kbit/s or 512kbit/s, in motorsports the rate is more commonly 1 Mbit/s. A large number of modern controllers have programming to select between multiple baud rates.