The CAN (controller area network) protocol was developed by the European automotive electronics company Robert Bosch GmbH in 1983 for in-vehicle networks. The intention behind the development of the CAN protocol was to enable robust data communication between different electronic control units (ECU) and microcontroller control units (MCU) of a vehicle on a single wire to get rid of complex peer-to-peer wiring between them — despite communicating data over a single bus, CAN does not require any host computer.
The standard CAN protocol operates at the OSI model’s physical and data link layers. The other protocol stack layers are not implemented within CAN, which proved to be a great advantage. System engineers are free to design other protocol stack layers in a way that best suits an application. Today, CAN makes variations like CANopen, DeviceNet, and J1939, allowing implementation of all seven protocol stack layers (along with standard CAN layers 1 and 2 for specific use cases); CAN has a reputation as a robust, simple, cross-domain, versatile serial network communication protocol that must be implemented whenever frequent real-time data communication is required between electronic devices belonging to different domains. So, learning the implementation of standard CAN protocol seems beneficial.
In this article, we will take a look at the CAN protocol and its distinct features. Then, we will explore some typical applications of CAN protocol and investigate how CAN is utilized there.
CAN standard
CAN specifications define the CAN protocol and the CAN physical layer. The protocol is mainly defined by ISO-11898 specifications, but other specifications like ISO-11519 for low-speed serial data communication also apply to the protocol. The ISO-11898 specification is divided into three parts: the first part defines the specifications for the data link layer and single physical link, the second part defines the CAN physical layer for high-speed CAN, and the third part defines the CAN physical layer for low-speed CAN.
The low-speed CAN has data rates of 5 Kbps, 10, 20, 50, and 125 Kbps. The high-speed CAN has data rates of 250, 500, 800 Kbps, and 1 Mbps. In a CAN network, the data is communicated over a shielded or unshielded twisted pair or ribbon cable having a characteristic impedance of 120 ohm. The DB9 (male) connectors are used as per CiA DS-102 specification. CiA stands for “CAN in Automation.” The maximum range of a CAN bus is 1000m (at 40 Kbps). For high-speed CAN, the maximum range is 40 m at 1 Mbps. A maximum of 127 nodes can be connected to a CAN bus.
How CAN protocol works
In a CAN network, each electronic device or system connected to the bus is a node. Each node consists of three elements: host controller, CAN controller, and CAN transceiver. The host controller is a microcontroller or processor within the device/system that runs some application for a specific job. The CAN controller handles the transmission and reception of CAN messages between the host controller and the CAN bus; it acts as a protocol handler. The CAN transceiver takes care of the transmission and reception of CAN messages over the CAN bus. It acts as a line driver. While the host controller is a physical controller/processor, the CAN controller and CAN transceiver are implemented in software or firmware.
Each node is a CAN transceiver. The data is communicated in a half-duplex, asynchronous manner. The bits are transmitted over the CAN bus using differential voltage. The two wires in the CAN bus are called CAN low and CAN high. There are two unusual logic states of the CAN bus called recessive and dominant. Logic 1 is the recessive state, and logic 0 is the dominant state. Usually, the bus rests at a recessive state, i.e., logic 1. For recessive state or communicating logic 1, both wires CAN low and CAN high are applied a voltage half of supply voltage VDD or VCC. The supply voltage is typically 5 V, so both wires are applied at 2.5 V. As a result, the differential voltage between the wires is 0 V. This is read as logic 1. In the dominant state, CAN high is pulled up to 3.5 V, and CAN low is pulled to 1.5 V. So, the differential voltage between two wires is 2 V. This is the dominant state of the bus, which is read as logical 0 by the CAN transceiver.