You are on page 1of 41

Controller Area Network

(CAN)

Presented by
Krishna Raj S R
14182009
Systems Engineering
IIT BHU , Varanasi

on Computer Networks

Why CAN?

Need
History
Layered

Structure
Message Format
Arbitration Policy
Error Detection
Implementation
Scope of the Presentation

Before CAN
Conventional multi-wire looms

http://canbuskit.com/what.php

With CAN
Conventional multi-wire looms

CAN bus network

vs.
http://canbuskit.com/what.php

Before CAN
6

With CAN
7

Serial

communications protocol
Efficiently supports distributed realtime
control
Very high level of security.
Message Oriented

What is CAN?

CAN has the following properties


Prioritization of messages
Guarantee of latency times
Configuration flexibility
Multicast reception with time synchronization
System wide data consistency
Multi-master
Error detection and signalling
Automatic retransmission of corrupted messages as soon as the bus is idle
again
Distinction between temporary errors and permanent failures of nodes
Autonomous switching off of defect nodes

Properties of CAN

Transmission Characteristics

Up to 1 Mbit/sec.
Common baud rates: 1 MHz, 500 KHz and 125 KHz
All nodes same baud rate
Max length:120 to 15000 (rate dependent)

Mbit/s
40 m
500 kbit/s 110 m
250 kbit/s 240 m
125 kbit/s 500 m

10
esd electronics, Inc. 525 Bernardston Road Greenfield, MA
01301

Who uses CANBUS?


Designed

specifically for automotive applications


Today - industrial automation / medical equipment
100%

CANBUS Market Distribution

90%
80%
70%
60%
50%
40%
30%
20%
10%
0%
Automotive

Markets

Medical / Industrial
11

History

CANBUS History
New

standard - none of the communication protocols


at that time met the specific requirements for speed
and reliability so the engineers developed their own
standard.
First idea - The idea of CAN was first conceived by
engineers at Robert Bosch Gmbh in Germany in the
early 1980s.
Early focus - develop a communication system
between a number of ECUs (electronic control units).
13

CANBUS Timeline
1983

: First CANBUS project at Bosch

1986

: CAN protocol introduced

1987

: First CAN controller chips sold

1991

: CAN 2.0A specification published

1992

: Mercedes-Benz used CAN network

1993

: ISO 11898 standard

1995

: ISO 11898 amendment

Present

: The majority of vehicles use CAN bus.


14

The CAN bus

CAN is a broadcast type of bus.


This means that all nodes can "hear" all transmissions.
There is no way to send a message to just a specific
node; all nodes will invariably pick up all traffic. The CAN
hardware, however, provides local filtering so that each
node may react only on the interesting messages.

15

Message Oriented Transmission Protocol


Each node receiver & transmitter
A sender of information transmits to all devices on the bus
All nodes read message, then decide if it is relevant to them
All nodes verify reception was error-free
All nodes acknowledge reception

CAN bus
16

Basic Configuration
17

Layered Structure

Physical Layer

Bus Levels

ISO-IS 11898. A recessive bit is represented by both CAN bus lines


driven to a level of about 2.5 V so that the differential voltage
between CAN_H and CAN_L is around 0 V.
A dominant bit is represented by CAN_H going to about 3.5 V and
CAN_L going to about 1.5 V. This results in a differential voltage for a
dominant bit of about 2V.
20

Transfer Layer

Data Information Frame Format

SOF Start of Frame

Identifier Tells the content of message and priority

RTR Remote Transmission Request

IDE Identifier extension (distinguishes between CAN standard,11 bit identifier, and CAN
extended, 29 bit identifier.)

DLC Data Length Code

Data holds up to 8 bytes of data

CRC Cyclic Redundant Check sum

ACK Acknowledge

EOF End of Frame

IFS Intermission Frame Space. Minimum number of bits separating consecutive messages.

Types
Data

Frame
Remote Frame
Error Frame
Overload Frame

1. The Data Frame

The most common message type


The Arbitration Field, which determines the priority of the message
when two or more nodes are contending for the bus.
The Arbitration Field contains:
For CAN 2.0A, an 11-bit Identifier and one bit, the RTR bit, which is
dominant for data frames.
For CAN 2.0B, a 29-bit Identifier (which also contains two recessive bits:
SRR and IDE) and the RTR bit.

Data Field, which contains zero to eight bytes of data.


CRC Field, which contains a 15-bit checksum. This checksum is used
for error detection.
Acknowledgement Slot; any CAN controller that has been able to
correctly receive the message sends an Acknowledgement bit at the
end of each message. The transmitter checks for the presence of the
Acknowledge bit and retransmits the message if no acknowledge was
detected.
24

2. The Remote Frame

The Remote Frame is just like the Data Frame, with two important differences:
It is explicitly marked as a Remote Frame (the RTR bit in the Arbitration Field is
recessive), and
there is no Data Field.

The intended purpose of the Remote Frame is to solicit the transmission of the
corresponding Data Frame

Used to implement a type of request-response type of bus traffic management.

CAN controllers can be programmed either to automatically respond to a


Remote Frame, or to notify the local CPU instead.

The Data Length Code must be set to the length of the expected response
message. Otherwise the arbitration will not work.
25

3. The Error Frame


Special message that violates the framing rules of a CAN message.
Transmitted when a node detects a fault and will cause all other nodes to
detect a fault - so they will send Error Frames, too.
The transmitter will then automatically try to retransmit the message.
Error counters ensures that a node can't destroy the bus traffic by
repeatedly transmitting Error Frames.
Error Flag- 6 bits of the same value

The Error Frame

(thus violating the bit-stuffing rule)

Error Delimiter, which is 8 recessive bits.


The Error Delimiter provides some space in which the other
nodes on the bus can send their Error Flags when they detect the
first Error Flag.

26

4 The Overload Frame


It is very similar to the Error Frame with regard to the
format
Transmitted by a node that becomes too busy.
The Overload Frame is not used very often, as today's CAN
controllers are clever enough not to use it.

27

Bus Arbitration

Bus Arbitration
Arbitration needed when multiple nodes try to transmit at the same time
Only one transmitter is allowed to transmit at a time.
A node waits for bus to become idle
Nodes with more important messages continue transmitting

CAN bus

2005 Microchip Technology Incorporated. All Rights


Reserved.

29

Bus Arbitration
Message

importance is encoded in message ID.


Lower value = More important
As a node transmits each bit, it verifies that it sees
the same bit value on the bus that it transmitted.
A 0 on the bus wins over a 1 on the bus.
Losing node stops transmitting, winner continues.

30

Error Detection

Error detection
If

one or more errors are detected, the transmission is aborted.


This prevents all other stations or nodes from accepting the
message.

Re-transmission

is automatic. If errors continue, then the station


or node may switch itself off to prevent the bus from being tied
up.

Error

detection is done on two levels:

Message level
Bit level

Error detection

Message Level

CRC = Cyclic Redundant Check sum


Frame Check = compares message to fixed format and frame size
ACK errors = if transmitter does not receive an ACK signal from
the receivers

Bit level

Monitoring = The transmitter monitors the bus signal as it sends


the message and compares the bit sent to the bit received.
Bit Stuffing = After five consecutive equal bits, the transmitter
inserts a stuff bit with a compliment value into the bit stream. The
receivers remove this stuff bit.

Object layer

CAN Controller Diagram

Implementation 1
Basic

CAN

Limited number of
receive buffers and
filters
Can get bogged down
quickly with multiple
consecutive
messages.

Implementation 2
Full

CAN

Has several message


objects (usually 15)
Can loose data if
message objects are
setup for multiple
filters
Can still get bogged
down if too many
messages are sent
consecutively

Implementation 3

FIFO

First In First Out


receive buffer
Fixes problem with
multiple consecutive
messages
Cannot allow a high
priority message to
move to front. It has
to wait its turn

Implementation 4
Enhanced

Full Can

Dedicated FIFO for


each individual
message object
Very complicated to
use
Less common

Over

20 different chip manufacturers produce


microcontrollers with on-chip CAN interfaces.
Some more notable ones are:

Cygnal
Intel
Motorola
NEC
Phillips
Toshiba

Manufacturers

Manufacturer

and Product List

http://www.can-cia.org/products/can/chips/

CAN

Information

http://www.canbus.us/
http://www.can-cia.org/can/

Useful Links

You might also like