0% found this document useful (0 votes)
29 views7 pages

CAN Protocol Understanding

The document provides an overview of the Controller Area Network (CAN) protocol used in automotive communication, detailing its purpose, history, and operational mechanisms. It explains the structure of CAN messages, the types of frames, and the error handling processes, emphasizing its robustness and cost-effectiveness in vehicle systems. Additionally, it outlines the error modes of CAN controllers and the automatic error signaling that enhances data consistency across the network.

Uploaded by

jogirey2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views7 pages

CAN Protocol Understanding

The document provides an overview of the Controller Area Network (CAN) protocol used in automotive communication, detailing its purpose, history, and operational mechanisms. It explains the structure of CAN messages, the types of frames, and the error handling processes, emphasizing its robustness and cost-effectiveness in vehicle systems. Additionally, it outlines the error modes of CAN controllers and the automatic error signaling that enhances data consistency across the network.

Uploaded by

jogirey2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CAN PROTOCOL OVERVIEW

Purpose of Communication Protocol in Vehicle:


A vehicle bus is a specialized internal communications network that
interconnects components inside a vehicle (e.g. automobile, bus, train, industrial or
agricultural vehicle, ship, or aircraft).
Protocols Used in Automotive:
 CAN
 LIN
 MOST
 FLEX RAY
Why CAN is used:
 Controller Area Network (CAN) is a multi-drop bus protocol, so it can support
many communicating nodes.
 The CAN protocol is based on two signals shared by all nodes on the network.
The CAN_High and CAN_Low signals provide a differential signal and allow
collision detection.
 Robust in Noisy Environments.
 All Devices on the Network Receive every bit of information sent on the BUS.
 Cost Effective.
History of CAN:
In February of 1986, Robert Bosch introduced the CAN (Controller Area Network)
serial bus system at the SAE congress in Detroit. It was designed to handle short
messages (up to 8 bytes), support multi-master access (collisions get resolved by
priority), and offer a high degree of reliability (15-bit CRC for every message). In Mid
1987, Intel delivered the first CAN chip, the 82526. Shortly thereafter, Philips
Semiconductors introduced the 82C200 CAN controller.
Working of CAN:
Controller Area Network (CAN) is the most widely used communication protocol
in automotive applications. It was developed to replace complex wiring harnesses with a
two-wire bus. CAN network consists of nodes – electronic control units (ECU) that are
connected on to a two wire bus. Any electronic device with a CAN interface can be
connected on to a network.
Messages on CAN aren’t passed directly from node to node but are transmitted
on to the network. Messages each have their unique message identification number
which is also used to determine message priority. CAN network can operate without a
central control node, message hierarchy is not based on nodes but on the messages
that they transmit. Therefore, one node can transmit both high and low priority
messages.

Error in message transmission is checked by all of the nodes that are connected
to the network. If one of the nodes detects an error in message reception it sends a
special error message on to the network. A node that originally sent the message has to
retransmit it.

Different versions CAN configurations are defined by ISO standards. Normally


there are two configurations used in automotive applications. High speed CAN is used
for communications between critical subsystems that require high update rates and data
correctness (anti lock braking system, electronic stability control, airbags, engine control
unit...). Data transfer speeds of high speed CAN ranges from 1 kbit to 1 Mbit per
second. Low speed CAN is used for fault tolerant systems that do not require high
update rates. Their maximum data transfer rate is limited to 125 kbit per second but
their wiring architecture can be more economical. In automotive applications low speed
CAN is normally used for diagnostics, dashboard controls and displays, power windows.
CAN Frame Structure:

1. Data frame
A message that transmits data through the CAN network. It is the most common
message type on the network. Message consists of:

 Arbitration field - field that contains the message identification number


and remote transmission request bit. More important messages have
lower ID numbers, when multiple nodes want to transmit at the same time
they start a simultaneous arbitration. A node with the lowest message id
number wins. The message identifier can be 11 bit (Standard CAN, 2048
different message identifiers) or 29 bit in length (Extended CAN, 537
million different message identifiers). The remote transmission request bit
is dominant and signals that data is being transmitted.
 Data field - field in length from 0 to 8 bytes that holds data,
 CRC field - cyclic redundancy check field, shows if there were any
mistakes during message transfer,
 Acknowledge field - every node changes this field if it received a
message without any errors.
2. Remote frame
The purpose of the remote frame is to request a message from another node. By
structure it is similar to the data frame. The difference is that it doesn’t contain any data
and has a recessive remote transmission request (RTR) bit which signals a message
request from another node.

3. Error frame
Error frame is a special frame that violates CAN formatting rules and signals an
error in data transmission. A node that detects an error while reading the message on
the network transmits an error message. Because an error frame violates CAN
formatting rules all of the nodes that were reading from the network retransmit it. After
that a node that originally transmitted a message with an error has to retransmit the
original message.

4. Overload frame
It is similar to the error frame with regard to formatting. It is transmitted by a node
that becomes too busy. It is primarily used as an extra delay between messages.

CAN in Automotive:

 Electronic subsystems on modern road vehicles are usually controlled by more


than 150 ECUs. These control units are highly dependent of each other and are
connected to a single or multiple serial networks.

 On a serial network data is being transmitted bit by bit onto a network. Each
device can read all of the messages on the network but responds only to those
that are meant for it. To ensure that critical messages get to their recipients with
the least possible delay message priority is based on message importance.

 Communication networks in modern road vehicles connect all of the electronic


subsystems. With transfer speeds of up to 10 Mb/s large amounts of data can be
generated.
CAN controller error modes

A CAN controller can be in one of three states:

1. Error active - the normal operating mode for a controller. Messages can be
received and transmitted. On detecting an error an active error flag is sent
(see error signalling).
2. Error passive - a mode entered when the controller has frequent problems
transmitting or receiving messages. Messages can be received and transmitted.
On detecting an error while receiving, a passive error flag is sent.
3. Bus off - entered if the controller has serious problems with transmitting
messages. No messages can be received or transmitted until the CAN controller
is reset by the host microcontroller or processor.

The mode of the controller is controlled by two error counters - the transmit error
counter (tx_count) and the receive error counter (rx_count). The following rules apply:

1. The CAN controller is in error active mode if tx_count <= 127 AND rx_count <=
127.
2. Passive mode is used if (tx_count > 127 OR rx_count > 127) AND tx_count <=
255.
3. Bus off is entered if tx_count > 255.

Once the CAN controller has entered bus off state, it must be reset by the host
microcontroller or processor in order to be able to continue operation. In addition, this is
only allowed after the reception of 128 occurrences of 11 consecutive recessive bits.

The counters are updated as follows:


1. When a receiver detects an error, the rx_count will be increased by 1, except
when the detected error was a bit error during the sending of an active error flag
or an overload flag.
2. When a receiver detects a dominant bit as the first bit after sending an error flag,
the rx_count will be increased by 8.
3. When a transmitter sends an error flag, the tx_count is increased by 8.

Exception 1:If the transmitter is error passive and detects an ack error
because of not detecting a dominant ack and does not detect a dominant
bit while sending its passive error flag.

Exception 2: If the transmitter sends an error flag because a stuff error


occurred during arbitration whereby the stuff bit is located before the RTR
bit, and should have been recessive, and has been sent as recessive but
monitored as dominant.

4. If a transmitter detects a bit error while sending an active error flag or an


overload flag, the tx_count is increased by 8.
5. If a receiver detects a bit error while sending an active error flag or an overload
flag the rx_count is increased by 8.
6. Any node accepts up to 7 consecutive dominant bits after sending an active or
passive error flag or an overload flag. After detecting the 14th consecutive
dominant bit (in the case of an active error flag or an overload flag), or after
detecting the 8th consecutive dominant bit following a passive error flag, and
after each sequence of additional 8 consecutive dominant bits every transmitter
increases its tx_count by 8 and every receiver increases its rx_count by 8.
7. After the successful transmission of a message (getting ack and no error until
end of frame is finished) tx_count is decreased by 1 unless it was already 0.
8. After the successful reception of a message (reception withour error up to the
ack slot and the successful sending of the ack bit), rx_count is decreased by 1 if
it was between 1 and 127. If rx_count was 0 it stays 0, and if it was greater than
127, it will be set to a value between 119 and 127.

Error signalling

When an error is detected by a node it sends an error flag on the bus. This prevents any
other node from accepting the message and ensures consistency of data throughout the
network.

The active error flag consists of six low bits, and is used if the node transmitting the
error frame is in active error state. As low is dominant all other nodes will detect bit
stuffing violation and send their own error flags. After this, nodes that want to transmit
(including the one sending the interrupted message) will start to do so. As usual, the
node whose message has the highest priority will win arbitration and send its message.
If the CAN controller is in error passive mode the error frame will consist of six passive
(high) bits. Since the error flag only consists of passive bits, the bus is not affected. If no
other node detected an error, the message will be sent uninterrupted. This ensures that
a node having problems with receiving can not block the bus.

All of this advanced error handling is done automatically by the CAN controller, without
any need for the host microcontroller to do anything. This is one of the big advantages
of CAN.

You might also like