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.
Physically a CAN-bus is a system made up of controllers(nodes) connected by twisted wire pairs. These twisted wire pairs are done pretty aggressively with most OEMs using 1-2 twists 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 same interferance and the chance of descrepancy 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 resistors. THe purpose of a termination resistor is to eliminate erroneous faint on the bus so that only strong signal messages can get to controllers and to prevent reflections. It is important to note that some controllers will have termination resistors built into there CAN input. Another common rule to try and maintain strong signals is to try and keep branch lenghts down to less than 18 inches.
As stated before, the two wires in the twisted pair are referred to as CAN-lo and CAN-hi. The difference between CAN-hi and CAN-lo 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 an "1" signal was being continuously transmitted you would see roughly 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 unless there message is more dominant. To avoid this all messages come equiped with an identifier (referred to as an ID.) The lower the indentifier the more dominant the message is . For example the ECU sends out a message with a low identifer(more dominant) then all other controllers will see that message indentifier and go into receiving mode until the bus is clear. It is important to note that although you have identifers 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 numbe of modern controllers have programming to select between multiple baud rates.