30
CAN Controller Area Network

CAN- controlled area network

Embed Size (px)

DESCRIPTION

CAN TUTORIAL

Citation preview

Page 1: CAN- controlled area network

CANController Area Network

Page 2: CAN- controlled area network

Introduction

Standard to establish Network among microcontrollers Broadcast type of bus No way to send a message to a specific node High speed applications with short messages

Page 3: CAN- controlled area network

Comparing With Other Buses

Bus Transfer Type Transfer Rate (b/s)

Max. Length (m) No. Of Nodes

RS232 Point to point 20k 15 1

RS485 Network 35k 1200 32

I2C Master-Slave 100k 1 128

SPI Master-Slave 110k 1 any

CAN Network 1M 40 2032

USB Master-Slave 480M 5 126

Page 4: CAN- controlled area network

CAN in general………

Multi-master Network 2-wire Half-duplex High-speed (1Mbps) Error Confinement and Error Detection Distance up to 6 mS

Page 5: CAN- controlled area network

History

Introduced by Robert Bosch in 1986 Developed for automotive applications Standardized in 1993 as ISO11898-1 CAN Standards

1. CAN 2.0A2. CAN 2.0B

Page 6: CAN- controlled area network

CAN Standards

1. CAN 2.0AStandard CAN (ISO 11898)11-bit Identifier1 Mbps

2. CAN 2.0BExtended CAN (ISO 11519)29-bit Identifier125 kbps

Page 7: CAN- controlled area network

Reasons for Using CAN

Robustness & Reliability Low Connect Cost Low Cost Components Availability of CAN based Products

Page 8: CAN- controlled area network

Applications

In IndustryTo interconnect Machines, Process Control Units and Production Sub-system

In Building AutomationTo manage Heating, Lighting, Air ventilation and doors

Parameter Setting and control of equipment in agriculture

Page 9: CAN- controlled area network

Layered Structure

CAN Network

Physical Layer

Transfer Layer

Object Layer

Application Layer

Transmission Medium,Signal Level and bit representation

Fault Confinement,Error Detection,

Signaling,Message Validation,Acknowledgement,

Arbitration,Framing,

Transfer Rate and

Timing

Message Filtering,Message and

Status Handling

Page 10: CAN- controlled area network

Network Components

Physical Layer

CAN Controller

Software

Cables

Connectors

Transceivers

Part A

Part B Passive

Part B

Page 11: CAN- controlled area network

Cables

Twisted Pair Cables are used to get higher speeds. The Bit rate of the data transformation is high for short distance and low for long distance.

Bus Length Bit Rate

40 Meters

100 Meters

200 Meters

500 Meters

6 meters

1 Mbps

500 kbps

250 kbps

125 kbps

10 kbps

Page 12: CAN- controlled area network

Connectors

Pin Number

Name Specification

123456789

-CAN_LCAN_GND-CAN SHLDGNDCAN_H-CAN_V+

ReservedCAN_L bus line (dominant low)CAN GroundReservedOptional CAN ShieldOptional CAN GroundCAN_H bus line (dominant high)ReservedOptional Power

Pin Number

Name

12345

DrainV+V-CAN_HCAN_L

Normall

y UsedMini type

Page 13: CAN- controlled area network

CAN Controllers

Part A 11-bit Identifier Above 2000 devices in the Network

Part B Passive 11-bit Identifier

Tolerated 29-bit Identifier, but ignored Part B

29-bit Identifier Above 5 million devices in the Network

Page 14: CAN- controlled area network

Working Principle

Uses CSMA/CD+AMP (Arbitration on Message Priority). Data messages transmitted from any node Using identifier all nodes will check whether the message is intended

for it or not The identifier determines the priority of the message Low bits are always dominant

Page 15: CAN- controlled area network

Frame Types

Data Frame Remote Frame Error Frame Overload Frame

Page 16: CAN- controlled area network

Data Frame (Message Frame)

For 2.0A

Start Of Frame:

Logic 0 indicates the beginning of a message frame.

Arbitration Field:

11-bit identifier. Determines the priority of the message.

Control Field:

6-bits. 2-bits are reserved for future use. 4-bit Data Length Code (DLC) indicates the number of bytes in the data field.

Page 17: CAN- controlled area network

Data Field:

0 to 8 Bytes of data

CRC Field:

15-bits Cyclic Redundancy Check Code and 1-bit delimiter

Acknowledgement Field:

2-bits. Slot bit (1) overwritten by dominant bit from other nodes and delimiter bit (1).

End Of Frame Field:

7-bits (1111111). Indicates the End of the data frame.

Following the End Of Field is the Intermission field consisting of 3-bits (111) denotes the bus is recognized to be free.

Page 18: CAN- controlled area network

For 2.0B

SRR (Substitute Remote Request)

IDE (Identifier Extension)

The max. no. of user in 2.0A is 2032

The max. no. of user in 2.0B is above 5 million

Page 19: CAN- controlled area network

Remote Frame

The intended purpose of this frame is to ask for the transmission of the corresponding data frame. It is also used implement a type of request-response type of bus traffic management.

Page 20: CAN- controlled area network

Error Frame

Consists of error flag (6-bits) and error delimiter (8-bits).

Transmitted when a node detects a fault and will cause all other nodes to detect a fault

Page 21: CAN- controlled area network

Overload Frame

This frame is mentioned just for completeness of the transaction.

Page 22: CAN- controlled area network

Error Detection and Confinement

Error is detected by the CAN Controller Error Frame is transmitted Message is cancelled at all nodes Status of the CAN Controllers are updated The message is retransmitted

Page 23: CAN- controlled area network

Difference Between CAN, LIN, I2Cprotocol I2C SPI CAN

Protocol Synchronous interface used on PCB Synchronous interface used on PCB CAN is Asynchronous Interface & uses wires for long distance communications.

Invented Philips Motorola Bosch

Data rate I2C Supports Speed is :100Kbps(Standard) :400Kbps(Fast) :3.4Mbps(High Speed)

SPI Supports : 3Mbps to 10Mbps 10Kbps to 1 Mbps

master I2C is multi-master, Address based Communication

SPI is Master Slave, With Slave select(SS) based Communication

MultiMate , Message based communications, Reliable

Pins required I2C needs 2 pins SPI needs 3+n pins (n is no. of devices)

CAN H and CAN L

supports I2C supports 127 devices limited by available Chip selects 2043 devices

© 2008 Pantech Solutions™ | All rights reserved | www.panetchsolutions.net

Page 24: CAN- controlled area network

Difference Between CAN, LIN, I2C

protocol I2C SPI CANcommunication I2C is half duplex as there are only

two lines(SCL and SDA) SPI is Full Duplex as between a Master and a dedicated slave as selected by slave select signal; there are 4 lines (Spi_clk,Spi_datain,Spi_dataout and slave select).So, at any given time data can be sent and received by the master on two separate lines.

Half duplex

whereas the I2c is generally used in same PCB

whereas the SPI is generally used in same PCB

CAN is generally used for device net (different device at different location)

bus arbitration is possible in case of i2c.

not in case of spi.

noise sensitivity of i2c is high... there is chance to corrupt the r/w bit... then whole data is corrupted

But in case of spi.. Chance is very less as whole word is transmitted.

Single duplex Full duplex operation Half duplex

© 2008 Pantech Solutions™ | All rights reserved | www.panetchsolutions.net

Page 25: CAN- controlled area network

Types Of Errors

Bit Error – The node always reads the message as it is sending. If it find a different value on the bus than it send, it detects the bit error.

Bit Stuffing Error – If a receiving node found more than five consecutive bits it detects the error.

Checksum Error Frame Error – Invalid bit error Acknowledgement Error

Page 26: CAN- controlled area network

Error Modes

Error Active – Active Error Flag is send and the data are transmitted and received usually

Error Passive – When Controller has frequent problems and Passive Error Flag is sent

Bus Off – When controller has serious problems . No messages can be transmitted or received

Page 27: CAN- controlled area network

Error Process

Two Error Counters are allocated for controlling the error mode. The error counters are transmit error count and receive error count

Page 28: CAN- controlled area network

For more details

www.pantechsolutions.nethttp://www.slideshare.net/pantechsolutionshttp://www.scribd.net/pantechsolutionshttp://www.youtube.net/pantechsolutions

Page 29: CAN- controlled area network

© 2008 Pantech Solutions™ | All rights reserved | www.panetchsolutions.net

Page 30: CAN- controlled area network

© 2008 Pantech Solutions™ | All rights reserved