-
Notifications
You must be signed in to change notification settings - Fork 8
Introduction to CAN
This page will give a very basic, high level understanding of Controller Area Networks (CANs). Specificities will be glossed over, as very little actual knowledge of CAN is needed.
Controller Area Network (CAN) is a protocol that controllers use to communicate with each other. You can think of it as connecting 2 computers with a cable, then having them communicate across that cable using data in a specific format. CAN defines both the cable and the format.
The cable is typically made up of 2 wires: green/white, green/yellow or green/blue. These represent CAN low (CAN_L) and CAN high (CAN_H). Which is which doesn’t really matter, and they actually have the exact same data on them, except that the voltages on low are centered around 1.8V and high around 3.2V, and they are mirrored.
For example, here is a graph of CAN low and high voltages, where the y axis is voltage, and x axis is time:
As you can see, high and low are reflections of each other. By having be reflections of each other, it increases the reliability and resistance to noise in the signal.
CAN, in general, has a maximum data rate of 1mbps or 1 million bits per second. This is slow compared to basically any cable you may use on a daily basis, but is more than fast enough for our purposes.
CAN should also be (almost) always daisy chained. This means that controllers on the network are connected to each other, not into a central controller. This configuration is similar to how doubly linked lists look. Additionally, the first controller in the chain and last controller require a 120ohm resister across the low and high wires.
CANFD is largely the same as regular CAN. The only thing that sets it apart is the “Flexible Data-Rate” part, and that it uses one additional cable.
The “Flexible Data-Rate” part allows controllers to say, in essence, “I am going to transmit my data really fast, be ready”, and for the receiver to say, “Ok, go ahead, I’m ready.” This allows transfer rates of up to 5mbps or 5 million bits per second, which is five times faster than regular CAN.
The extra cable is just ground (which is black), which helps further isolate CAN from noise and increase stability.
Note that CANFD and CAN are not cross compatible.
In software, each controller in a CAN bus has an ID. 0 is always reserved, and should never be used. Most hardware will need a CAN ID assigned to it before it can work properly. The hardware on our robot each has a different method for this. In terms of CANID allocation on our robot, see ‣.
