What is CAN-BUS?
CAN stands for Controller Area Network and this communication bus is a standard of the automotive field. It allows microcontrollers and automotive devices to communicate with each other within a vehicle. These devices are also called Electronic Control Units (ECUs) and they enable communication and actions between all parts of a vehicle like fuel level, door sensors or odometer.
Today, you can find up to 70 ECUs in a modern car. But you can find CAN-BUS as a serial communication bus also in industrial applications or farming equipment.
The CAN-compatible components, which are called “nodes”, are connected with a 3-string copper wire, with no central router to govern the flow of data. Every node can hear the messages of every other node. It’s basic but efficient regarding the infrastructure of a car.
Every node has an ID, where the ones with the higher priority ID can have the priority to “talk” first while the others “listen”. This is to ensure that there are never two nodes talking at the same time. The biggest benefit of CAN-BUS is to be able to just connect components without having to worry about signal routing. The iCAN ID is either 11 or 29 bits in length depending on the type of CAN protocol used (standard or extended).
CAN protocol communication speeds range from 10kbps to 1Mbps; it depends of distance (length of the wire). Data payload is typically from 0 to 8 bytes.
Why use CAN-BUS?
There are other well-known communication protocols like UART, SPI, and I2C. Using the CAN protocol is much more reliable because it has been designed as a standard automotive communication protocol to transmit vital data like a throttle position in a vehicle. If miscommunication or loss of data occurs, it could lead to critical failures.
In a vehicle, safety and reliability are the two most valued features. CAN-BUS is therefore the ideal protocol for vehicular usage. Each ECU can receive all transmitted messages and then decides whether it is relevant and act accordingly.
As CAN-BUS supports centralized control over electronic devices that are connected to the network, it allows for central error diagnosis and configuration across all ECUs. Error handling is also built into the CAN protocol where nodes can check for errors in transmission while maintaining their own error counter. The protocol supports different error detection capabilities such as bit error, ack error, form error, CRC error, etc.
CAN-BUS vs OBD2
The CAN standard does not specify how to handle messages larger than 8 bytes. Therefore, a set of standardized protocols have been developed to further specify how data is communicated between ECUs of a given network. OBD2, which stands for on-board diagnostics, is one of them.