ECE 371 Controller Area Network (CAN) Overview. Controller Area Network The development of CAN began when more and more electronic devices were implemented.

Slides:



Advertisements
Similar presentations
Nick Feamster CS 4251 Computer Networking II Spring 2008
Advertisements

Contents Overview Data Information Frame Format Protocol
Introduction to CAN.
INPUT-OUTPUT ORGANIZATION
Ethernet “dominant” LAN technology: cheap $20 for 100Mbs!
HIGH-LEVEL DATA LINK CONTROL (HDLC) HDLC was defined by ISO for use on both point-to-point and multipoint data links. It supports full-duplex communication.
Setha Pan-ngum. History of CAN [1] It was created in mid-1980s for automotive applications by Robert Bosch. Design goal was to make automobiles more reliable,
Ethernet – CSMA/CD Review
William Stallings Data and Computer Communications 7th Edition
Slide 1 Industrial Automation - Customer View - Training PhW - CANopen_en 02/ 2002 CANopen QUIZ CANopen QUIZ.
Control Area Network (CAN) Bus. 2 Overview  CAN is an important embedded protocol  Primarily automotive, but used in many other places  CAN specifies:
1 Version 3.0 Module 6 Ethernet Fundamentals. 2 Version 3.0 Why is Ethernet so Successful? In 1973, it could carry data at 3 Mbps Now, it can carry data.
Department of Computer Engineering University of California at Santa Cruz Networking Systems (1) Hai Tao.
1 Version 3 Module 8 Ethernet Switching. 2 Version 3 Ethernet Switching Ethernet is a shared media –One node can transmit data at a time More nodes increases.
William Stallings Data and Computer Communications 7 th Edition Chapter 7 Data Link Control Protocols.
Copyright © 2003, Dr. Dharma P. Agrawal and Dr. Qing-An Zeng. All rights reserved. 1 Chapter 6 Multiple Radio Access.
EE 4272Spring, 2003 Chapter 14 LAN Systems Ethernet (CSMA/CD)  ALOHA  Slotted ALOHA  CSMA  CSMA/CD Token Ring /FDDI Fiber Channel  Fiber Channel Protocol.
Host Data Layer 7 Application Interacts with software requiring network communications; identifies partners, resources and synchronization Layer 6 Presentation.
Dave Mills CANbus: A brief introduction Incorporating: The Fujitsu status Dave Mills Queen Mary, University of London.
 What is a Controller Area Network?  History of CAN  CAN communication protocol  Physical layer  ISO  CiA  CANopen  DeviceNet  Applying.
EECS 373 Controller Area Networks Samuel Haberl Russell Kuczwara Senyuan Zhong.
SERIAL BUS COMMUNICATION PROTOCOLS
The University of New Hampshire InterOperability Laboratory Serial ATA (SATA) Protocol Chapter 10 – Transport Layer.
Data Communications and Networking
University of Tehran 1 Interface Design Vehicle Busses Omid Fatemi.
Controller Area Network Wilmer Arellano, Summer 2007
Unit IV Data Link Control: Data link layer is the second layer in ISO OSI model. The two main functions of DLL are Data link control which deals with the.
Introduction1-1 Data Communications and Computer Networks Chapter 5 CS 3830 Lecture 27 Omar Meqdadi Department of Computer Science and Software Engineering.
In-Vehicle Networking for Heavy Duty Systems Review of CAN / SAE J1939/ ISO BAE 5030 Fall 2001 Instructor: Marvin Stone BAE 5030 Fall 2001 Instructor:
1 Computer Communication & Networks Lecture 13 Datalink Layer: Local Area Network Waleed Ejaz
Data Link Control Protocols Dr. Muazzam A. Khan. Flow Control Ensuring the sending entity does not overwhelm the receiving entity —Preventing buffer overflow.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Department of Electronic Engineering City University of Hong Kong EE3900 Computer Networks Introduction Slide 1 A Communications Model Source: generates.
ECGR 6185 Advanced Embedded Systems Controller Area Network University Of North Carolina Charlotte Bipin Suryadevara.
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK
CCNA 3 Week 4 Switching Concepts. Copyright © 2005 University of Bolton Introduction Lan design has moved away from using shared media, hubs and repeaters.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This training course provides an overview of Message Frames.
Cyclic Redundancy Check (CRC).  An error detection mechanism in which a special number is appended to a block of data in order to detect any changes.
Chapter 1 - Local Area Network Technologies. How IP Datagrams are Encapsulated IP datagrams are found at the OSI Network layer IP datagrams are sent to.
Cisco 3 - Switching Perrine. J Page 16/4/2016 Chapter 4 Switches The performance of shared-medium Ethernet is affected by several factors: data frame broadcast.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
Section 3 - Slide 1/19 P&T - GPS - Formation PhW - CANopen_lev1_en - 01/2004 History CANopen and the ISO model Physical layer Link layer Application layer.
By: M.Nadeem Akhtar1 Data Communication Ch 10. By: M.Nadeem Akhtar2 Networks?  LAN  MAN  WAN.
17 - Winter 2005 ECE ECE 766 Computer Interfacing and Protocols 1 Local Area Networks Need for high performance communications for physically close devices.
CAN Controller Area Network Wilmer Arellano, Summer 2007.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Connecting Devices CORPORATE INSTITUTE OF SCIENCE & TECHNOLOGY, BHOPAL Department of Electronics and.
1 Lecture Controller Area Networks Dr. Tony Grift
Controller Area Network (CAN) is a broadcast, differential serial bus standard, originally developed in the 1980s by Intel and Robert Bosch GmbH, for.
IEEE 802.X Standards The Institute of Electrical and Electronics Engineers (IEEE) has developed a series of networking standards to ensure that networking.
Unit 1 Lecture 4.
EE 122: Lecture 6 Ion Stoica September 13, 2001 (* this talk is based in part on the on-line slides of J. Kurose & K. Rose)
1 May-2014 Automotive Protocols & Standards. 2 CAN (Controller Area Network)  Overview Controller Area Network is a fast serial bus designed to provide.
An Introduction to CAN CAN Basics 2 Renesas Interactive
1 Copyright © 2014 Tata Consultancy Services Limited Controller Area Network (CAN) By Renukacharya A. Thakare.
1 Copyright © Monash University ECS5365 Lecture 2 ISDN Protocols and Standards Philip Branch Centre for Telecommunications and Information Engineering.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
COMPUTER NETWORKS Lecture-8 Husnain Sherazi. Review Lecture 7  Shared Communication Channel  Locality of Reference Principle  LAN Topologies – Star.
Data Link Layer.
Controller Area Network
CAN Controller Area Network 29BIT ID
Controller Area Network (CAN Bus)
Data Link Layer.
Data link layer (LLC).
Asynchronous Serial Communications
Controller Area Networks (CAN)
Chapter 6 Multiple Radio Access.
Data Link Layer. Position of the data-link layer.
Introduction Communication Modes Transmission Modes
Presentation transcript:

ECE 371 Controller Area Network (CAN) Overview

Controller Area Network The development of CAN began when more and more electronic devices were implemented into modern motor vehicles. Examples of such devices include engine management systems, active suspension, ABS, gear control, lighting control, air conditioning, airbags and central locking. All this means more safety and more comfort for the driver and of course a reduction of fuel consumption and exhaust emissions.

To improve the behavior of the vehicle even further, it was necessary for the different control systems (and their sensors) to exchange information. This was usually done by discrete interconnection of the different systems (i.e. point to point wiring). The requirement for information exchange has then grown to such an extent that a cable network with a length of up to several miles and many connectors was required. This produced growing problems concerning material cost, production time and reliability.

The solution to this problem was the connection of the control systems via a serial bus system. This bus had to fulfill some special requirements due to its usage in a vehicle. With the use of CAN, point-to-point wiring is replaced by one serial bus connecting all control systems. This is accomplished by adding some CAN- specific hardware to each control unit that provides the "rules" or the protocol for transmitting and receiving information via the bus.

CAN or Controller Area Network is an advanced serial bus system that efficiently supports distributed control systems. It was initially developed for the use in motor vehicles by Robert Bosch GmbH, Germany, in the late 1980s, also holding the CAN license. CAN is internationally standardized by the International Standardization Organization (ISO) and the Society of Automotive Engineers (SAE). The CAN protocol uses the Data Link Layer and the Physical Layer in the ISO - OSI model. There are also a number of higher level protocols available for CAN. CAN is most widely used in the automotive and industrial market segments. Typical applications for CAN are motor vehicles, utility vehicles, and industrial automation. Other applications for CAN are trains, medical equipment, building automation, household appliances, and office automation. Due to the high volume production in the automotive and industrial markets, low cost protocol devices are available. There are about 20 million CAN nodes in use worldwide. By the year 2000 the number of nodes is estimated to be 140 million. Examples of vehicle bus systems, other than CAN, are A-BUS from Volkswagen, VAN or Vehicle Area Network, from Peugeot and Renault, and J1850 from Chrysler, General Motors and Ford. CAN is the leading vehicle bus protocol in Europe.

Basic Concept CAN is a multi-master bus with an open, linear structure with one logic bus line and equal nodes. The number of nodes is not limited by the protocol. In the CAN protocol, the bus nodes do not have a specific address. Instead, the address information is contained in the identifiers of the transmitted messages, indicating the message content and the priority of the message. The number of nodes may be changed dynamically without disturbing the communication of the other nodes. Multicasting and Broadcasting is supported by CAN.

CAN provides sophisticated error-detection and error handling mechanisms such as CRC check, and high immunity against electromagnetic interference. Erroneous messages are automatically retransmitted. Temporary errors are recovered. Permanent errors are followed by automatic switch-off of defective nodes. There is guaranteed system-wide data consistency. The CAN protocol uses Non-Return-to-Zero or NRZ bit coding. For synchronization purposes, Bit Stuffing is used.

There is a high data transfer rate of 1000 kilobits per second at a maximum bus length of 40 meters or 130 feet when using a twisted wire pair which is the most common bus medium used for CAN. Message length is short with a maximum of 8 data bytes per message and there is a low latency between transmission request and start of transmission. The bus access is handled via the advanced serial communications protocol Carrier Sense Multiple Access/Collision Detection with Non- Destructive Arbitration. This means that collision of messages is avoided by bitwise arbitration without loss of time.

Can Messages Broadcast Type of Bus –All Nodes receive all transmissions –No way to send message to specific node –Nodes provide local filtering Receive interesting messages Ignore some messages Maximum message size is 8-bytes Content Addressing => Contents determine address

Transmission Line Characteristic Impedance = 120 Ohms Terminated each End in Characteristic Impedance Wired AND Bus Connection Recessive State = “1” -- Bus Drive = Open Circuit Dominant State = “0” -- Bus Driver = Short Circuit

Bus Properties If 1 Node drives Bus to Dominant State, then Whole Bus sees Dominant State. Bus Terminations –Remove Signal Reflections at End of Bus –Ensure Bus gets correct DC Levels Twisted Pair (Differential) often Used Some Automobiles are Single Ended

Bus Arbitration Nodes transmitting recessive state lose the competition for bus access “Losers” automatically become receivers and stop transmission “Losers” re-attempt transmission when bus becomes available again.

The CAN protocol handles bus accesses according to the concept called “Carrier Sense Multiple Access with Arbitration on Message Priority”. This arbitration concept avoids collisions of messages whose transmission was started by more than one node simultaneously and makes sure the most important message is sent first without time loss. In the picture above you see the trace of the transmit pins of three bus nodes called A, B and C, and the resulting bus state according to the wired-AND principle. If two or more bus nodes start their transmission at the same time after having found the bus to be idle, collision of the messages is avoided by bitwise arbitration. Each node sends the bits of its message identifier and monitors the bus level. At a certain time nodes A and C send a dominant identifier bit. Node B sends a recessive identifier bit but reads back a dominant one. Node B loses bus arbitration and switches to receive mode. Some bits later node C loses arbitration against node A. This means that the message identifier of node A has a lower binary value and therefore a higher priority than the messages of nodes B and C. In this way, the bus node with the highest priority message wins arbitration without losing time by having to repeat the message. Nodes B and C automatically try to repeat their transmission once the bus returns to the idle state. Node B loses against node C, so the message of node C is transmitted next, followed by node B’s message. It is not permitted for different nodes to send messages with the same identifier as arbitration could fail leading to collisions and errors.

Non Return Zero (NRZ) Coding During Bit Time –Dominant = “0” -- Short –Recessive = “1” – Open Bit Stuffing (Synchronize Receivers) –Transmitter Insert “1” after 5 consecutive “0”s Insert “0” after 5 consecutive “1”s –Receive Delete “0” after 5 consecutive “1”s Delete “1” after 5 consecutive “0”s

Propagation Delay Speed of Radio Wave in Free Space –300,000,000 Meters/Sec Speed of Signal over Wire –Depends on Relative Dielectric Constant –Typically 200,000,000 Meters/Sec –8 inches per nanoseconds Length of Bus Limits Bit Rate

Maximum Bus Lengths vs. Clock Speed The maximum CAN bus speed is 1 MBaud, which can be achieved with a bus length of up to 40 meters when using a twisted wire pair. For bus lengths longer than 40 meters the bus speed must be reduced. A 1000 meter bus can still be realised with a 50 KBaud bus speed. For a bus length above 1000 meters special drivers should be used.

Frame Formats

Data Frame : sent out by the source, usually some kind of sensor Remote Frame: sent out by a destination node, usually requesting data from source. Error Frame: sent out by a node that detects error in the transmission, resulting in retransmission of the frame by the source. Overload Frame: same format as error frame, but sent out in the inter frame space, usually generated by a node, if it was unable to start reception of next message. This delays the transmission of a new message. Interframe Space: This is a separation between two different frames. The main purpose of this is to allow time for the nodes to digest the previous message.

Data Frame 12 bits 6 bits ≤ 64 bits 16 bits 2 bits 7 bits 1 bit

CAN 2.0A – Standard Format, CAN 2.0B – Extended Format

A "Data Frame" is generated by a CAN node when the node wishes to transmit data. The Standard CAN Data Frame is shown above. The frame begins with a dominant Start Of Frame bit for hard synchronization of all nodes. The Start of Frame bit is followed by the Arbitration Field consisting of 12 bits: The 11-bit Identifier, which reflects the contents and priority of the message, and the Remote Transmission Request bit. The Remote transmission request bit is used to distinguish a Data Frame (RTR = dominant) from a Remote Frame (RTR = recessive). The next field is the Control Field, consisting of 6 bits. The first bit of this field is called the IDE bit (Identifier Extension) and is at dominant state to specify that the frame is a Standard Frame. The following bit is reserved and defined as a dominant bit. The remaining 4 bits of the Control Field are the Data Length Code (DLC) and specify the number of bytes of data contained in the message (0 - 8 bytes).

The data being sent follows in the Data Field which is of the length defined by the DLC above (0, 8, 16,...., 56 or 64 bits). The Cyclic Redundancy Field (CRC field) follows and is used to detect possible transmission errors. The CRC Field consists of a 15 bit CRC sequence, completed by the recessive CRC Delimiter bit. The next field is the Acknowledge Field. During the ACK Slot bit the transmitting node sends out a recessive bit. Any node that has received an error free frame acknowledges the correct reception of the frame by sending back a dominant bit (regardless of whether the node is configured to accept that specific message or not). From this it can be seen that CAN belongs to the "in-bit-response" group of protocols. The recessive Acknowledge Delimiter completes the Acknowledge Slot and may not be overwritten by a dominant bit. Seven recessive bits (End of Frame) end the Data Frame.

r1, r0 are reserved bits, and are transmitted Dominant DLC3, DLC2, DLC1, DLC0 = Number of Data Bytes (0 to 8)

With the Acknowledge Check the transmitter checks in the Acknowledge Field of a message to determine if the Acknowledge Slot, which is sent out as a recessive bit, contains a dominant bit. If this is the case, at least one other node, (here node B) has received the frame correctly. If not, an Acknowledge Error has occurred and the message has to be repeated. No Error Frame is generated, though.

Remote Frame

Generally data transmission is performed on an autonomous basis with the data source node (e.g. a sensor) sending out a Data Frame. It is also possible, however, for a destination node to request the data from the source by sending a Remote Frame. There are 2 differences between a Data Frame and a Remote Frame. Firstly the RTR-bit is transmitted as a dominant bit in the Data Frame and secondly in the Remote Frame there is no Data Field. In the very unlikely event of a Data Frame and a Remote Frame with the same identifier being transmitted at the same time, the Data Frame wins arbitration due to the dominant RTR bit following the identifier. In this way, the node that transmitted the Remote Frame receives the desired data immediately. If a node wishes to request the data from the source, it sends a Remote Frame with an identifier that matches the identifier of the required Data Frame. The appropriate data source node will then send a Data Frame as a response to this remote request.

Error Delimiter = 8 Recessive Bits Error Flag = 6 Consecutive Dominant Bits (No bit-stuff) Sent anytime from Start of Frame to End of Frame Field All Nodes detect Error and transmit Error Flag. All Nodes monitors bus after Error Flag.

Overload Flag = 6 Dominant Bits Overload Delimiter = 8 Recessive Bits

Interframe Space separates a preceding frame (of whatever type) from a following Data or Remote Frame. Interframe space is composed of at least 3 recessive bits, these bits are termed the Intermission. This time is provided to allow nodes time for internal processing before the start of the next message frame. After the Intermission, for error active CAN nodes the bus line remains in the recessive state (Bus Idle) until the next transmission starts. The Interframe Space has a slightly different format for error passive CAN nodes which were the transmitter of the previous message. In this case, these nodes have to wait another eight recessive bits called Suspend Transmission before the bus turns into bus idle for them after Intermission and they are allowed to send again. Due to this mechanism error active nodes have the chance to transmit their messages before the error passive nodes are allowed to start a transmission.

Errors

CRC error: If the calculated CRC checksum doesn’t match the CRC checksum in the message, then CRC error occurs. Ack error: If no node pulls the Ack field to the dominant state, then it means that no node has received the message and this causes an Ack error. Frame error: If a transmitter detects a dominant bit in one of these 4 segments, CRC Delimiter, Acknowledge Delimiter, End of Frame or Interframe Space, then frame error occurs. Bit error: If a transmitter sends a dominant bit but detects a recessive bit, or vice-versa, then bit error occurs. Stuff error: If bit stuffing is not present or wrong, then stuff error occurs.

RxCAN, TxCAN Connect TXCAN to Bus Via Bus Driver with Balanced output Connect RXCAN to Bus Via Bus Receiver with Balanced Input

Full CAN controller

Full-CAN devices provide the whole hardware for convenient acceptance filtering and message management. For each message to be transmitted or received these devices contain one so called message object in which all information regarding the message (e.g. identifier, data bytes etc.) are stored. During the initialization of the device, the host CPU defines which messages are to be sent and which are to be received. Only if the CAN controller receives a message whose identifier matches with one of the identifiers of the programmed (receive-) message objects the message is stored and the host CPU is informed by interrupt. Another advantage is that incoming Remote Frames can be answered automatically by the Full-CAN controller with the corresponding Data Frame. In this way, the CPU load is strongly reduced compared to the Basic-CAN solution. Using Full CAN devices, high baud rates and high bus loads with many messages can be handled. Many Full-CAN controller provide a "Basic-CAN-Feature": One of their message objects behaves like a Basic-CAN Receive Buffer, i.e. it can be programmed in a way that every message is stored there that does not match with one of the other message objects. This can be very helpful in applications where the number of message objects is not enough to receive all desired messages.

5 CAN Channels

Acceptance Registers 2 Banks of Acceptance Registers –32-bits per Bank 32 bits Acceptance Register Bank 32-bit Acceptance Filter 2 16-bit Acceptance Filters 4 8-bit Acceptance Filters 32-bit Mask Register Per Bank –“0” Compare Bit for Equality –“1” Ignore Bit Comparison

“0” Compare Bit in Acceptance Register for Match “1” Do not Compare Bit in Acceptance Register

If Several Filters Hit, then Selects Filter with Lowest Index. If Filter 2,3,6 are Hit, Register points to 2.

4 Background Receive Buffers 1 Foreground Receive Buffer Implements FIFO to Queue Received Messages 3 Transmit Buffers. Transmit Highest Priority Buffer First

MSCAN interrupts Interrupts Four different types of interrupts: – Wakeup – Error – Receiver Buffer Full – Transmitter Buffer Empty