CAN Bus


Contents: Introduction
Basic concepts
Coding
Message transfer
Data frame
Remote frame
Error frame
Overload frame
Interframe spacing

Introduction

bosch.gif (2205 byte)

CAN Specification - Version 2.0

1991, Robert Bosch GmbH, Postfach 30 02 40, D-70442 Stuttgart

International standard: ISO 11898 CAN High Speed

1 Mbit/s, 40 m, 30 nodes, twisted pairs

International standard: ISO 11519 CAN Low Speed

125 kbit/s, (500 m), 20 nodes, twisted pairs


The Controller Area Network (CAN) is a serial communications protocol which efficiently supports distributed realtime control with a very high level of security.

CAN is a serial bus system especially suited for networking "intelligent" devices as well as sensors and actuators within a system or sub-system.

can_archi.gif (5551 byte)

Its domain of application ranges from high speed networks to low cost multiplex wiring.

In automotive electronics, engine control units, sensors, anti-skid-systems, etc. are connected using CAN with bitrates up to 1 Mbit/s. At the same time it is cost effective to build into vehicle body electronics, e.g. lamp clusters, electric windows etc. to replace the wiring harness otherwise required.

Each CAN message can transmit from 0 to 8 bytes of user information. Of course, you can transmit longer data information by using segmentation.

The maximum transmission rate is specified as 1 Mbit/s. This value applies to networks up to 40 m.

For longer distances the data rate must be reduced: for distances up to 500 m a speed of 125 kbit/s is possible, and for transmissions up to 1 km a data rate of 50 kbit/s is permitted.

retour.gif (1245 byte)


Basic concepts

CAN has the following properties

Layered structure of a CAN node

can_layers.gif (7633 byte)

Source: ROBERT BOSCH GmbH

Physical Layer

The Physical Layer defines how signals are actually transmitted. Within this specification the physical layer is not defined so as to allow transmission medium and signal level implementations to be optimized for their application.

Transfer Layer

The Transfer Layer represents the kernel of the CAN protocol. It presents messages received to the object layer and accepts messages to be transmitted from the object layer. The transfer layer is responsible for bit timing and synchronization, message framing, arbitration, acknowledgment, error detection and signalling, and fault confinement.

Object Layer

The Object Layer is concerned with message filtering as well as status and message handling.

Messages

Information on the bus is sent in fixed format messages of different but limited length, called frames. When the bus is free any connected unit may start to transmit a new message.

Remote Data Request

By sending a REMOTE FRAME a node requiring data may request another node to send the corresponding DATA FRAME. The DATA FRAME and the corresponding REMOTE FRAME are named by the same IDENTIFIER.

Acknowledgment

All receivers check the consistency of the message being received and will acknowledge a consistent message and flag an inconsistent message.

Information Routing

In CAN systems a CAN node does not make use of any information about the system configuration (e.g. station addresses). This has several important consequences.

System Flexibility:

Nodes can be added to the CAN network without requiring any change in the software or hardware of any node and application layer.

Message Routing:

The content of a message is named by an IDENTIFIER. The IDENTIFIER does not indicate the destination of the message, but describes the meaning of the data, so that all nodes in the network are able to decide by MESSAGE FILTERING whether the data is to be acted upon by them or not.

Multicast:

As a consequence of the concept of MESSAGE FILTERING any number of nodes can receive and simultaneously act upon the same message.

Data Consistency:

Within a CAN network it is guaranteed that a message is simultaneously accepted either by all nodes or by no node. Thus data consistency of a system is achieved by the concepts of multicast and by error handling.

Multimaster

When the bus is free any unit may start to transmit a message. The unit with the message of higher priority to be transmitted gains bus access.

Priorities

The IDENTIFIER defines a static message priority during bus access.

Arbitration

Whenever the bus is free, any unit may start to transmit a message. If 2 or more units start transmitting messages at the same time, the bus access conflict is resolved by bitwise arbitration using the IDENTIFIER.

The mechanism of arbitration guarantees that neither information nor time is lost.

If a DATA FRAME and a REMOTE FRAME with the same IDENTIFIER are initiated at the same time, the DATA FRAME prevails over the REMOTE FRAME.

During arbitration every transmitter compares the level of the bit transmitted with the level that is monitored on the bus. If these levels are equal the unit may continue to send. When a ’recessive’ level is sent and a ’dominant’ level is monitored (see Bus Values), the unit has lost arbitration and must withdraw without sending one more bit.

Safety

In order to achieve the utmost safety of data transfer, powerful measures for error detection, signalling and self-checking are implemented in every CAN node.

Error Detection

For detecting errors the following measures have been taken:

Performance of Error Detection

The error detection mechanisms have the following properties:

Total residual error probability for undetected corrupted messages:

Error Signalling and Recovery Time

Corrupted messages are flagged by any node detecting an error. Such messages are aborted and will be retransmitted automatically. The recovery time from detecting an error until the start of the next message is at most 29 bit times, if there is no further error.

Fault Confinement

can_error.gif (3683 byte)

CAN nodes are able to distinguish short disturbances from permanent failures.

Defective nodes are switched off.

Connections

The CAN serial communication link is a bus to which a number of units may be connected. This number has no theoretical limit. Practically the total number of units will be limited by delay times and/or electrical loads on the bus line.

Bit rate

The speed of CAN may be different in different systems. However, in a given system the bitrate is uniform and fixed.

Single Channel

The bus consists of a single channel that carries bits. From this data resynchronization information can be derived. The way in which this channel is implemented is not fixed in this specification. E.g. single wire (plus ground), two differential wires, optical fibres, etc.

Bus values

The bus can have one of two complementary logical values: ’dominant’ or ’recessive’.

During simultaneous transmission of ’dominant’ and ’recessive’ bits, the resulting bus value will be ’dominant’. For example, in case of a wired-AND implementation of the bus, the ’dominant’ level would be represented by a logical ’0’ and the ’recessive’ level by a logical ’1’. Physical states (e.g. electrical voltage, light) that represent the logical levels are not given in this specification.

Sleep Mode / Wake-up

To reduce the system’s power consumption, a CAN-device may be set into sleep mode without any internal activity and with disconnected bus drivers. The sleep mode is finished with a wake-up by any bus activity or by internal conditions of the system. On wake-up, the internal activity is restarted, although the transfer layer will be waiting for the system’s oscillator to stabilize and it will then wait until it has synchronized itself to the bus activity (by checking for eleven consecutive ’recessive’ bits), before the bus drivers are set to "on-bus" again.

In order to wake up other nodes of the system, which are in sleep-mode, a special wake-up message with the dedicated, lowest possible IDENTIFIER (rrr rrrd rrrr; r = 'recessive’ d = ’dominant’) may be used.

retour.gif (1245 byte)


CODING

BIT STREAM CODING

The frame segments START OF FRAME, ARBITRATION FIELD, CONTROL FIELD, DATA FIELD and CRC SEQUENCE are coded by the method of bit stuffing.

Bit stuffing

Whenever a transmitter detects five consecutive bits of identical value in the bit stream to be transmitted it automatically inserts a complementary bit in the actual transmitted bit stream. The bit is autimatically removed by the receivers and therefore the bit stuffing mechanism is completely transparent for the user.

The remaining bit fields of the DATA FRAME or REMOTE FRAME (CRC DELIMITER, ACK FIELD, and END OF FRAME) are of fixed form and not stuffed.

The ERROR FRAME and the OVERLOAD FRAME are of fixed form as well and not coded by the method of bit stuffing.

The bit stream in a message is coded according to the Non-Return-to-Zero (NRZ) method. This means that during the total bit time the generated bit level is either ’dominant’ or ’recessive’.

retour.gif (1245 byte)


Message transfer

Frame Types

  1. DATA FRAME: carries data from a transmitter to the receivers.

  2. REMOTE FRAME: transmitted by a bus unit to request the transmission of the DATA FRAME with the same IDENTIFIER.

  3. ERROR FRAME: transmitted by any unit on detecting a bus error.

  4. OVERLOAD FRAME: used to provide for an extra delay between the preceding and the succeeding DATA or REMOTE FRAMEs.

DATA FRAMEs and REMOTE FRAMEs are separated from preceding frames by an INTERFRAME SPACE.

retour.gif (1245 byte)


Data frame

data_frame.gif (4865 byte)

Source: ROBERT BOSCH GmbH

arbitration_field.gif (2837 byte)

Source: ROBERT BOSCH GmbH

Start of Frame : 1 bit (dominant)

IDENTIFIER

The IDENTIFIER’s length is 11 bits. These bits are transmitted in the order from ID-10 to ID-0. The least significant bit is ID-0. The 7 most significant bits (ID-10 - ID-4) must not be all ’recessive’.

Remote Transmission Request RTR bit

In DATA FRAMEs the RTR BIT has to be ’dominant’. Within a REMOTE FRAME the RTR BIT has to be ’recessive’.

control_field.gif (3354 byte)

Source: ROBERT BOSCH GmbH

DLC : Data Length Code

Data Field : 0 to 8 bytes

Segmentation if more than 8 bytes have to be transmitted

crc_field.gif (2723 byte)

Source: ROBERT BOSCH GmbH

CRC : Cyclic Redundancy Check Sequence , 15 bits

CRC Generator-Polynomial : X 15 + X 14 + X 10 + X 8 + X 7 + X 4 + X 3 + 1

CRC Delimiter : 1 bit (recessive)

ack_field.gif (2422 byte)

Source: ROBERT BOSCH GmbH

ACK FIELD

The ACK FIELD is two bits long and contains the ACK SLOT and the ACK DELIMITER.

In the ACK FIELD the transmitting station sends two ’recessive’ bits.

A RECEIVER which has received a valid message correctly, reports this to the TRANSMITTER by sending a ’dominant’ bit during the ACK SLOT (it sends ’ACK’).

ACK SLOT

All stations having received the matching CRC SEQUENCE report this within the ACK SLOT by superscribing the ’recessive’ bit of the TRANSMITTER by a ’dominant’ bit.

ACK DELIMITER

The ACK DELIMITER is the second bit of the ACK FIELD and has to be a ’recessive’ bit. As a consequence, the ACK SLOT is surrounded by two ’recessive’ bits (CRC DELIMITER, ACK DELIMITER).

End of Frame

Each DATA FRAME and REMOTE FRAME is delimited by a flag sequence consisting of seven ’recessive’ bits.

retour.gif (1245 byte)


Remote frame

remote_frame.gif (4636 byte)

Source: ROBERT BOSCH GmbH

Data Request Frame from a control unit. The DATA FRAME that will follow will have the same Identifier.

retour.gif (1245 byte)


Error frame

error_frame.gif (3080 byte)

Source: ROBERT BOSCH GmbH

ERROR FLAG

There are 2 forms of an ERROR FLAG: an ACTIVE ERROR FLAG and a PASSIVE ERROR FLAG.

  1. The ACTIVE ERROR FLAG consists of six consecutive ’dominant’ bits.

  2. The PASSIVE ERROR FLAG consists of six consecutive ’recessive’ bits unless it is overwritten by ’dominant’ bits from other nodes.

An ’error active’ station detecting an error condition signals this by transmission of an ACTIVE ERROR FLAG. The ERROR FLAG’s form violates the law of bit stuffing (see CODING) applied to all fields from START OF FRAME to CRC DELIMITER or destroys the fixed form ACK FIELD or END OF FRAME field. As a consequence, all other stations detect an error condition and on their part start transmission of an ERROR FLAG. So the sequence of ’dominant’ bits which actually can be monitored on the bus results from a superposition of different ERROR FLAGs transmitted by individual stations. The total length of this sequence varies between a minimum of six and a maximum of twelve bits.

An ’error passive’ station detecting an error condition tries to signal this by transmission of a PASSIVE ERROR FLAG. The ’error passive’ station waits for six consecutive bits of equal polarity, beginning at the start of the PASSIVE ERROR FLAG. The PASSIVE ERROR FLAG is complete when these 6 equal bits have been detected.

ERROR DELIMITER

The ERROR DELIMITER consists of eight ’recessive’ bits.

After transmission of an ERROR FLAG each station sends ’recessive’ bits and monitors the bus until it detects a ’recessive’ bit. Afterwards it starts transmitting seven more ’recessive’ bits.

retour.gif (1245 byte)


Overload frame

overload_frame.gif (3641 byte)

Source: ROBERT BOSCH GmbH

The OVERLOAD FRAME contains the two bit fields OVERLOAD FLAG and OVERLOAD DELIMITER.

There are two kinds of OVERLOAD conditions, which both lead to the transmission of an OVERLOAD FLAG:

  1. The internal conditions of a receiver, which requires a delay of the next DATA FRAME or REMOTE FRAME.

  2. Detection of a ’dominant’ bit during INTERMISSION.

The start of an OVERLOAD FRAME due to OVERLOAD condition 1 is only allowed to be started at the first bit time of an expected INTERMISSION, whereas OVERLOAD FRAMEs due to OVERLOAD condition 2 start one bit after detecting the ’dominant’ bit.

At most two OVERLOAD FRAMEs may be generated to delay the next DATA or REMOTE FRAME.

OVERLOAD FLAG

It consists of six ’dominant’ bits. The overall form corresponds to that of the ACTIVE ERROR FLAG.

The OVERLOAD FLAG’s form destroys the fixed form of the INTERMISSION field. As a consequence, all other stations also detect an OVERLOAD condition and on their part start transmission of an OVERLOAD FLAG. (In case that there is a ’dominant’ bit detected during the 3rd bit of INTERMISSION locally at some node, the other nodes will not interpret the OVERLOAD FLAG correctly, but interpret the first of these six ’dominant’ bits as START OF FRAME. The sixth ’dominant’ bit violates the rule of bit stuffing causing an error condition).

OVERLOAD DELIMITER

It cconsists of eight ’recessive’ bits.

The OVERLOAD DELIMITER is of the same form as the ERROR DELIMITER. After transmission of an OVERLOAD FLAG the station monitors the bus until it detects a transition from a ’dominant’ to a ’recessive’ bit. At this point of time every bus station has finished sending its OVERLOAD FLAG and all stations start transmission of seven more ’recessive’ bits in coincidence.

retour.gif (1245 byte)


Interframe spacing

DATA FRAMEs and REMOTE FRAMEs are separated from preceding frames whatever type they are (DATA FRAME, REMOTE FRAME, ERROR FRAME, OVERLOAD FRAME) by a bit field called INTERFRAME SPACE.

In contrast, OVERLOAD FRAMEs and ERROR FRAMEs are not preceded by an INTERFRAME SPACE and multiple OVERLOAD FRAMEs are not separated by an INTERFRAME SPACE.

The INTERFRAME SPACE contains the bit fields INTERMISSION and BUS IDLE and, for ’error passive’ stations, which have been TRANSMITTER of the previous message, SUSPEND TRANSMISSION.

interframe_space_1.gif (2397 byte)

Source: ROBERT BOSCH GmbH

interframe_space_2.gif (2718 byte)

Source: ROBERT BOSCH GmbH

INTERMISSION

It consists of three ’recessive’ bits.

During INTERMISSION no station is allowed to start transmission of a DATA FRAME or REMOTE FRAME. The only action to be taken is signalling an OVERLOAD condition.

BUS IDLE

The period of BUS IDLE may be of arbitrary length. The bus is recognized to be free and any station having something to transmit can access the bus.

A message, which is pending for transmission during the transmission of another message, is started in the first bit following INTERMISSION.

The detection of a ’dominant’ bit on the bus is interpreted as a START OF FRAME.

SUSPEND TRANSMISSION

After an ’error passive’ station has transmitted a message, it sends eight ’recessive’ bits following INTERMISSION, before starting to transmit a further message or recognizing the bus to be idle.

If meanwhile a transmission (caused by another station) starts, the station will become receiver of this message.

retour.gif (1245 byte)


EB Last updated on 19 February 2003