controller area network (can)

41
Controller Area Network (CAN) Presented by Krishna Raj S R 14182009 Systems Engineering IIT BHU , Varanasi on Computer Networks

Upload: krishna-raj-s-r

Post on 24-Dec-2015

23 views

Category:

Documents


6 download

DESCRIPTION

NeedHistoryLayered StructureMessage FormatArbitration PolicyError DetectionImplementation

TRANSCRIPT

Page 1: Controller Area Network (CAN)

Controller Area Network (CAN)

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

Page 2: Controller Area Network (CAN)

Why CAN?

Page 3: Controller Area Network (CAN)

Scope of the Presentation

NeedHistoryLayered StructureMessage FormatArbitration PolicyError DetectionImplementation

Page 4: Controller Area Network (CAN)

Before CAN

4

Conventional multi-wire looms

http://canbuskit.com/what.php

Page 5: Controller Area Network (CAN)

With CAN

5

Conventional multi-wire looms CAN bus network

vs.

http://canbuskit.com/what.php

Page 6: Controller Area Network (CAN)

6

Before CAN

Page 7: Controller Area Network (CAN)

7

With CAN

Page 8: Controller Area Network (CAN)

What is CAN?

Serial communications protocolEfficiently supports distributed realtime

control Very high level of security.Message Oriented

Page 9: Controller Area Network (CAN)

Properties of 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

Page 10: Controller Area Network (CAN)

Transmission Characteristics

10

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)

© esd electronics, Inc. • 525 Bernardston Road • Greenfield, MA 01301

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

Page 11: Controller Area Network (CAN)

Designed specifically for automotive applicationsToday - industrial automation / medical equipment

Who uses CANBUS?

11

Automotive Medical / Industrial0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%CANBUS Market Distribution

Markets

Page 12: Controller Area Network (CAN)

History

Page 13: Controller Area Network (CAN)

CANBUS History

13

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).

Page 14: Controller Area Network (CAN)

CANBUS Timeline

14

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.

Page 15: Controller Area Network (CAN)

15

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.

Page 16: Controller Area Network (CAN)

Message Oriented Transmission Protocol

16

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

Page 17: Controller Area Network (CAN)

17

Basic Configuration

Page 18: Controller Area Network (CAN)

Layered Structure

Page 19: Controller Area Network (CAN)

Physical Layer

Page 20: Controller Area Network (CAN)

20

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.

Page 21: Controller Area Network (CAN)

Transfer Layer

Page 22: Controller Area Network (CAN)

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.

Page 23: Controller Area Network (CAN)

TypesData FrameRemote FrameError FrameOverload Frame

Page 24: Controller Area Network (CAN)

24

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.

Page 25: Controller Area Network (CAN)

25

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.

Page 26: Controller Area Network (CAN)

26

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.

The Error FrameError Flag- 6 bits of the same value (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.

Page 27: Controller Area Network (CAN)

27

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.

Page 28: Controller Area Network (CAN)

Bus Arbitration

Page 29: Controller Area Network (CAN)

Bus Arbitration

29

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.

Page 30: Controller Area Network (CAN)

Bus Arbitration

30

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.

Page 31: Controller Area Network (CAN)

Error Detection

Page 32: Controller Area Network (CAN)

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

Page 33: Controller Area Network (CAN)

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.

Page 34: Controller Area Network (CAN)

Object layer

Page 35: Controller Area Network (CAN)

CAN Controller Diagram

Page 36: Controller Area Network (CAN)

Implementation 1Basic CAN

◦Limited number of receive buffers and filters

◦Can get bogged down quickly with multiple consecutive messages.

Page 37: Controller Area Network (CAN)

Implementation 2Full 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

Page 38: Controller Area Network (CAN)

Implementation 3FIFO

◦“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

Page 39: Controller Area Network (CAN)

Implementation 4Enhanced Full Can

◦Dedicated FIFO for each individual message object

◦Very complicated to use

◦Less common

Page 40: Controller Area Network (CAN)

Manufacturers

Over 20 different chip manufacturers produce microcontrollers with on-chip CAN interfaces.

Some more notable ones are:◦Cygnal◦ Intel◦Motorola◦NEC◦Phillips◦Toshiba

Page 41: Controller Area Network (CAN)

Useful Links

Manufacturer and Product List◦http://www.can-cia.org/products/can/chips/

CAN Information◦http://www.canbus.us/◦http://www.can-cia.org/can/