You are on page 1of 4

XIX IMEKO World Congress

Fundamental and Applied Metrology
September 6−11, 2009, Lisbon, Portugal

CAN PROTOCOL: A LABORATORY PROTOTYPE FOR FIELDBUS
APPLICATIONS

Mário Alves1, Miguel Pereira1,2, Helena Geirinhas Ramos2
1
LabIM/ESTSetúbal, Polytechnic Institute of Setúbal, Rua do Vale de Chaves, Estefanilha, 2910-761 Setúbal,
Portugal, malves@est.ips.pt, joseper@est.ips.pt
2
Instituto de Telecomunicaçoes, DEEC, Instituto Superior Tecnico, Lisboa, Portugal, hgramos@lx.it.pt

Abstract − An integrated solution based on CAN Table 1. Main characteristics of CAN protocol
protocol, for industrial measurements and control, is
presented. Main characteristics of CAN protocol are Bus Access deterministic
underlined in terms of OSI model taking particular attention Bus Allocation central or distributed
to hardware implementation, messages types, collision random
resolution mechanisms and timing synchronization. The Addressing message address
paper also includes references to another high level
industrial protocols that use the physical and logical data Single wire, UTP
Media
layers of CAN protocol. Experimental results based on a optical fibre
developed prototype applied to a level control loop system Topology bus - tree
and main protocol characteristics are analyzed.
Hierarchy Multi -master

Bandwidth Bitrate (kBps)
Keywords: CAN, OSI protocol layers, fieldbus
networks Nowadays, CAN based protocols extend their
applications’ domain in multiple areas. Two well-known
1. INTRODUCTION protocols derived for CAN are CANopen [2] and DeviceNet
[3].
By 1960 the analog electronic instrumentation, using 4-20 CANopen is a CAN-based higher-layer protocol that is
mA, had a fast spread in the field, and soon replaced the frequently applied in embedded control systems. The set of
pneumatic 3-15 PSI standard. This was also the start time of CANopen specifications comprises the OSI application
computers usage for measurement and control. At that time, layer [4] and communication profile as well as application,
the central computer receives all analog 4-20 mA signals, using the same set of physical and logical data layers of
converts those analog signals to digital, processes the CAN protocol. These networks types are used in a very
information, display values and graphics, makes reports and broad range of application fields such as machine control,
outputs signals to the actuators (control valves and motors). medical devices, off-road and rail vehicles, maritime
Smart instrumentation appeared by 1980. It added many electronics, building automation and power generation. The
facilities to the instruments, mainly in what concerns self- main advantages of CANopen are its plug and play
diagnostics, alarms and tagging. capabilities, interoperability and interchangeability.
This paper dedicates particular attention to control area DeviceNet is mainly used in factory automation as a
network (CAN) protocol, its main characteristics and communication network between industrial I/O devices and
applications. controllers DeviceNet supports multiple communication
hierarchies, message prioritization that is one of the main
2. CAN PROTOCOL characteristics of CAN protocol and other additional
performances that are required by industrial fieldbus [5]
CAN appears as a solution to automotive industry [1] networks such as robustness, error recovery mechanisms,
and its main objective was to get a robust digital redundancy and low-cost implementation.
transmission solution to interconnect a large number of
automobile smart devices. This protocol was optimized for 2.1 OSI model
systems that need to transmit and receive relatively small
amounts of data with real time requirements. The main The international standards organization (ISO) defined
characteristic of CAN protocol are summarized in Table 1. the open system interconnection (OSI) model that includes
seven layers, namely: application, presentation, session,
transport, network, data link and physical layer. These layers

ISBN 978-963-88410-0-1 © 2009 IMEKO 454

Bus access for maximum priority messages is performed within a maximum predefined time delay. SYSTEM DESCRIPTION used by CAN protocol. Frame types having an analogue output is used. 2. The error frame signalizes transmission errors. one • Bits codification and decodification Transmission support Physical • Bit synchronization installed on the top of the container and another at the Physical medium hardware modules bottom (P3 and P2. • MAC (media access control) • Collision avoidance and detection contains a closed tank with water and pressurized air and an • Recuperação de dados Application open tank that delivers water to the outside. depicted in Fig. however overload frames V7 V4 does not increase the error counters and does not causes frame’s retransmission. CAN protocol define four different frame types: data frame. The experimental set-up. error frame and overload frame. Transport • Error checking Network •Priority assignment The water level inside the pressurized tank is measured Data-Link Physical interface using two pressure transmitters with analogue outputs. To indicate the water level in the open tank another pressure transmitter (P2) also 2. each CAN B1 packet has an identifier field defining message type and priority. In this case the others networks nodes are requested to delay the start of the next transmission for a short period of time. pressurised tank and in the open tank).2 Collision resolution mechanism P1 P2 CAN bus access is performed in a multimaster mode. In each network node there are several counters that are used to count temporary and permanent node failures. The water is delivered to the output by acting valves V2 and V4. accepting or ignoring it. To control the pressure • Media transceivers inside the tank the input water flow is adjusted considering Physical Medium access that there is water consumption through valve V3. However. 2. Messages are broadcasted through the network and each node determines if that messages should be received or not. the faulty node is removed from the network in order to preserve network operation.that include the transmission rules of any protocol can be based arbitration without any destructive effects on high used with various bus network topologies. respectively. by • Cabling and connectors commanding the motor (B1) with a speed controller (Sv).1. An overload frame is used when a network node is too busy. This frame is identical to an active error frame. It is important to underline that CAN protocol does not specify some parts of the physical layer. bus conflict is resolved by a non-destructive contention- 455 . The protocol does not require addressing mechanisms that means each message packet does not require source and destination fields. V3 2. This tank feeds the open tank through a valve (V7) that is Fig. When several nodes start transmission of a frame simultaneously. The target is to Presentation Error Correction and Framing control the pressure in the pressurized tank and the water • Data framing Session • Data encoding (message fields) level in the open tank. Summary of the main tasks associated with CAN’s protocol opened or closed depending on the water levels (inside the layers. 1. Data frame are mainly used to exchange measured variables and P3 control data between network nodes Remote frames are used when one node request data. that means the bus access in not managed by a master node V2 but any node in the network can act as a master depending C1 on message priority level. respectively). Experimental set-up of level control system. 1 represents on the left side the OSI model layers and on the right side the main tasks of the first two layers 3. In this case a recessive remote transmission (RTR) bit without any data is sent. Fig. If the number of errors exceeds the predefined limits. remote frame. a Fig. the Instrumentation and Measurement Laboratory at ESTSetúbal using an assembly that simulates an industrial Media access scheme process. The CAN protocol implementation project was done at namely cabling and connectors. priority messages.

cable length of 498 m is used. 4. Node 2 Node 1 several tests in a simplified version of the fieldbus network M1 with only two nodes (Fig. Each node includes besides the fieldbus devices a 3 Open/close V4 CAN module. The simulated signal. [7] used as a high-speed transceiver. the water level of the open tank (P2) 2 Pression (P1. 5. ON/OFF action of V2 and V4 valves. Signals between CAN nodes. LabVIEW application. 3. Diagram of the experimental setup. namely P1 those characteristics that assure robustness to the protocol. the bus and any 4 Alarm A4 if P2 << min. M2 Line lenght simulation R/2 R/2 NICAN R/2 C R/2 120 Ω 120Ω RS232 DB9 High speed M4 RS232 CAN L M3 Node 4 Node 120Ω Node Node 3 E B1 0 120 Ω 1 CANH V2 V4 S B2 Sensor Sensor P2 Actuator Actuator V7 A1 B3 A2 Fig. Thus there are three process variables and four control 1 Commands speed (B1) variables: the pressure transmitters (P1. 6 represents the data stream when a 2 Open V3 if flow ≥ max. The parameters calculated for 456 . 1 SY OFF bs bs bs bs 4 Emergency (E) 2 Open V3 A B C E F G H I K D J 3 Open V2 Manual V2 (B1) 3 Open/close V2 F Fig. one MPC2551 4 Alarm A3 if P2 >> max. CAN network and bus terminating resistors. Each module includes one microcontroller 3 Pression (P2) PIC18F2580 used as the CAN controller [6]. Signal generated by the LabVIEW. Tests were performed transmitting a frame introduced into the bus by a CAN PC board [8. By acting ON/OFF V2 and V4 4 Alarm A2 if (P1-P3)<< min. 3 Close V2 if P2 ≤ max. Fig. the valve V7 and the 2 Close V3 if (P1-P3)≤ min. represented in Fig. interval and the pressure in the pressurised tank (P1 and P3) must be kept at the setpoint. Fig. the system can be also controlled. 5. is a command to activate an actuator. P2 and P3) and the frequency of the motor speed control. conditioning circuit needed to interface the microcontroller. The exchange of information between the nodes is presented in Table 2. Transmitter Listener Node Function Node Function 1 SY ON System Starts (S) if C1=0 2 Close V3 if (P1-P3)≤ max. Manual de V3 (B2) 2 Open/close V3 Manual V7 (B3) 3 Open/close V7 In order to analyze the influence of cable length in the CAN bit stream with a data rate of 125 Mbit/s it was used an 4 Starts if C1=0 artificial line with concentrate parameters were made as 1 Input water flow (C1) presented in Fig. 3 it was decided due to the location of the devices to implement the CAN network with four 3 Open/close V2 nodes. P3) Alarm A1 if (P1-P3)>> must be put back by setting valve V7 open during a time 4 max. 4. 4. EXPERIMENTAL RESULTS P3 V3 Sy Sy C1 In order to analyze CAN bus data transmission. 4) have been conducted. When there is water 2 Open V3 if (P1-P3)≥ max. 9] using a developed Table 2. flowing to the output. 3 commands V7 As depicted in Fig.

[8] PICDEM CAN-LIN2. Message in a 498 m bus lenght. Microchip Technology Inc.pt/lse/rtn2004/preprints/7-prep. National Instruments. The signals 5.73 Ω and C = 27. terminal resistances. “Fieldbus Standard for Use in Industrial Control Systems Part 2: Physical Layer Specification and Service Definition”. error detection capabilities.1-6.. superimposed to CAN bit stream. This means an acceptable transmitting rate for several applications in the device level of an industrial process. “Understanding Microchip’s CAN Module Bit Timing”.498 m are: R = 17.02. M. Hiroaki Fukumaru. Oct. No.pdf. CONCLUSIONS obtained for the previous situation are depicted in Fig. 457 . As Transducer NetWork”. high immunity to external noise signals (present in industrial processes). 80-81. the processing time associated is also small. [7] MCP2551 – High-speed CAN Transceiver Data sheet. [4] ANSI/ISA-50. Microchip Technology Inc. Fig. Volume 48. Application Note AN754. remains successful.org/. Fig. communication. 8. http://www. Fig. Ucrânia.can-cia. Dias Pereira. Vinnytsia. pp. [6] Pat Richards. 6. 7. [3] Yoshihiro Miyazaki. “CAN-connected sensors”. This support is gratefully acknowledged. 2003. 2001. “Open Control voltage remains almost constant and CAN communication Systems and DeviceNet Applications”. robustness. The main advantages can be summarized as: reduced cabling (by the use of several instruments over the same bus). [5] Gustavo Silva. where the information Fig.7 shows a sequence of error frames. Signals obtained when a 20 kHz/5Vpp noise signal is May 2005. [9] NI-CAN Hardware and software Manual. June 1999. 1992.2001. User’s Guide. As the frames are short. Microchip Technology Inc. 8 represents the signals obtained when a 20 kHz [2] Holger Zeltwanger. REFERENCES [1] CAN in Automation GmbH. Part 2-1992. and its reliability to external transmitting conditions in industrial environments. Thilo Schuman. capability to solve bus access collisions without any retransmission requirements. MCCS-2001.39 nF.ieeta. when compared with other fieldbus solutions. Hitachi Review. “Fieldbus: An Integrated Solution for Measurement and Control”. “CANopen–based with 5 Vpp is superimposed with the message signal. The experimental tests done with the developed After a specific number of errors transmitted (256) the prototype validate the expected theoretical results of CAN internal counter disconnects the bus. Development Kit for 28/40-pin Devices. VI International Conference on Measurement and Control in Complex Systems. The experimental results confirm the excellent performance and robustness of the CAN protocol when used in industrial applications. ACKNOWLEDGMENTS This work was supported in part by Portuguese Science and Technology Foundation and the Projects PTDC/EEA- ELC/67719/2006 with the collaboration of the Polytechnic Institute of Setúbal (LabIM). site Fig. 2003. Bus signals when one terminal resistor is missing. distributed control and hot-swapability. site both lines experience the same interference the differential http://www. Proc. 6. changed between devices is very small but requires a “real- The high-speed CAN specifications require 120 Ω time” capability.