Professional Documents
Culture Documents
INTRODUCTION
The Controller Area Network (CAN) is a serial communications protocol that efficiently supports distributed real-time control with a very high level of data integrity. Though conceived and defined by BOSCH in Germany for automotive applications, CAN is not restricted to that industry. CAN fullfils the communication needs of a wide range of applications, from high-speed networks to low-cost multiplex wiring. For example, in automotive electronics, engine control units, sensors and anti-skid systems may be connected using CAN, with bit-rates up to 1 Mbit/s. At the same time, it is cost effective to build CAN into vehicle body electronics, such as lamp clusters and electric windows, to replace the wiring harness otherwise required.
The intention of the CAN specification is to achieve compatibility between any two CAN implementations. Compatibility, however, has different aspects with respect to, for example, electrical features and the interpretation of data to be transferred. To achieve design transparency and implementation flexibility CAN has been subdivided into three layers: a. The Object Layer b. The Transfer Layer c. The Physical Layer
The Object Layer and the Transfer Layer comprise all services and functions of the data link layer defined by the ISO/OSI model. The scope of the Object Layer includes: determining which messages are to be transmitted; deciding which messages received by the Transfer Layer are actually to be used; and, providing an interface to the Application Layer related hardware. There is considerable freedom in defining object handling. The Transfer Layer is principally concerned with the transfer protocol, i.e. controlling the framing, performing arbitration, error checking, error signaling and fault confinement. Within the Transfer Layer it is decided whether the bus is free for starting a new transmission, or whether reception of a message is just starting.
MTech (DECS),SJCIT
2011-12
CAN OVERVIEW
Most network applications follow a layered approach to system implementation. This systematic approach enables interoperability between products from different manufacturers. A standard was created by the International Standards Organization (ISO) as a tem- plate to follow for this layered approach. It is called the ISO Open Systems Interconnection (OSI) Network Layering Reference Model. The CAN protocol itself implements most of the lower two layers of this reference model. The communication medium portion of the model was purposely left out of the Bosch CAN specification to enable system designers to adapt and optimize the communication protocol on multiple media for maximum flexibility (twisted pair, single wire, optically isolated, RF, IR, etc.). With this flexibility, however, comes the possibility of interoperability concerns. To ease some of these concerns, the International Standards Organization and Society of Automotive Engineers (SAE) have defined some protocols based on CAN that include the Media Dependant Interface definition such that all of the lower two layers are specified. ISO11898 is a standard for high-speed applications, ISO11519 is a standard for low-speed applications, and J1939 (from SAE) is targeted for truck and bus applications. All three of these protocols specify a 5V differential electrical bus as the physical interface. The rest of the layers of the ISO/OSI protocol stack are left to be implemented by the system software developer. Higher Layer Protocols (HLPs) are generally used to implement the upper five layers of the OSI Reference Model. HLPs are used to: 1) standardize startup procedures including bit rates used, 2) distribute addresses among participating nodes or types of messages, 3) determine the structure of the messages, and 4) provide system-level error handling routines. This is by no means a full list of the functions HLPs perform, however it does describe some of their basic functionality. The below figure shows how the control functions before using the Controller area network and also shows the control functions by using Controller area network.
MTech (DECS),SJCIT
2011-12
Many vehicles already have a large number of electronic control systems. The growth of automotive electronics is the result partly of the customers wish for better safety and greater comfort and partly of the governments requirements for improved emission control and reduced fuel consumption. Control devices that meet these requirements have been in use for some time in the area of engine timing, gearbox and carburetor throttle control and in anti-block systems (ABS) and acceleration skid control (ASC). The complexity of the functions implemented in these systems necessitates an exchange of data between them. With conventional systems, data is exchanged by means of dedicated signal lines, but this is becoming increasingly difficult and expensive as control functions become ever more complex. In the case of complex control systems (such as Motronic) in particular, the number of connections cannot be increased much further. Moreover, a number of systems are being developed which implement functions covering more than one control device. For instance, ASC requires the interplay of engine timing and carburettor control in order to reduce torque when drive wheel slippage occurs. Another example of functions spanning more than one control unit is electronic gearbox control, where ease of gear changing can
MTech (DECS),SJCIT 3 2011-12
If we also consider future developments aimed at overall vehicle optimization, it becomes necessary to overcome the limitations of conventional control device linkage. This can only be done by networking the system components using a serial data bus system. It was for this reason that Bosch developed the Controller Area Network (CAN), which has since been standardized internationally (ISO 11898) and has been cast in silicon by several semiconductor manufacturers.
monitor the bus for a period of no activity before trying to send a message on the bus (Carrier Sense). Also, once this period of no activity occurs, every node on the bus has an equal
MTech (DECS),SJCIT 4 2011-12
transmitting node must monitor the state of the bus to see if the logic state it is trying to send actually appears on the bus. CAN defines a logic bit 0 as a dominant bit and a logic bit 1 as a recessive bit. A dominant bit state will always win arbitration over a recessive bit state, therefore the lower the value in the Message Identifier (the field used in the message arbitra- tion process), the higher the priority of the message. As an example, suppose two nodes are trying to transmit a message at the same time. Each node will monitor the bus to make sure the bit that it is trying to send actually appears on the bus. The lower priority message will at some point try to send a recessive bit and the monitored state on the bus will be a dominant. At that point this node loses arbitration and immediately stops transmitting. The higher priority message will continue until completion and the node that lost arbitration will wait for the next period of no activity on the bus and try to transmit its message again.
MTech (DECS),SJCIT
2011-12
When data are transmitted by CAN, no stations are addressed, but instead, the content of the message (e.g. rpm or engine temperature) is designated by an identifier that is unique throughout the network. The identifier defines not only the content but also the priority of the message. This is important for bus allocation when several stations are competing for bus access. If the CPU of a given station wishes to send a message to one or more stations, it passes the data to be transmitted and their identifiers to the assigned CAN chip (Make ready). This is all the CPU has to do to initiate data exchange. The message is constructed and transmitted by the CAN chip. As soon as the CAN chip receives the bus allocation (Send Message) all other stations on the CAN network become receivers of this message (Receive Message). Each station in the CAN network, having received the message correctly, performs an acceptance test to determine whether the data received are relevant for that station (Select). If the data are of significance for the station concerned they are processed (Accept), otherwise they are ignored. A high degree of system and configuration flexibility is achieved as a result of the content-oriented addressing scheme. It is very easy to add stations to the existing CAN network without making any hardware or software modifications to the existing stations, provided that the new stations are purely receivers. Because the data transmission protocol does not require physical destination addresses for the individual components, it supports the concept of modular electronics and also permits multiple reception (broadcast, multicast) and the synchronization of distributed processes: measurements needed as information by several controllers can be transmitted via the network, in such a way that it is unnecessary for each controller to have its own sensor. CAN transmits signals on the CAN bus which consists of two wires, a CAN-High and CANLow. These two wires are operate in differential mode, that is they are carrying inverted voltages.
MTech (DECS),SJCIT
2011-12
MTech (DECS),SJCIT
2011-12
The CAN protocol supports two message frame formats, the only essential difference being in the length of the identifier (ID). In the standard format the length of the ID is 11 bits and in the extended format the length is 29 bits.
The message frame for transmitting messages on the bus comprises seven main fields. A message in the standard format begins with the start bit start of frame, this is followed by the arbitration field, which contains the identifier and the RTR (remote transmission request) bit, which indicates whether it is a data frame or a request frame without any data bytes (remote frame). The control field contains the IDE (identifier extension) bit, which indicates either standard format or extended format, a bit reserved for future extensions and - in the last 4 bits - a count of the data bytes in the data field. The data field ranges from 0 to 8 bytes in length and is followed by the CRC field, which is used as a frame security check for detecting bit errors. The ACK field, comprises the ACK slot (1 bit) and the ACK delimiter (1 recessive bit). The bit in the ACK slot is sent as a recessive bit and is overwritten as a dominant bit by those receivers which have at this time received the data correctly (positive acknowledgement). Correct messages are acknowledged by the receivers regardless of the result of the acceptance test. The end of the message is indicated by end of frame. Intermission is the minimum number of bit periods separating consecutive messages. If there is no following bus access by any station, the bus remains idle (bus idle).
MTech (DECS),SJCIT 8 2011-12
4.1.1 CAN Message Frame Description CAN protocol defines four different types of messages (or Frames). The first and most common type of frame is a Data Frame. This is used when a node transmits information to any or all other nodes in the system. Second is a Remote Frame, which is basically a Data Frame with the RTR bit set to signify it is a Remote Transmit Request . The other two frame types are for handling errors. One is called an Error Frame and one is called an Overload Frame. Error Frames are generated by nodes that detect any one of the many protocol errors defined by CAN. Overload errors are generated by nodes that require more time to process
MTech (DECS),SJCIT
2011-12
As described in the preceding section, the Remote Transmit Request (RTR) is used by
MTech (DECS),SJCIT 10 2011-12
MTech (DECS),SJCIT
11
2011-12
The last two message types are Error Frames and Overload Frames. When a node detects one of the many types of errors defined by the CAN protocol, an Error Frame occurs. Overload Frames tell the network that the node sending the Overload Frame is not ready to receive additional messages at this time, or that intermission has been violated.
Acknowledge Error
Acknowledge Slot (which it has sent as a recessive bit) contains a dominant bit. In the Acknowledge Field of a message, the transmitting node checks if the This dominant bit would acknowledge that at least one node correctly received the message. If this bit is recessive, then no node received the message properly. An Acknowledge Error has occurred. An Error Frame is then generated and the original message will be repeated after a proper intermission time.
Form Error
If any node detects a dominant bit in one of the fol- lowing four segments of the message: End of Frame, Interframe Space, Acknowledge Delimiter or CRC Delimiter, the CAN protocol defines this to be a form violation and a Form Error is generated. The original message is then resent after a proper intermission time.
Bit Error
A Bit Error occurs if a transmitter sends a dominant bit and detects a recessive bit, or if it sends a recessive bit and detects a dominant bit when monitoring the actual bus level and comparing it to the bit that it has just sent. In the case where the transmitter sends a recessive
MTech (DECS),SJCIT 12 2011-12
Stuff Error
CAN protocol uses a Non-Returnto-Zero (NRZ) transmission method. This means that the bit level is placed on the bus for the entire bit time. CAN is also asynchronous, and bit stuffing is used to allow receiving nodes to synchronize by recovering clock information from the data stream. Receiving nodes synchronize on recessive to dominant transitions. If there are more than five bits of the same polarity in a row, CAN will automatically stuff an opposite polarity bit in the data stream. The receiving node(s) will use it for synchronization, but will ignore the stuff bit for data purposes. If, between the Start of Frame and the CRC Delimiter, six consecutive bits with the same polarity are detected, then the bit stuffing rule has been violated. A Stuff Error then occurs, an Error Frame is sent, and the message is repeated.
MTech (DECS),SJCIT
13
2011-12
MTech (DECS),SJCIT
14
2011-12
In Exclusive time window we can transmit and receive only periodic messages and in Arbitrating time window we can only transmit and receive spontaneous messages that is it transmits at a time but in the Exclusive time window we can transmit at a period of time thats why the name time triggered CAN.
MTech (DECS),SJCIT
15
2011-12
APPLICATIONS
CAN applied in various fields such as Passenger cars Trucks and buses Off-highway and off-road vehicles Passenger and cargo trains Maritime electronics Aircraft and aerospace electronics Factory automation Industrial machine control Lifts and escalators Building automation Medical equipment and devices Non-industrial control Non-industrial equipment
MTech (DECS),SJCIT
16
2011-12
MTech (DECS),SJCIT
17
2011-12
CHAPTER 7
CONCLUSION
The CAN protocol was optimized for systems that need to transmit and receive relatively small amounts of information (as compared to Ethernet or USB, which are designed to move much larger blocks of data) reliably to any or all other nodes on the network. CSMA/CD allows every node to have an equal chance to gain access to the bus, and allows for smooth handling of collisions. Since the protocol is message-based, not address based, all messages on the bus receive every message and acknowledge every message, regardless of whether in needs the data or not. This allows the bus to operate in node-to-node or multicast messaging formats without having to send different types of messages. Fast, robust message transmission with fault confinement is also a big plus for CAN because faulty nodes will automatically drop off the bus not allowing any one node from bringing a network down. This effectively guarantees that bandwidth will always be available for critical messages to be transmitted. With all of these benefits built into the CAN protocol and its momentum in the automotive world, other markets will begin to see and implement CAN into their systems.
MTech (DECS),SJCIT
18
2011-12
BIBILOGRAPHY
[1] CAN in Automation GmbH, CAN-connected sensors, site http://www.can-cia.org/. [2] Holger Zeltwanger, Thilo Schuman, CANopenbased Transducer NetWork, site http://www.ieeta.pt/lse/rtn2004/preprints/7-prep.pdf. [3] Yoshihiro Miyazaki, Hiroaki Fukumaru, Open Control Systems and DeviceNet Applications, Hitachi Review, Volume 48, No.1-6, June 1999 [4] ANSI/ISA-50.02, Part 2-1992, Fieldbus Standard for Use in Industrial Control Systems Part 2: Physical Layer Specification and Service Definition, 1992. [5] Gustavo Silva, M. Dias Pereira, Fieldbus: An Integrated Solution for Measurement and Control, Proc. VI International Conference on Measurement and Control in Complex Systems,MCCS-2001, Vinnytsia, Ucrnia, pp. 80-81, Oct.2001. [6] Pat Richards, Understanding Microchips CAN Module BitTiming, Application Note AN754, Microchip Technology Inc,2001.
MTech (DECS),SJCIT
19
2011-12