Você está na página 1de 21

CAN

Controller Area Network

22/01/2013

CAN

CAN Agenda
What is CAN ? Why CAN ? CAN Protocol CAN Higher Layer Protocols CAN Applications AT91 CAN Microcontrollers Roadmap

22/01/2013

CAN

What is CAN ?
The CAN is an ISO standard (ISO 11898) for serial communication Today CAN has gained widespread use: Industrial Automation Automotive, etc. The CAN standard includes: Physical layer Data-link layer Some message types Arbitration rules for bus access Methods for fault detection and fault confinement

22/01/2013

CAN

Why CAN ?
Mature Standard CAN protocol more than 16 years Numerous CAN products and tools on the market Hardware implementation of the protocol Combination of error handling and fault confinement with high transmission speed (up to 1Mb/s) Simple Transmission Medium Twisted pair of wires is the standard, but also just one wire will work Other links works, too: Opto - or radio links Excellent Error Handling CRC error detection mechanism Fault Confinement Built-in feature to prevent faulty node to block system Most used protocol in industrial and automotive world
4


22/01/2013

Protocol - CAN

CAN Protocol

22/01/2013

Protocol - CAN

ISO-OSI Reference Model


7. Application Layer
HLPs: CANopen, DeviceNet, OSEK/VDX

6. Presentation Layer
CAN Layers

5. Session Layer 4. Transport Layer 3. Network Layer

Partially Implemented by High Layer Protocol (HLP)

2. Data Link Layer


CAN Protocol

1. Physical Layer

22/01/2013

Protocol - CAN

Typical CAN Node

Controller

CAN Controller RXD

CAN Transceiver CAN_L

CAN Bus is a simple 2-wire differential serial bus CAN Bus is terminated on each side by a 120 Ohm resistor
22/01/2013
7

CAN Bus

TXD

CAN_H

Protocol - CAN

Error Detection Analysis


Error statistics depend on the entire environment Total number of nodes Physical layout EMI disturbance Automotive example 2000 hours/year Baud rate: 500 kbps 25% bus load

One undetected error every 1000 years !!!


22/01/2013
8

HLP - CAN

CAN High Layer Protocols

22/01/2013

HLP - CAN

HLP Definition
CAN protocol defines only the physical and a low data link layer ! The HLP defines: Start-up behavior Definition of message identifiers for the different nodes Flow control Transportation of messages > 8bytes Definition of contents of Data Frames Status reporting in the system

One undetected error every 1000 years !!!


22/01/2013
10

HLP - CAN

CAN Kingdom
CAN Kingdom is more than a HLP (Meta Protocol): Introduced by KVASER, Sweden A King (system designer) takes the full responsibility of the system The King is represented by the Capital (supervising node)s CAN Kingdom provides simple unique identification of system nodes Applications Machine Automation Advantages Designed for safety critical applications Real time performance Scalability Integration of DeviceNet modules in CAN Kingdom possible

22/01/2013

11

Applications - CAN

CAN Applications

22/01/2013

12

Applications - CAN

CAN: a Large Field of Applications


Building Automation: Heating control, Air Conditioning, Security, Access & Light Control Domestic & Food distribution appliances Washing machines, dishes cleaner, self-service bottle distributors Automotive & Transportation Dash Board, Power train & Car Body Train, bus and truck equipment Robotic Production Automation: Control & link of production machines Medical Agriculture Harvester, seeding, sowing machines, tractor control...
13

22/01/2013

AT91SAM7 - CAN

AT91SAM7 CAN Embedded Controllers A1 - A2 - A3 - X

22/01/2013

14

AT91SAM7 - CAN

CAN Controllers Types


3 types of CAN controllers exist: CAN Controllers 2.0 Part A: standard frames CAN Controllers 2.0 Part B Passive or extended frames passive CAN Controllers 2.0 Part B Active or extended frames active CAN Implementations: 2 main implementations strategy BasicCAN: cheaper CAN Controller 1 or 2 Rx buffers (FIFO) and 1 Tx buffer Minimal Filtering FullCAN: high performance CAN Controllers Set of buffers called Mailboxes Dedicated Mailbox Filtering Our CANs: 2.0A/2.0B (Active) & FullCAN
22/01/2013
15

SAM7A3 / SAM7X - CAN

AT91SAM7A3 AT91SAM7X CAN Controller

22/01/2013

16

SAM7A3 / SAM7X - CAN

CAN Controller Structure

22/01/2013

17

SAM7A3 / SAM7X - CAN

Mailbox Organisation
Mailbox x
CAN_MMRx Eight 32-bit registers by mailbox Mailbox x Mode Register Mailbox x Acceptance Mask Register Mailbox x ID Register Mailbox x Family ID Register Mailbox x Status Register Mailbox x Data Low Register Mailbox x Data High Register Mailbox x Control Register CAN_MAMx CAN_MIDx CAN_MFIDx CAN_MSRx CAN_MDLx CAN_MDHx CAN_MCRx

Mailbox Channel Buffer


22/01/2013
18

SAM7A3 / SAM7X - CAN

Mailbox Priority
Mailbox Mode Register

PRIOR

16

Reception Modes: In this modes, the mailbox with the lowest number is serviced first. Transmission Modes: Mailbox with the highest priority PRIOR lowest value. When several mailboxes try to transmit a message at the same time, the mailbox with the highest priority is services first. If at least two mailboxes have the same priority (same PRIOR value), the mailbox with the lowest number is serviced first.

22/01/2013

19

SAM7A3 / SAM7X - CAN

Multiple Transfer or Abort Requests


The CAN Transfer Command Register (CAN_TCR) allows to perform several transfer requests at the same time.
The CAN Abort Command Register (CAN_ACR) allows to perform several abort requests at the same time.

22/01/2013

20

CAN

THANK YOU !

22/01/2013

21

Você também pode gostar