What is Controller Area Network (CAN)?

What Is Controller Area Network?

CAN (Controller Area Network) is a real-time control technology Protocol uses two-wire differential serial communication. The CAN Bus Protocol was 1st created for the automotive industry to connect transmissions, airbags, antilock braking/ABS, cruise control, electric power steering, audio systems, power windows, doors, mirror adjustment, battery, and recharging systems for hybrid/electric vehicles, among other things.

CAN-BUS Hardware Layer

The Physical Layer is the basic hardware required for a CAN network, i.e., the ISO 11898 electrical specifications. It converts 1’s and 0’s into electrical pulses leaving a node, then back again for a CAN message entering a node. Although the other layers may be implemented in software or in hardware as a chip function, the Physical Layer is always implemented in hardware.

There are several different physical layers:

  • The most common type is the one defined by the CAN standard, part ISO 11898-2, and it’s a two-wire balanced signaling scheme. It is also sometimes known as “high-speed CAN”.

  • SAE J2411 defines a single-wire (plus ground, of course) physical layer. It’s used chiefly in cars – e.g., GM-LAN.

  • Several proprietary physical layers do exist.

  • Modifications of RS485 were used in the Old Ages when CAN drivers didn’t exist.

  • Go to Section 5 to view a number of oscilloscope pictures for those interested in the details of a message.

Two Wire System

CAN bus uses two dedicated wires for communication. The wires are called CAN high and CAN low. The CAN controller is connected to all the components on the network via these two wires. Each network node has a unique identifier. All ECUs on the bus are effectively in parallel and that’s why all the nodes see all of the data, all of the time. A node only responds when it detects its own identifier. Individual nodes can be removed from the network without affecting the other nodes.

When the CAN bus is in idle mode, both lines carry 2.5V. When data bits are being transmitted, the CAN high line goes to 3.75V and the CAN low drops to 1.25V, thereby generating a 2.5V differential between the lines: each of the CAN lines is referenced to the other one, not to vehicle ground. Since communication relies on a voltage differential between the two bus lines, the CAN bus is NOT sensitive to inductive spikes, electrical fields or other noise. This makes CAN bus a reliable choice for networked communications on mobile equipment.

CAN Bus Termination

Terminal resistors are needed in CAN bus systems because CAN communication flows are two-way. The termination at each end absorbs the CAN signal energy, ensuring that this is not reflected from the cable ends. Such reflections would cause interference and potentially damaged signals.

The reflection challenge grows with the length of the cables as well as the CAN bus bit rate. This is why it is critical to add proper termination in larger CAN networks. There are two types of terminations, Standard termination and Split Termination, Termination can lead to communication issues if not done properly.

Arbitration

CAN is a peer-to-peer network, there is no master to control the transmission between nodes. When a node in CAN is ready to transmit data, it usually undergoes through a process called message arbitration. In the message arbitration process, CAN node will check to see if the bus is idle and initiates the transmission once the bus is idle. This action triggers the other CAN nodes in the bus and results in two or more nodes starting a message at a same time which results in a conflict in the network. It can be resolved by following methods,

Transmitting node checks the bus while they are sending data

If any node in the network detects a dominant level (logical 0) when sending a recessive level itself, it will fail in the arbitration process and quits immediately will start acting as a receiver.

This arbitration process is performed while sending the arbitration ID field of the CAN frame and at the end, only one transmitter is left on the bus i.e., the node with the highest priority (lowest arbitration ID) will pass the arbitration.

After that, the node which has won the arbitration will continue message transmission as if nothing had happened.

Difference Between CAN 2.0 And CAN FD

CAN 2.0CAN FDData bit rate is max 1 MbpsMax data bit rate is 8 MbpsA maximum of 8 bytes of data can be sent in one frame without Transport Protocol64 bytes of data can be sent in one frame without the TP layer.Multiple CAN nodes can broadcast message frames.Only one node transmits at a time; one of the reasons for increased bit rateNo BRS or FDF to switch the speed to higher or lower levelsBit Rate Switch (BRS), Flexible Data Rate Format (FDF) and Error State Indicator (ESI) together ensure higher speed.Cyclic Redundancy Code contains a 15bit codeCRC field has 17 or 21 check codesLess secured due to less data payload capacity

Enhanced security of data as CAN FD data can be encrypted using the extra memory

DLC, Message ID And Data Byte Payload

Data Length Code. A part of the CAN message. It used to mean simply the length of the CAN message, in bytes, and so had a value between 0 and 8 inclusive. In the revised CAN standard (from 2003) it can take any value between 0 and 15 inclusive, however the length of the controller area network message is still limited to at most 8 bytes. All existing CAN controllers will handle a DLC larger than 8.

Data byte Payload is a serialized request structure. Up to 8 bytes of data can be transmitted through a single CAN Bus message. DLC field, or Data Length Code.

CAN Bus Message Protocol

The CAN communication protocol is a carrier-sense, multiple-access protocol with collision detection and arbitration on message priority (CSMA/CD+AMP). CSMA means that each node on a bus must wait for a prescribed period of inactivity before attempting to send a message. CD+AMP means that collisions are resolved through a bit-wise arbitration, based on a preprogrammed priority of each message in the identifier field of a message.

The higher priority identifier always wins bus access. That is, the last logic high in the identifier keeps on transmitting because it is the highest priority. Since every node on a bus takes part in writing every bit “as it is being written,” an arbitrating node knows if it placed the logic-high bit on the bus.

Figure 1: CAN Bus Message Protocol

Structure Of Controller Area Network Frame:

SOF: SOF stands for the start of frame, which indicates that the new frame is entered in a network. It is of 1 bit.

Identifier: A standard data format defined under the CAN 2.0 A specification uses an 11-bit message identifier for arbitration. Basically, this message identifier sets the priority of the data frame.

RTR: RTR stands for Remote Transmission Request, which defines the frame type, whether it is a data frame or a remote frame. It is of 1-bit.

Control field: It has user-defined functions.

  • IDE: An IDE bit in a control field stands for identifier extension. A dominant IDE bit defines the 11-bit standard identifier, whereas recessive IDE bit defines the 29-bit extended identifier.

  • DLC: DLC stands for Data Length Code, which defines the data length in a data field. It is of 4 bits.

  • Data field: The data field can contain up to 8 bytes.

CRC field: The data frame also contains a cyclic redundancy check field of 15 bit, which is used to detect the corruption if it occurs during the transmission time. The sender will compute the CRC before sending the data frame, and the receiver also computes the CRC and then compares the computed CRC with the CRC received from the sender. If the CRC does not match, then the receiver will generate the error.

ACK field: This is the receiver’s acknowledgment. In other protocols, a separate packet for an acknowledgment is sent after receiving all the packets, but in case of controller area network protocol, no separate packet is sent for an acknowledgment.

EOF: EOF stands for end of frame. It contains 7 consecutive recessive bits known End of frame

Previous
Previous

What is Bluetooth Low Energy?