can seminar extended

Upload: carlos-calzada

Post on 06-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 CAN Seminar Extended

    1/57

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

    Controller Area Network

    Presented byWilfred Voss

    esd electronics, Inc.525 Bernardston Road

    Greenfield, MA 01038http://www.esd-electronics-usa.com

    Download/View this presentation at:

    http://www.canseminar.com/Tutorials.html/

    Serial Network Technology for Embedded Solutions

  • 8/3/2019 CAN Seminar Extended

    2/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 2

    Literature

    Literature onController Area Network,CANopen and SAE J1939

  • 8/3/2019 CAN Seminar Extended

    3/57

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

    esd electronics, Inc.525 Bernardston RoadGreenfield, MA 01301

    Tel.: 413-773-3170Fax: 413-773-3171

    http://www.esd-electronics-usa.com

    esd electronics provides:

    CAN Hardware Interfaces PCI, cPCI, VME, PMC, PC104, ISA, and more

    CAN Gateways USB, EtherNet, Bluetooth, IEEE488, and more

    CAN Converters CANopen, DeviceNet, Profibus, and more

    CAN Embedded Controllers

    Drivers and APIs for various operating systems

    Free CAN Analyzer software included with driver

    esd Product Line

  • 8/3/2019 CAN Seminar Extended

    4/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 4

    What is CAN General Aspects

    Serial Network Technology for Embedded Solutions

    Network technology established among micro-controllers

    Well suited for high speed/real-time applications

    Replaces expensive Dual-Port RAM technology

    CAN chips manufactured by Motorola, Philips, Intel, Infineon, andmore

    600 Million CAN nodes used in 2007

    Originally designed by Bosch forautomotive industry

    Became very popular in industrialautomation

  • 8/3/2019 CAN Seminar Extended

    5/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 5

    What is CAN Technical Aspects

    High-integrity serial data communications bus for real-timeapplications

    Designed for max. performance & reliability

    Operates at data rates up to 1 Mbit/sec

    Uses short messages 8 bytes per message

    Excellent error detection and fault confinement capabilities

    Is an international standard: ISO 11898

  • 8/3/2019 CAN Seminar Extended

    6/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 6

    A Brief History of CAN - 1

    1983 Start of Bosch internal project to develop in-vehicle network

    1986 Official introduction of the CAN protocol

    1987 First CAN controller chips by Intel & Philips

    1991 Bosch publishes CAN specification 2.0

    1992 CAN in Automation (CiA) established

    1992 CAN Application Layer (CAL) protocol by CiA1992 First automobiles equipped with CAN (Mercedes Benz)

    1993 ISO 11898 standard published

    1994 First International CAN Conference (iCC)

    1994 Allen Bradley introduces DeviceNet

    1995 ISO 11898 amendment (extended frame format)

    1995 CANopen protocol introduced

    2000 Development of time-triggered CAN

  • 8/3/2019 CAN Seminar Extended

    7/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 7

    A Brief History of CAN - 2

    2007

    2006

    2005

    2004

    2003

    2002

    2001

    2000

    1999

    0

    100

    200

    300

    400

    500

    600

    700

    Number of Million CAN Nodes sold:

  • 8/3/2019 CAN Seminar Extended

    8/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 8

    CAN Applications

    CAN is used wherever two or more microprocessor units need tocommunicate with each other.

    Passenger Cars (multiple separate CAN networks)

    Trucks & Buses, Construction Vehicles, Agricultural Vehicles(SAE J1939 protocol)

    Semiconductor Industry (Wafer Handlers, etc.)

    Robotics, Motion Control Applications

    Passenger/Cargo Trains (Brake Control, Wagon Communication)

    Aircrafts (AC, Seat Adjustment)

    Elevators (e.g. Otis)

    Building Technologies (Light & Door Control Systems, Sensors, etc.)

    Medical Equipment (X-Ray, CAT scanners, etc.)

    Household Utilities (Coffee Machine, Washer, etc.)

    Aerospace (Satellites)

  • 8/3/2019 CAN Seminar Extended

    9/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 9

    CiA CAN in Automation

    International Users and Manufacturers Organization Develops, supports CAN Standards and CAN based higher layer

    protocols All activities are based on CiA members interest

    http://www.can-cia.org

    CAN Newsletter

    To subscribe log on to:

    http://www.can-cia.org/newsletter/

  • 8/3/2019 CAN Seminar Extended

    10/57

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

    Main Characteristics

    Multi-Master Bus Access

    Message Broadcasting

    Message Priority (No Node IDs)

    Limited Data Length (08 bytes)

    1 Mbit/sec Data Rate

    Excellent Error Detection & Fault Confinement

  • 8/3/2019 CAN Seminar Extended

    11/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 11

    Benefits of Using CAN

    Main Benefit:

    Physical and Data Link Layer implemented in Silicon

    SW Development Engineer is not involved with writingprotocol features

    Low Cost Implementation

    Be aware! Whenever you attempt to add software functions between the CAN Data Link Layer and the Application Layer, you will be

    adding functionalities that are already covered by off- the-shelf available higher layer protocols such as CANopen and DeviceNet.

    ISO 11898 7-Layer Reference

  • 8/3/2019 CAN Seminar Extended

    12/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 12

    Message Frames

    Data Frame Broadcasts a message to the CAN bus

    Remote Frame Requests transmission of message

    Error Frame Signals error condition

    Overload Frame Special Error Frame

  • 8/3/2019 CAN Seminar Extended

    13/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 13

    Remote Transmission Request

    Data Frame Broadcasts a message to the CAN bus

    Remote Frame Requests transmission of message

  • 8/3/2019 CAN Seminar Extended

    14/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 14

    Message Broadcasting with Data Frames

    Node A transmits a message Nodes B, C and D receive the message Nodes B and D accept the message, Node C declines

  • 8/3/2019 CAN Seminar Extended

    15/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 15

    Message Request with Remote Frames - 1

    Node A sends a remote frame (request)

    Node B, C, D receive message

    Node D accepts, Nodes B & C decline message

  • 8/3/2019 CAN Seminar Extended

    16/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 16

    Message Request with Remote Frames - 2

    Node D sends requested message

    Nodes A, B, C receive requested message

    Nodes A, B accept requested message, Node C declines

  • 8/3/2019 CAN Seminar Extended

    17/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 17

    Message Frame Format - 1

    Data Frame

    Remote Frame

    Error/Overload Frame

  • 8/3/2019 CAN Seminar Extended

    18/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 18

    Message Frame Format - 2

  • 8/3/2019 CAN Seminar Extended

    19/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 19

    Extended CAN Protocol

    Standard Format: 11 Bit Message Identifier

    Extended Format: 29 Bit Message Identifier

    Both formats, Standard and Extended, may co-exist on the same CANbus

    The distinction between both formats is managed by IdentifierExtension Bit (IDE)

  • 8/3/2019 CAN Seminar Extended

    20/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 20

    Dominant/Recessive Bus Level

    Node Output and Resulting Bus Level

    Bi M i i

  • 8/3/2019 CAN Seminar Extended

    21/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 21

    Bit Monitoring

    Each transmitting node monitors the Bit level on the bus,compares it to transmitted level.

    Used during arbitration process.

    Provides immediate detection of all bus-wide and local transmissionerrors.

    B A bit ti P i i l 1

  • 8/3/2019 CAN Seminar Extended

    22/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 22

    Bus Arbitration Principle - 1

    B A bit ti P i i l 2

  • 8/3/2019 CAN Seminar Extended

    23/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 23

    Bus Arbitration Principle - 2

    B A bit ti P i i l 3

  • 8/3/2019 CAN Seminar Extended

    24/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 24

    Bus Arbitration Principle - 3

    Main Rules of Bus Arbitration

    Bus is considered idle after transmitted message plus IntermissionField

    Node that transmits message with lowest ID (highest priority) winsarbitration, continues to transmit. Competing nodes switch toreceiving mode.

    Nodes that lost arbitration will start new arbitration as soon as bus is

    free for access again => No message gets lost

    D t T f S h i ti 1

  • 8/3/2019 CAN Seminar Extended

    25/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 25

    Data Transfer Synchronization - 1

    Bit Coding

    Bit coding according to Non-Return-to-Zero principle

    NRZ provides highest transport capacity

    Constant Bit level over Bit time

    Insufficient signal edges for synchronization of Bit stream

    Bit Stuffing required

    D t T f S h i ti 2

  • 8/3/2019 CAN Seminar Extended

    26/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 26

    Data Transfer Synchronization - 2

    Bit Stuffing

    Sender inserts complementary Bit (Stuff Bit) after 5 successive Bitsof same polarity

    Receiver filters the complementary Bit

    1. Bit sequence to betransmitted

    2. Transmitted Bit sequence onbus after bit stuffing

    3. Bit sequence at receiverafter filtering Stuff Bit

    D t T f S h i ti 3

  • 8/3/2019 CAN Seminar Extended

    27/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 27

    Data Transfer Synchronization - 3

    Bit Stuffing

    Provides additional signal edges for data synchronization

    No Bit Stuffing in static format fields of message frame

    Special case: Stuff Bit contributes to 5 Bit sequence

    Further Bit Synchronization through

    Programmable Phase Buffers

    Resynchronization Jump Width

    Bit St ffi R

  • 8/3/2019 CAN Seminar Extended

    28/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 28

    Bit Stuffing Range

    Frame Length Due to Bit Stuffing

  • 8/3/2019 CAN Seminar Extended

    29/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 29

    Frame Length Due to Bit Stuffing

    Frame length varies due to bit stuffing

    Based on 11-Bit Identifier

    Average bit stuffing determined per mathematical model

    Data Field0 Bytes

    Data Field8 Bytes

    No bit stuffing 47 bits 111 bits

    Max. bit stuffing

    (worst case scenario)

    55 bits 135 bits

    Average bit stuffing 49 bits 114 bits

    Bit Monitoring 1

  • 8/3/2019 CAN Seminar Extended

    30/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 30

    Bit Monitoring - 1

    When exactly does a receiving CAN node read the

    bit information ?

    Bit Rate[kBit/sec]

    Nominal Bit-Time[sec]

    1000 1

    500 2

    250 4

    125 8

    Bit Monitoring 2

  • 8/3/2019 CAN Seminar Extended

    31/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 31

    Bit Monitoring - 2

    Partitioning of CAN Bit Time into Four Segments

    Sync_Seg: Signal edge is expected here. Any deviationwill affect Phase Buffer lengths.

    Prop_Seg: Compensates for signal propagation times

    within the network.Phase_Seg1/2: Compensate for signal edge phaseerrors by adjusting their length.

    Resynchronization Jump Width: Defines the upperlimit to adjust phase buffer lengths.

    Hard Synchronization

  • 8/3/2019 CAN Seminar Extended

    32/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 32

    Hard Synchronization

    Hard Synchronization at Start of Frame (SOF)

    Resets internal timing of receiving node

    Bit Synchronization

  • 8/3/2019 CAN Seminar Extended

    33/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 33

    Bit Synchronization

    Bit Synchronization within a frame

    Phase_Seg1 and Phase_Seg2 correct position ofbit sample point according to phase error

    Ideal Bit Timing

    Phase Errors

  • 8/3/2019 CAN Seminar Extended

    34/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 34

    Phase Errors

    Positive Phase Error

    Negative Phase Error

    Compensation of Phase Errors

  • 8/3/2019 CAN Seminar Extended

    35/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 35

    Compensation of Phase Errors

    Compensation of Positive Phase Error

    Compensation of Negative Phase Error

    Error Detection Method

  • 8/3/2019 CAN Seminar Extended

    36/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 36

    Error Detection Method

    Bit Monitoring

    Each transmitting node monitors the Bit level on the bus, compares it totransmitted level. Provides immediate detection of all bus-wide and localtransmission errors.

    Stuff Error

    More than 5 Bits of same polarity outside of bit-stuffed segment

    CRC Error

    Comparison of received CRC sequence and calculated CRC. Providesdetection of local receiver errors.

    Form Error

    Violation of fixed format Bit fields Acknowledgement Error

    Transmitted message receives no acknowledgement. ACK confirms onlythe successful transmission. Is used for error confinement.

    Error Detection Analysis

  • 8/3/2019 CAN Seminar Extended

    37/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 37

    Error Detection Analysis

    Probability of non-detected faulty CAN messages

    Example:

    1 Bit error each 0.7 sec

    500 kBit/sec

    8 h/day

    365 days/year

    Residual Error Probability :

    1 undetected error in 1000 years

    Error Detection

  • 8/3/2019 CAN Seminar Extended

    38/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 38

    Error Detection

    Error Frame

    Basic Error Frame

    More realistic Error Frame

    Error Recovery Time = Error Flag + Error Delimiter + Intermission Field = 12 + 8 + 3 = 23 Bits

    Error Frame Super Positioning

  • 8/3/2019 CAN Seminar Extended

    39/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 39

    Error Frame Super Positioning

    Fault Confinement - 1

  • 8/3/2019 CAN Seminar Extended

    40/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 40

    Fault Confinement - 1

    Guarantees proper network operation even in cases wheremalfunctioning nodes produce continuous error condition

    CAN error detection can pinpoint to perpetrator

    Distinction between temporary and permanent node failures

    Identification and removal (self-retirement) of malfunctioning nodesfrom the bus

    Transmit/Receive Errors

  • 8/3/2019 CAN Seminar Extended

    41/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 41

    Transmit/Receive Errors

    Possible error scenarios in a CAN network:

    1. Transmit Error

    A transmitting node sends a faulty message

    ALL receiving nodes in the network respond with an error frame

    Through majority vote the transmitting node is being flagged as theperpetrator

    2. Receive Error

    A transmitting node send a perfectly good message

    Only ONE node in the network responds with an error frame

    Through majority vote the error reporting node is being flagged asthe perpetrator

    Fault Confinement - 2

  • 8/3/2019 CAN Seminar Extended

    42/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 42

    Fault Confinement 2

    CAN Node Error States

    Bus Medium

  • 8/3/2019 CAN Seminar Extended

    43/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 43

    Bus Medium

    Physical media must support dominant and recessive bus level.Dominant level always overrules recessive level, especially during busarbitration.

    Two-wire bus terminated with line impedance to avoid signalreflections

    Bus Topology

  • 8/3/2019 CAN Seminar Extended

    44/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 44

    Bus Topology

    Bus Topology according to ISO 11898

    Bus Level - 1

  • 8/3/2019 CAN Seminar Extended

    45/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 45

    Bus Level 1

    Bus Levels according to ISO 11898

    Bus Level - 2

  • 8/3/2019 CAN Seminar Extended

    46/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 46

    Bus Level 2

    Bus Levels according to ISO 11898

    Bus Connection

  • 8/3/2019 CAN Seminar Extended

    47/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 47

    Bus Connection

    Maximum Bus Length

  • 8/3/2019 CAN Seminar Extended

    48/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 48

    Maximum Bus Length

    Bus Length is limited due to Bit Monitoring(Signal Propagation Time)

    Wiring and Connections

  • 8/3/2019 CAN Seminar Extended

    49/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 49

    Wiring and Connections

    Pin Signal Description

    1 - Reserved

    2 CAN_L CAN_L bus line (dominant low)

    3 CAN_GND CAN Ground

    4 - Reserved

    5 CAN_SHLD Optional CAN shield

    6 GND Optional CAN Ground

    7 CAN_H CAN_H bus line (dominant high)

    8 - Reserved (error line)

    9 CAN_V+ Optional CAN external positive supply

    CAN Controller Chips - 1

  • 8/3/2019 CAN Seminar Extended

    50/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 50

    C Co t o e C ps

    Two different types of CAN applications:

    Stand-Alone CAN Controller

    Microprocessor with integrated CAN Controller

    Many major semiconductor manufacturers, such as Motorola, Philips,Intel, Infineon, and many more, sell CAN chips.

    Most semiconductor manufacturers who usually integrated a UART withtheir microprocessor design, in order to support serial communication forRS 232/485, nowadays tend to integrate CAN instead.

    CAN Controller Chips - 2

  • 8/3/2019 CAN Seminar Extended

    51/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 51

    p

    Basic CAN

    One receive, one transmit message FIFO buffer

    Low cost solution

    Requires good CPU performance or low CAN data traffic

    Full CAN

    Several programmable receive and/or transmit message buffers

    Most designs also provide Basic CAN features

    Allows low CPU performance or high CAN data traffic

    CAN Development Tools - 1

  • 8/3/2019 CAN Seminar Extended

    52/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 52

    p

    What you need is

    The regular tools such as cross-compiler, emulator, etc.

    CAN Hardware Interface (Starter Kit)

    For more information on CAN Starter Kits log on to:http://www.canstarterkit.com

    CAN Development Tools - 2

  • 8/3/2019 CAN Seminar Extended

    53/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 53

    p

    What you need is

    CAN API for your own programming (should be included with HW)

    CAN Analyzer Software

    For more information on free CAN Analyzer software log on to:

    http://www.canstarterkit.com or http://www.USBtoCAN.com

    Higher Layer Protocols - 1

  • 8/3/2019 CAN Seminar Extended

    54/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 54

    g y

    Why Higher Layer Protocols?

    Data Transport of more than 8 bytes

    Embedded Systems require appropriate communication model based onMaster/Slave configuration

    Network Management (Network Start-Up, Node Monitoring, NodeSynchronization, etc.)

    Higher Layer Protocols - 2

  • 8/3/2019 CAN Seminar Extended

    55/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 55

    g y

    CANopen

    Suited for embedded applications

    Was originally designed for motion control

    Developed/Maintained by CAN-in-Automation User Group

    Manufacturer-Independent Protocol

    http://www.can-cia.org

    DeviceNet

    Suited for industrial applications (floor automation) Developed by Allen Bradley/Rockwell

    Maintained by Open DeviceNet Vendor Association (ODVA)

    Standard controlled by Allen Bradley/Rockwell

    http://www.odva.org

    SAE J 1939

    Communication for vehicle networks (trucks, buses, etc.)

    Standard developed by Society of Automotive Engineers (SAE)

    http://www.sae.org

    More Info on CAN

  • 8/3/2019 CAN Seminar Extended

    56/57

    esd electronics, Inc. 525 Bernardston Road Greenfield, MA 01301 Page 56

    CAN-in-Automation (CiA)

    http://www.can-cia.org

    Open DeviceNet Vendor Association (ODVA)

    http://www.odva.org

    Society of Automotive Engineers (SAE)http://www.sae.org

    Robert Bosch GmbH

    http://www.semiconductors.bosch.de/en/20/can/index.asp

    Literature

  • 8/3/2019 CAN Seminar Extended

    57/57

    Literature onController Area Network,CANopen and SAE J1939