iCC 2005 CAN in Automation

CANopen over EtherCAT – taking a CAN technology to the next level

Martin Rostan, Beckhoff

CANopen is a well proven, well established and very versatile technology, implemented in a large variety of devices. CAN unquestionably has distinct advan- tages just as low connection costs per device, true multi-master capability and out- standing error detection and handling features. However, for demanding applications like or applications which require large network extension CAN is in- creasingly challenged by the upcoming industrial technologies.

It is shown that there is an Ethernet technology that retains CANopen to such a large extend, that even most of the CANopen stack can be re-used. CANopen over EtherCAT features PDOs and SDOs as well as an Object Dictionary, the CANopen state machine and fully supports all CANopen device profiles. It is shown that EtherCAT provides a smooth migration path for CANopen devices towards the brave new world of .

10 Years CANopen From CANopen to EtherCAT

In autumn 2004, the CANopen community So whilst CANopen is still flourishing, the celebrated the 10th anniversary of this next generation of communication tech- technology. The first specification was nologies is emerging. Ethernet, which has published in November 1994; the devel- been used above the fieldbus level for opment had started as early as 1992 years, begins to challenge the lower parts within the ESPRIT project ASPIC. The of the networking architecture. Using in- technology was presented at the 1st Inter- ternet technologies also at the device level national CAN Conference 1994 [1]. is tempting, and the increasing perform- CANopen has been very successful, since ance of PLCs and controllers such as in- it provides a clear architecture and meets dustrial PCs leads to growing appetite for most requirements of both standard field- network performance and further reduced bus applications and embedded network- cycle times. ing. Based on CAN and thus providing low EtherCAT – Ethernet Control Automation cost hardware from a variety of sources Technology – has superb real time be- and a very robust , havior and claims to be the fastest solution CANopen includes a full featured but lean among the Industrial Ethernet technolo- communication profile. The emphasis of gies. At comparable cost levels, it provides recent developments is on the device and much larger network lengths than application profile area, where CANopen CANopen whilst allowing for most flexible provides the most comprehensive suite of topologies. And, most important for specifications. CANopen device manufacturers and users alike, it not only supports CANopen device profiles, but retains CANopen protocol One could expect that the adoption rate of technologies much more comprehensively a communication technology starts to flat- than any other Ethernet approach. ten 10 years after its introduction – with CANopen, however, this is not the case. Still new industries begin to embrace this Ethernet: the real time challenge technology and sales figures of CANopen devices, CANopen technology and CAN Unlike CAN, original networking components as such still grow with an ex- architecture provides pretty poor real time citing and ever increasing pace. features. So Ethernet on the fieldbus level has to improve this behavior. There are many different approaches: for example, 12-1 iCC 2005 CAN in Automation the CSMA/CD media access procedure is creases to over 90%. The full-duplex fea- disabled via higher level protocol layers tures of 100BaseTX are fully utilized, so and replaced by time slicing or polling; that effective data rates of > 100 Mbps other propositions use special switches (>90% of 2 x 100 Mbps) can be achieved. that distribute Ethernet packets in a pre- cisely controlled timely manner. Whilst The Ethernet protocol according to IEEE these solutions may be able to transport 802.3 remains intact right up to the indi- data packets more or less quickly and ac- vidual device - and even to terminals curately to the connected Ethernet nodes, within a modular I/O station; no sub-bus is the times required for the redirection to the required. In order to meet the require- outputs or drive controllers and for reading ments of an electronic terminal block, only the input data strongly depend on the de- the in the coupler device is vices hard- and software implementation. converted from twisted pair or optical fiber to E-bus (alternative Ethernet physical If individual Ethernet frames are used for layer: LVDS according to [4,5]). The signal each device, the usable data rate is very type within the terminal block (E-bus) is low in principle: The shortest Ethernet also suitable for transfer via a twisted pair frame is 84 long (incl. inter-packet line over short distances (up to 10 m). The gap). If, for example, a drive cyclically terminal block can thus be extended very sends 4 bytes of actual value and status cost-efficiently. Subsequent conversion to information and accordingly receives 4 Ethernet 100BASE-TX physical layer is bytes of command value and control word possible at any time. information, at 100% bus load (i.e. with infinitely short response time of the drive) EtherCAT Features: Protocol a usable data rate of only 4/84= 4.7% is achieved. At an average response time of The EtherCAT protocol is optimized for 10 µs, the rate drops to 1.9%. These limi- process data and is transported directly tations apply to all real-time Ethernet ap- within the thanks to a spe- proaches that send an Ethernet frame to cial Ethertype. It may consist of several each device (or expect a frame from each sub-telegrams, each serving a particular device), irrespective of the protocols used memory area of the logical process im- within the Ethernet frame. ages that can be up to 4 gigabytes in size. The data sequence is independent of the physical order of the Ethernet terminals in EtherCAT operating principle the network; addressing can be in any order. Broadcast, and communi- EtherCAT technology overcomes these cation between slaves are possible. inherent limitations of other Ethernet solu- tions: the Ethernet packet is no longer re- EtherCAT only uses standard frames ac- ceived, then interpreted and process data cording to [3] - the frames are not short- then copied at every device. The Ether- ened. EtherCAT frames can thus be sent CAT slave devices read the data ad- from any Ethernet controller (master), and dressed to them while the frame passes standard tools (e.g. monitor) can be used. through the node. Similarly, input data is inserted while the telegram passes through (see Fig. 1). The frames are only delayed by a few nanoseconds. Since an Ethernet frame comprises the data of many devices both in send and re- Figure 1: process data is inserted on the fly ceive direction, the usable data rate in-

12-2 iCC 2005 CAN in Automation

EtherCAT Features: Topology With EtherCAT, the data exchange is fully based on a pure hardware machine. Since Line, tree or star: EtherCAT supports al- the communication utilizes a logical (and most any topology (see Fig. 2). The bus or thanks to full-duplex also line structure known from CANopen thus physical) ring structure, the master clock also becomes available for Ethernet. can determine the propagation delay offset to the individual slave clocks simply and accurately - and vice versa. The distrib- uted clocks are adjusted based on this value, which means that a very precise network-wide time base with a jitter of sig- nificantly less then 1 microsecond is avail- able. (See Fig. 3). External synchroniza- tion, e.g. across the plant, is then based on IEEE 1588.

Figure 2: most flexible EtherCAT Topology

Particularly useful for system wiring is the combination of line and branches or stubs: the required interfaces exist on the cou- plers; no additional switches are required. Naturally, the classic switch-based Ethernet star topology can also be used. The Ethernet physical layer (100BASE- TX) enables a cable length of 100 m be- tween two devices; the E-bus line is in- Figure 3: long term scope view of tended for distances of up to 10m. For two separate devices; 300 nodes in be- each connection, the signal variant can be tween, 120 m cable length selected individually. Since up to 65535 devices can be connected, the size of the network is almost unlimited. EtherCAT Features: Performance

EtherCAT reaches new dimensions in EtherCAT Features: Distributed clocks network performance. Thanks to hardware integration in the slave and direct memory Accurate synchronization is particularly access to the network card in the master, important in cases where spatially distrib- the complete protocol processing takes uted processes require simultaneous ac- place within hardware and is thus fully tions. This may be the case, for example, independent of the run-time of protocol in applications where several servo axes stacks, CPU performance or software im- carry out coordinated movements simulta- plementation. The update time for 1000 neously. I/Os is only 30 µs - including I/O cycle The most powerful approach for synchro- time. Up to 1486 bytes of process data nization is the accurate alignment of dis- can be exchanged with a single Ethernet tributed clocks, as described in the new frame - this is equivalent to almost 12000 IEEE 1588 standard [6]. In contrast to fully digital inputs and outputs. The transfer of synchronous communication, where syn- this data quantity only takes 300 µs. chronization quality suffers immediately in The communication with 100 servo axes the event of a communication fault, dis- only takes 100 µs. During this time, all tributed aligned clocks have a high degree axes are provided with command values of tolerance vis-à-vis possible fault-related and control data and report their actual delays within the communication system. position and status. The distributed clock technique enables the axes to be syn- 12-3 iCC 2005 CAN in Automation chronized with a deviation of significantly EtherCAT Features: Safety less than 1 microsecond. The extremely high performance of the Integrated functional safety is an important EtherCAT technology enables control con- feature for device level communication cepts that could not be realized with clas- systems. The EtherCAT safety protocol is sic fieldbus systems. With EtherCAT, a qualified for SIL 3 applications according communication technology is available to IEC61508 and thus meets all factory that matches the superior computing ca- automation safety requirements. First pacity of modern Industrial PCs. The bus products implementing EtherCAT safety system is no longer the bottleneck of the will be available in the second quarter control concept. Distributed I/Os are re- 2005. corded faster than is possible with most local I/O interfaces. The EtherCAT tech- EtherCAT instead of PCI nology principle is scalable and not bound to the baud rate of 100 MBaud – extension With increasing miniaturization of the PC- to GBit Ethernet is possible. components, the physical size of Industrial PCs is increasingly determined by the number of required slots. The bandwidth EtherCAT Features: Diagnostics of Fast Ethernet, together with the process Experience shows that availability and data width of the EtherCAT communica- commissioning times crucially depend on tion hardware enables new directions: the diagnostic capability. Only faults that classic interfaces that are conventionally are detected quickly and accurately and located in the IPC are transferred to intelli- located unambiguously can be rectified gent EtherCAT interface terminals. quickly. Therefore, special attention was Apart from the decentralized I/Os, drives paid to exemplary diagnostic features and control units, complex systems such during the development of EtherCAT. as fieldbus masters, fast serial interfaces, During commissioning, the actual configu- gateways and other communication inter- ration of the nodes (e.g. drives or I/O ter- faces can be addressed. So CANopen minals) should be checked for consistency network segments can easily be integrated with the specified configuration. The topol- in EtherCAT environments (see Fig. 4). ogy should also match the configuration. Due to the built-in topology recognition down to the individual terminals, this verifi- cation can not only take place during sys- tem start-up, automatic reading in of the network is also possible (configuration upload). Bit faults during the transfer are reliably detected through evaluation of the CRC checksum. Apart from broken wire detec- tion and localization, the protocol, physical layer and topology of the EtherCAT sys- tem enable individual quality monitoring of Figure 4: EtherCAT instead of PCI each individual transmission segment. The automatic evaluation of the associated Even further Ethernet devices without re- error counters enables precise localization striction on protocol variants can be con- of critical network sections. Gradual or nected via decentralized switch ports. The changing sources of error such as EMI central IPC becomes smaller and there- influences, defective connectors or cable fore more cost-effective. One Ethernet damage are detected and located, even if interface is sufficient for the complete they do not yet overstrain the self-healing communication with the periphery. capacity of the network.

12-4 iCC 2005 CAN in Automation

CANopen over EtherCAT (CoE) devices, drives or valves. Users are famil- iar with these profiles and the associated EtherCAT provides the same communica- parameters and tools. No EtherCAT- tion mechanisms as CANopen [9]: object specific device profiles have therefore dictionary, PDO (process data objects) been developed for these device classes. and SDO (service data objects) - even the Instead, very similar interfaces for network management is comparable. CANopen device profiles are being of- fered. This greatly assists users and de- Network Management (NMT) vice manufacturers alike during the migra- tion from CANopen to EtherCAT. Like with CANopen, the EtherCAT state machine consists of four states. The only IEC 61491 over EtherCAT (SoE) difference is the CANopen STOPPED state, which has been replaced by the Another motion control device profile is EtherCAT SAFE-OPERATIONAL state. specified in IEC61491 [10]. This standard Like in STOPPED, the outputs are dis- is also known as SERCOS interface™. abled – however, the input data may still The IEC61491 servo drive profile is sup- be communicated. Thus the machine ported on EtherCAT as well. The service status is known before the outputs are channel, and therefore access to all pa- activated. rameters and functions residing in the drive, is based on the EtherCAT mailbox. Service Data Objects (SDO) The process data, here in the form of AT and MDT data, are transferred using Eth- The CANopen SDO protocol is used with erCAT slave controller mechanisms. The EtherCAT as well – in default mode even EtherCAT slave state machine can also be without any changes. If desired, one can mapped easily to the phases of the use a protocol extension in order to allow IEC61491 protocol. for more than 8 bytes per message. It is also possible to up- or download all sub- objects (addressed by sub-indices) of an object at once. These extensions are op- tional and do not have to be supported. It is even possible to re-use the CAN/ CANopen SDO protocol implementation in an EtherCAT device.

Process Data Objects (PDO) Figure 5: Ethernet over EtherCAT EtherCAT organizes the process data in process data objects - just like CANopen. Ethernet over EtherCAT (EoE) PDO mapping and the corresponding ob- ject dictionary entries are available. Since The EtherCAT technology is not only fully EtherCAT is not limited to 8 Bytes per Ethernet-compatible, but also character- PDO, more than 64 application objects ized by particular openness "by design": may be mapped – if supported by the de- the protocol tolerates other Ethernet- vice. based services and protocols on the same physical network - usually even with mini- mum loss of performance. There is no Device profiles restriction on the type of Ethernet device that can be connected within the Ether- The device profiles describe the applica- CAT segment via a switch port. The tion parameters and the functional behav- Ethernet frames are tunneled via the Eth- ior of the devices including the device erCAT protocol, which is the standard ap- class-specific state machines. For most proach for internet applications (e.g. VPN, device classes, CANopen already offers PPPoE (DSL) etc.). The EtherCAT net- reliable device profiles, for example for I/O 12-5 iCC 2005 CAN in Automation work is fully transparent for the Ethernet data at the respective points in the passing device, and the real-time characteristics frame. are not impaired (see Fig. 5). EtherCAT devices can additionally feature Master Sample Code other Ethernet protocols and thus act like a standard Ethernet device. The master Master sample code for supporting a acts like a layer 2 switch that redirects the master implementation is available for a frames to the respective devices according nominal fee. The software is supplied as to the address information. source code and comprises all EtherCAT All internet technologies can therefore also master functions, including Ethernet over be used in the EtherCAT environment: EtherCAT. All the user has to do is adapt integrated web server, e-mail, FTP trans- the code, which was created for Windows fer etc. environments, to the target hardware and the RTOS used (see Fig. 6). File Access over EtherCAT (FoE)

This very simple protocol similar to TFTP enables access to any data structure in the device. Standardized firmware upload to devices is therefore possible, irrespec- tive of whether or not they support TCP/IP.

Master-Implementation

EtherCAT uses standard Ethernet con- trollers where real cost savings can be achieved: in the master. No communica- tion coprocessors are required, since usu- Figure 6: Master Sample Code Structure ally only one Ethernet frame has to be sent per cycle. EtherCAT therefore is the only Ethernet solution for demanding real- Monitor Tools time requirements that does not require special master plug-in cards. The on- Since EtherCAT uses standard Ethernet board Ethernet controller or a cost- frames according to IEEE 802.3, any effective standard NIC card is sufficient. commercially available Ethernet monitor- The master is usually implemented as a ing tool can be used for monitoring Ether- pure software solution. CAT communication. In addition, free Implementation of an EtherCAT master is parser software for Ethereal (an open very easy, particularly for small and me- source monitoring tool) and the Microsoft dium-sized control systems and for clearly network monitor is available for processing defined applications. For example a PLC and displaying recorded EtherCAT data with a single process image: if it does not traffic. exceed 1488 bytes, cyclic sending of a single Ethernet frame with the cycle time Slave-Implementation of the PLC is sufficient. Since the header does not change at run time, all which is A cost-effective EtherCAT slave controller required is a constant header to be added (ASIC or FPGA) is used in the slave de- to the process image and the result to be vice. For simple devices, no additional transferred to the Ethernet controller. microcontroller is required. For more com- The process image is already sorted, plex devices, EtherCAT communication since with EtherCAT process data sorting performance is almost independent of the does not occur in the master, but in the performance capability of the controller slaves - the peripheral devices insert their used, making the device cost-effective.

12-6 iCC 2005 CAN in Automation

EtherCAT slave controllers are available ETG was established in November 2003 or are in preparation from several manu- and today is the largest industrial Ethernet facturers. The slave controllers developed organization, with the number of member by Beckhoff (available via semiconductor companies currently standing at over 160. distribution) feature an internal DPRAM ETG has member companies from Austria, and offer a range of interfaces for access- Belgium, Canada, China, Finland, France, ing this application memory: Germany, Great Britain, India, Israel, Italy, • The serial SPI (serial peripheral inter- Korea, Liechtenstein, the Netherlands, face) is intended particularly for devices Singapore, Sweden, Switzerland, Taiwan, with small process data quantity, such Turkey and the USA. as analog I/O modules, sensors, en- coders or simple drives. • The 32-bit parallel I/O interface is suit- International standardization able for the connection of up to 32 Disclosure is not only driven from within digital inputs/outputs, but also for sim- the EtherCAT Technology Group - the ple sensors or actuators operating with international standardization of EtherCAT 32 data bits. has also been initiated already. The IEC • The parallel 8/16-bit microcontroller management board has accepted the Eth- interface corresponds to conventional erCAT Technology Group as an official interfaces for fieldbus controllers with liaison partner of the IEC working groups DPRAM interface. It is particularly suit- for digital communication. The EtherCAT able for more complex devices with specification was submitted to IEC in No- larger data volume. vember 2004 and has already advanced to For supporting a slave implementation, an the voting process. ISO has also accepted evaluation kit is available, including slave an accelerated standardization procedure application software in source code and a for EtherCAT, so that EtherCAT is ex- test master. pected to obtain the status of an official IEC and ISO specification quite soon. Infrastructure costs

Since no hubs and switches are required for EtherCAT, costs associated with these devices including power supply, installa- tions etc. are avoided. Standard CAT5 cables and standard connectors are used, if the environmental conditions permit this.

EtherCAT Technology Group

Everyone should be able to use and im- plement EtherCAT. The EtherCAT Tech- nology Group promotes this philosophy. The ETG is a forum for end users from different sectors, and for machine manu- facturers and suppliers of powerful control technology with the aim of supporting and promoting EtherCAT technology. The wide range of industry sectors that are repre- sented ensures that EtherCAT is optimally prepared for a large number of applica- Figure 7: EtherCAT Pilot Application tions. With their qualified feedback, the system partners ensure simple integration EtherCAT represents proven technology of the hardware and software components in all required device classes. EtherCAT is already used commercially: following positive experience with a pilot 12-7 iCC 2005 CAN in Automation system, Schuler Pressen AG decided to Literature approve EtherCAT for their Profiline press range (see Fig 7.). A Schuler representa- [1] Rostan, Martin, Gruhler, Gerhard, tive said: “This system enables us to real- "CAN Real Time Communication Pro- st ize fast drive and hydraulic controls for all file", Proceedings 1 ICC 1994. applications currently used in the Schuler [2] EtherCAT Technology Group, Group. Another crucial factor is that, due http://www.ethercat.org to EtherCAT's performance, we still have enough potential for solving complex con- [3] IEEE 802.3-2000: Carrier Sense Mul- trol tasks in future without performance tiple Access with Collision Detection problems.” Meanwhile, more than 5000 (CSMA/CD) Access Method and nodes have been supplied to Schuler and Physical Layer Specifications. other customers. [4] IEEE 802.3ae-2002: Carrier Sense In November 2004, 28 companies an- Multiple Access with Collision Detec- nounced EtherCAT products at the first tion (CSMA/CD) Access Method and EtherCAT joint booth, and as of January Physical Layer Specifications; 2005, more than 70 development kits have Amendment: Media Access Control been sold. (MAC) Parameters, Physical Layers, and Management Parameters for 10 Gb/s Operation. Summary [5] ANSI/TIA/EIA-644-A, Electrical Char- acteristics of Low Voltage Differential EtherCAT provides CANopen technology Signaling (LVDS) Interface Circuits on Ethernet. EtherCAT will not replace CAN based CANopen, but is an alternative [6] IEEE 1588-2002: IEEE Standard for a whenever CAN limitations like throughput, Precision Clock Synchronization Pro- network length or number of nodes apply. tocol for Networked Measurement and EtherCAT is so close to CANopen, that Control Systems even existing protocol stacks can be re- [7] Janssen, Dr. Dirk, Büttner, Holger, used. “EtherCAT – the Ethernet Fieldbus”. EtherCAT is characterized by outstanding PC Control Magazine 3/2003. performance, very simple wiring and [8] EtherCAT Communication Specifica- openness for other protocols. Thanks to tion, EtherCAT Technology Group Ethernet and Internet technologies, opti- 2004 mum vertical integration is guaranteed. [9] EN 50325-4: Industrial communica- With EtherCAT, the costly Ethernet star tions subsystem based on ISO 11898 topology can be replaced with a simple (CAN) for controller-device interfaces. line structure - no expensive infrastructure Part 4: CANopen. components are required. Where other [10] IEC 61491-2002: Electrical equipment real-time-Ethernet approaches require of industrial machines - Serial data special connections in the controller, for link for real-time communication be- EtherCAT very cost-effective standard tween controls and drives Ethernet cards (NIC) are sufficient. EtherCAT makes Ethernet down to the I/O level technically feasible and economically Martin Rostan sensible. Full Ethernet compatibility, inter- Beckhoff net technologies even in very simple de- Ostendstr. 196, D- 90482 Nürnberg vices, maximum utilization of the large +49 911 54056-11 bandwidth offered by Ethernet, outstand- +49 911 54056-29 ing real-time characteristics at low costs [email protected] are outstanding features of this network. www.beckhoff.com As a high-speed drive and I/O bus for In- dustrial PCs or in combination with smaller control units, EtherCAT is a supplement to CAN based CANopen in a wide range of applications.

12-8