Introduction to CAN Protocol

The automobile industry uses many protocols in modernized vehicles with embedded systems and Electronic control units (ECU) which can communicate with each other using protocols like CAN.

It was first developed by Bosch and released in SAE {1986}. It was designed for robust communications within the vehicle microcontrollers and devices without the need of a computer.

The most widely used protocols in Automobiles is CAN and its flavors, Let's learn about CAN, it was first developed by Bosch and released in SAE {1986}.

It was designed for robust communications within the vehicle microcontrollers and devices without the need of a computer. CAN protocol runs over two wires CAN-H and CAN-L, it works on the method of differential signaling "Differential signaling is a method for electrically transmitting information using two complementary signals.



The technique sends the same electrical signal as a differential pair of signals, each in its own conductor. The pair of conductors can be wires or traces on a circuit board." it transmits the data by differing the voltage between two wires. this provides a viable data transmission as it can resist with noises and disturbances.

all the ecu's in CAN bus are connected through two wires consisting of a 120-ohm resistor for terminating messages, CAN-H, CAN-L runs at 5v and 0v respectively. these transmit data at 512kbps and 128kbps. while transmitting data dominant is 0 and recessive is 1, dominant can drive over a recessive.

Let's talk about the CAN data format.

Identifier extension (IDE) This bit is always 0 for standard CAN.



Data frame: this consists of the data which is to be transferred.
Remote (request) frame: this is used when an ECU request's for information.
Error frame: this is used when an error was detected. this frame will be written to specify an error.
Arbitration ID: this provides a unique id for each node to get identified in the bus.
Data length code: these 4bits are used to represent no.of bytes of data.
(SOF and EOF are used to separate between two messages.)

The data is autonomous in CAN network and if a receiver node wants to request certain data from a sender the remote frame is used. if an error is detected from the network by a node it reacts with,
six dominant bits – error active.
six recessive bits - error passive.

There are two types of CAN packets: standard and extended.
Extended packets are like standard ones but with a larger space to hold IDs.extended packets use substitute remote request SRR instead of RTR with SSR set to 1. They’ll also have the IDE set to 1, and their packets will have an 18-bit identifier.

There are other protocols in the Automobile industry like CAN,

The ISO-TP Protocol:
This is used to send data up to 4095bytes by linking/chaining the CAN packet's together, This is a standard for sending packet water can purse that extends in order to do this encapsulation first byte is used and leaving rest 7 bytes for data.

The CANopen Protocol:
CANopen breaks the 11bit identifier to 4bit function code & 7bit node ID ( this combination is known as a communication object identifier (COB-ID) ). this is mostly used in industrial settings than in Automotive.

The GMLAN Bus:
This is an implementation by General Motors, GMLAN bus consists of a single-wire low-speed and a dual wire high-speed bus. The low-speed bus, a single-wire CAN bus that operates at 33.33Kbps with a maximum of 32 nodes, this is to lower the cost of communication and wiring. It’s used to transport non-critical information for things like the infotainment center, HVAC controls, door locks, immobilizers, etc. the high-speed bus runs at 500Kbps with a maximum of 16 nodes. Nodes in a GMLAN network relate to the sensors on that bus.

The SAE J1850 Protocol:
there are two types of these, pulse width modulation (PWM) and variable pulse width (VPW).
There are three classes A, B, C which works at 10.04kbps,100kbps,1Mbps respectively.
A is used in business, industrial, and commercial environments.
B in residential environments.
C in real time critical systems and media networks.

The PWM Protocol:
it uses differential signaling and operates at 5v and 41.kbps, PMW has a fixed-bit signal, 1 is high signal and 0 is the low signal.

The VPW Protocol:
it is a single wire bus system runs at 7v and 10.4kbps. VPW uses time-dependent signaling receiving a bit is determined by sustaining for a certain amount of time.

The Keyword Protocol and ISO 9141-2:
Messages sent using KWP2000 may contain up to 255 bytes. the ISO 14230-4 KWP has two variants as 5-baud init & fast init. Unlike CAN packets,
K-Line packets have a source and destination address. K-Line can use a similar PID request structure as CAN.

The Local Interconnect Network (LIN) Protocol:
LIN is a cheaper protocol this will not have any arbitration/priority code, all the data transmission is done by a single master node. one master node can support up to 16 slave nodes which respond's according to a certain event. generally, the master node is connected to the CAN network. LIN works at 12v & 20kbps. LIN message will have a Header given by master and response of it.

The MOST Protocol:
The Media Oriented Systems Transport (MOST) protocol is designed for multi­ media devices which can hold a maximum of 64 devices out of them one will be a master and feeds the frames into the ring.
it runs at 23Mbaud and supports various audio/video channels. it uses a dedicated control channel to send configuration messages which run at 768 Kbaud.
it comes in three variants,
MOST25 - runs on plastic optical fiber and transmission is done at 650nm.
MOST50 - doubles the bandwidth and increases the frame length to 1025 bits and transports in unshielded twisted-pair (UTP).
MOST150 - implements Ethernet and increases the frame rate to 3072 bits or 150Mbps.
MOST has three channels

Synchronous - Streamed data (audio/video)
Asynchronous - Packet distributed data (TCP/IP)
Control - Control and low-speed data (HMI)

MOST automatically assigns addresses in the ring it also routes packets through separate import and outport ports.

The FlexRay Bus: this is a high-speed bus which is capable of communicating up to 10Mbps mainly used for taking real quick decisions. FlexRay is costlier due to its perks and used for high-end systems.
It uses a twisted pair wiring also supports dual channel this helps in increase of fault tolerance and bandwidth.
FlexRay supports bus and star topology we can also combine them to make a hybrid layout.

Automotive Ethernet:
FlexRay and MOST are costly to implement most of the automobiles are alternating to Ethernet. only the implementation varies from the Standard network of computers. data is transmitted using UDP and VoIP at speeds up to 10Gbps irrespective of topology.

References :
1. ECU Communication and Networking.
2. Automating ECU Identification for Vehicle Security.
3. Car hackers handbook.