EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono....

66
EtherCAT ® Master Stack Technical Presentation

Transcript of EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono....

Page 1: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT® Master Stack• Technical Presentation

Page 2: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Features according to ETG.1500 Master Classes

Page 3: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Master Core Features (1)

Feature nameMaster

Class A

Master

Class B

Basic Features

Service Commands, IRQ field in datagram, Slaves with Device

Emulation, EtherCAT State Machine, Error Handling, EtherCAT

Frame Types

Sophisticated error detection and diagnosis:

Lost cable connection, missing/wrong, slave response, slave

operation monitoring, Ethernet link layer debug messages, >

200 error codes

VLAN --

Process Data Exchange

Cyclic PDO (High performance up to 50 us cycle time), Multiple

Tasks

Network Configuration

Online scanning, Reading ENI, Compare Network configuration,

Explicit Device identification, Station Alias Addressing, Read and

Write to EEPROM

V3.1.1 3

Page 4: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Master Core Features (2)

Feature nameMaster

Class A

Master

Class B

Mailbox Support

State change check: Logical and physical polling

Resilient Layer (repeating mailbox communication)

Multiple mailbox channels (multiple protocols in parallel)

CoE Mailbox Protocol

SDO Up- and Download,

Normal, Expedited and Segmented Transfer,

SDO Info service (Read Object Dictionary),

Complete Access, Emergency Message

EoE Mailbox Protocol

Services for tunneling Ethernet frames. includes all

specified EoE services Virtual Switch

EoE Endpoint interface to Operating Systems FP FP

FoE Mailbox Protocol

FoE Services

Firmware Up- and Download

Boot State

V3.1.1 4

Page 5: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Master Core Features (3)

Feature nameMaster

Class A

Master

Class B

SoE Mailbox Protocol

SoE Services

AoE Mailbox Protocol

AoE Services

VoE Mailbox Protocol

VoE Services

Synchronization with Distributed Clock (DC)

Initial propagation delay measurement,

Offset compensation, Set start time,

Continuous drift compensation,

Sync window monitoring

--

Master must synchronize itself on the reference clock.

DC master synchronization (DCM).

--

Slave-to-Slave Communication

via Master, required for safety devices

V3.1.1 5

Page 6: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Programming Languages

Page 7: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT Master Core

V3.5 7

EC-Master Architecture

Customer C/C++ Application

Operating SystemAdaptation

“ No full-blown OS required”

Optimized Real-Time Ethernet Driver with direct

HW access

Link Layer

Process Data Image

cycliccommands

XML Parser.XML

EtherCAT Network Information (ENI)

File

OS Layer

Mailbox Services

req. resp.

acycliccommands

HARDWARE

Standard Ethernet MAC

RAM FLASH

CPU

Wrapper Library provides API for object oriented access

CustomerC# Application

CustomerPython Script

Page 8: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

V3.5 8

The EtherCAT Master Core Library and the RAS Server Module are implemented in C++. The API interfaces are C language interfaces, thus the master can be used in ANSI-C as well as in C++ environments.

Programming the Master Core Library in C/C++

CustomerApplication

Master Core Library (EcMaster.dll, libEcMaster.a, …)

Class B ExampleEcMasterDemo

Programing Interface: “C” API

Class B ExampleEcMasterDemoSyncSm

Class A ExampleEcMasterDemoMotion

Class A ExampleEcMasterDemoDc

RAS Server

“C” API

Page 9: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• EcMasterDemo is the basic example application for EC-Master. The example shows how to initialize the master and how to put the network into operational state. Based on the provided ENI file this example can handle all kind of EtherCAT Slaves.

• EcMasterDemoSyncSm demonstrates a different network timing which requires the interrupt from the Ethernet Controller used by the master. This cyclic frame is transmitted at the begin of the cycle and the process data are updated immediately after the frame returns.

• EcMasterDemoDc is a good starting point for application requiring the accurate synchronization of slaves based on the Distributed Clocks (DC) technology. To synchronize the master controller with the slaves several modes can be selected.

• EcMasterDemoMotion comes with a simple motion control library to control drives implemented according to the profile CiA402 and the ETG Implementation Directive ETG.6010. The example supports the operation modes Cyclic Synchronous Position (CSP) and Cyclic Synchronous Velocity (CSV).

V2.7 9

C/C++ Example applications

Page 10: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

V3.5 10

The RAS Client Library is part of the Feature Pack “Remote Access API” and provides in conjunction the RAS Server the master programming interface on a remote system. The RAS protocol transport layer by default is based on TCP/IP and Ethernet, other mechanisms, e.g. Shared Memory, can be used as well.

The EcMasterDemoRasClient example application demonstrates how to connect to the RAS Server and to call EC-Master APIs like emScanBus or emGetMasterState, access process data using emGetProcessDataBits or send notifications to the EC-Master application.

Programming the RAS-Client Library in C/C++

CustomerApplication

RAS Client Library (AtemRasClnt.dll, libAtemRasClnt.a, etc.)

ExampleEcMasterDemoRasClient

Programing Interface: “C” API

Page 11: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

V2.7 11

• Supported Operating Systems: All

• Supported Compilers: Microsoft, GNU, LLVM

• Supported IDE: Microsoft Visual Studio, Eclipse, WindRiver Workbench, QNX Momentics, IAR, Keil MDK

Programming the Master Core Library in C/C++Operating systems and tools

Page 12: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

C++

C#

Programming in C# (1)

CustomerC# Application

Master Core Library

ExampleEcMasterDemoDotNet

“C” API

RAS ClientLibrary

“C” API

Simulator Library

“C” API

Wrapper Library provides API for object oriented access(EcWrapper.DLL, libEcWrapper.so)

Programming Interface: C# (.NET)(EcWrapperDotNet.DLL)

RAS Server

“C” API

RAS Server

“C” API

The example EcMasterDemoDotNet and the .NET wrapper are written in C#. The target platform is AnyCPU. The other libraries are written in C++ and are platform specific. The Wrapper Library is a helper that prepares the API for .NET. The demo runs in conjunction with MS .NET Framework as well as with Mono.

Page 13: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

C# Example application

• EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application for EC-Master. The example shows how to initialize the master and how to put the network into operational state. Based on the provided ENI file this example can handle all kind of EtherCAT Slaves. It is also shown how to read and write a variable. Even an example of how to read a register from the CoE object dictionary can be found.

Operating systems and tools

• Supported Operating Systems: Windows (MS .NET 2.0, MS .NET Standard 2.0), Linux (MS .NET Standard 2.0, Mono)

• Supported IDE: Microsoft Visual Studio (Code)

• Supported Compiler: Microsoft

V2.7 13

Programming in C# (2)

Page 14: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Python

Programming in Python (1)

CustomerPython Script

ExampleEcMasterDemoPython

Programming Interface: Python(EcWrapperPython.py)

C++

Master Core Library

“C” API

RAS ClientLibrary

“C” API

Simulator Library

“C” API

Wrapper Library provides API for object oriented access(EcWrapper.DLL, libEcWrapper.so)

RAS Server

“C” API

RAS Server

“C” API

ExampleEcSimulatorHiLDemoPython

The examples and the Python wrapper are written in Python. They are not platform specific. The other libraries are written in C++ and are platform specific. The EcWrapper is a helper that prepares the API for python.

Page 15: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Python Example applications

• Similar to the other demos the EcMasterDemoPython shows how to call the EtherCAT Master API. There is also a Python demo for the EC-Simulator. The python demos can also run in interactive mode e. g. to set an output of the EtherCAT network or something else. This is very useful to quickly test different behaviors of the EtherCAT network e. g. with the EC-Simulator.

Operating systems and tools

• Supported Operating Systems: Windows (Python 3.7), Linux (Python 3.7)

• Supported IDE: Python IDLE Shell, Microsoft Visual Studio Code

V2.7 15

Programming in Python (2)

Page 16: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT Network Timing

Interaction between application and EtherCAT network traffic

Page 17: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Benefits:

• No synchronization issues between application and EtherCAT Master.

• Consistent process data without using any locks.

• The application decides, what shall be done at which time

• Cyclic part may run within Interrupt Service Routine (ISR)

• Easy to integrate

V3.1.1 17

EC-Master without internal tasks

EtherCAT Master has no internal tasks:

From the application side it looks like a driver, which is activated by calling some simple functions (Read, Write, Admin).

Page 18: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT Master: Refresh Inputs

eUsrJob_ProcessAllRxFrames: Process all received frames

Cyclic jobs

P

S

MT

App

EtherCAT Master: Write OutputseUsrJob_SendAllCycFrames: Send cyclic frames

EtherCAT Master: AdministrationeUsrJob_MasterTimer: Trigger master and slave state machines

Application: Work on inputs and create output values

ASEtherCAT Master: Send acyclic datagrams/commandseUsrJob_SendAcycFrames: Transmit pending acyclic frame(s).

V3.1.1 18

Page 19: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Cyclic frames: Contain process output and input data

Distributed Clocks (DC): Contain datagram to distribute network time

Typically sent by master in every cycle

Defined by the configuration tool (which data to read and to write)

• Acyclic frames: Asynchronous, event triggered communication

Mailbox communication (CoE, FoE, EoE)

Status requests (e. g. read slave state information)

Raw EtherCAT datagrams requested by application

V3.1.1 19

Cyclic and acyclic EtherCAT frames

Page 20: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Network Timing: Cyclic framesNo interrupt from network controller

App. Task SP

Cycle time, e .g. 1 ms

MTIdle

App. Task SP MTIdle

App. Task SP MTIdle

Refresh Inputs

Write Outputs

Master Administration

Timer

Interrupt

V3.1.1 20

CPU

DMA

Mem.

NETW

EtherCAT

Cycle

Page 21: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Network Timing: Cyclic and acyclic framesNo interrupt from network controller

App. Task SP

Cycle time, e .g. 1 ms

EtherCAT

Cycle

MTCPU

DMA

Mem.

NETW

Idle

Acyclic Send

AS ASApp. Task SP MTIdle

App. Task SP MTIdle

AS

Acyclic

Frame

V3.1.1 21

Page 22: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT Synchronization

Page 23: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Network Timing: Cyclic Frames with DC Sync SignalsNo interrupt from network controller

CPU

DMA

Mem.

BUS

App. Task SP MTIdle

App. Task SP MTIdle

App. Task SP MTIdle

Slaves

Sync0Sync0 Sync0

Sync0 is a hardware

signal on ESC

V3.1.1 23

Page 24: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Distributed Clocks Master Synchronization

EtherCAT Frame

Slave Task

Timer IRQ

on Master

Without DCM

With DCM

Distance nearly constant Slave Task

DC Sync

Event

V3.1.1 24

Page 25: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Bus Shift: DC Reference Clock follows the Master Clock/Timer

• Adjust the Bus Time Register of the DC Reference Clock.

• The DC slaves converge to this time.

• Frame send time used for drift measurement (time is related to master timer)

DCM: Bus Shift ModeReference Clock controlled by Master/Controller Time

V3.1.1 25

Master

Ref-Clock

DC

DC

Page 26: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Works fine in most cases

• Minimum controller error depending on cyclic frame send time jitter Frame send time depends on application execution time

App execution time should be nearly constant

The DCM controller is using a filter algorithm to deal with frame send time jitter

V3.1.1 26

DCM: Bus Shift ModeReference Clock controlled by Master/Controller Time

Page 27: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

DCM: Master Shift ModeMaster/Controller Time controlled by Reference Clock

Master Shift: Master Clock/Timer follows the DC Reference Clock

• The timer (reload value) on Master control system (Host) is adjusted.

• E. g., if the Host is to fast, increase the reload value for one tick and then switch back to the default value.

• Interface to adjust timer required. Not available on all operating systems!

V3.1.1 27

Master

Ref-Clock

DC

DC

Page 28: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Reduced DCM controller error

• Quality independent from cyclic frame send time jitter

• Requires enhanced OS-Layer OsHwTimerGetInputFrequency()

OsHwTimerModifyInitialCount()

• Not available on all platforms/operating systems

V3.1.1 28

DCM: Master Shift ModeMaster/Controller Time controlled by Reference Clock

Page 29: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

DCM: Master is Reference Clock ModeMaster/Controller time is used as reference clock

Master Ref Clock Mode• No need for platform adaptation• The DC reference time (register 0x0910) is provided by the controller• Pro: No DCM controller required Reduced CPU load compared to other modes• Pro: Available on all platforms• Con: Very long startup time compared to other modes, because the

synchronization requires a minimum of 15.000 frame = 15.000 cycles

V3.1.1 29

Master

Ref-Clock

Page 30: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

DCM: Linklayer Reference Clock ModeMaster/Controller time is used as reference clock

Linklayer Ref Clock Mode

• The DC reference time (register 0x0910) is provided by the controller

• Pro: No DCM controller required Reduced CPU load compared to other modes

• Con: specific link layer adaptation is required

V3.1.1 30

Master

Ref-Clock

Page 31: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Reduced DCM controller error

• Quality independent from cyclic frame send time jitter

• Requires enhanced Link-Layer EC_LINKIOCTL_GETTIME

• Not available on all platforms/operating systems

V3.1.1 31

DCM: Linklayer Reference Clock ModeMaster/Controller time is used as reference clock

Page 32: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

DCM: Controller Set Value (default)“Controlling the time between cyclic frame and Sync0”

CPU

DMA

Mem.

Frame

App. Task SP MTIdle

App. Task SP MTIdle

App. Task SP MTIdle

Slaves

Sync0Sync0 Sync0

Sync0 is a hardware

signal on ESC

V3.1.1 32

Frame

Send Time

Controller Set Val

Page 33: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

DCM: Controller Set Value (enhanced)“Controlling the time between start of cycle and Sync0”

CPU

DMA

Mem.

Frame

App. Task SP MTIdle

App. Task SP MTIdle

App. Task SP MTIdle

Slaves

Sync0Sync0 Sync0

Sync0 is a hardware

signal on ESC

V3.1.1 33

Controller Set Val

Page 34: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Reduced DCM controller error

• Quality independent from cyclic frame send time jitter

• Requires enhance OS-Layer OsHwTimerGetInputFrequency()

OsHwTimerGetCurrentCount()

• Not available on all platforms/operating systems

V3.1.1 34

DCM: Controller Set Value (enhanced)“Controlling the time between start of cycle and Sync0”

Page 35: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Distributed Clocks Master SyncDCM Mode Selection Criteria

Criteria Bus Shift

Mode

Master Shift

Mode

Master

Ref Clock

Mode

Linklayer

Ref Clock

Mode

Accuracy of

SYNC Signals

+/- 1000 nanosec

jitter

+/- 20 nanosec

jitter

+/- 20 nanosec jitter +/- 20 nanosec jitter

Maximum

acceptable drift

between master

and reference

clock

600 ppm

very precise timer

in control system

required

no physical

limitation

600 ppm

very precise timer

in control system

required

600 ppm

very precise timer

in control system

required

Multiple

EtherCAT

segments

possible not possible possible possible

Implementation possible not possible on all

operating systems

possible not possible on all

operating systems

Startup time Short Short Long Short

V3.1.1 35

Page 36: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

V3.1.1 36

Network Timing: Sync Manager (SM) SynchronizationWith Interrupt from network controller

Cycle Time, e .g. 1 ms

EtherCAT

Cycle

CPU

DMA

Mem.

NETW

App. TaskS P MT

Process Inputs

Send Outputs

Master Administration

Timer

Interrupt

App. TaskS P MT App. TaskS P MTIdle

NIC IRQ

Round

Trip

Time

Page 37: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Alternative synchronization instead of using DC, much simpler to implement

• Drawback: slave delay time not compensated

• Drawback: slave timing related to master frame send time jitter minimum send time jitter is required send frames immediately after timer irq on master

• Immediate slave reaction on new data (update when frame is received)

V3.1.1 37

Network Timing: Sync Manager (SM) Synchronization

Page 38: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

38

The external synchronization feature pack allows the synchronization of two or more EtherCAT segments by a Bridge device, e. g. Beckhoff EL6695

Feature Pack: External Synchronization (1)

The synchronization process is divided in two parts; DCM and DCX.

• DCM: Synchronize Master timer to slave. (MasterShift)

• DCX: Synchronize slaves to bridge device. (BusShift)

V3.1.1

Page 39: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• The Bridge has two EtherCAT connections. The primary port is connected to the primary segment; the secondary port is connected to the secondary segment. The Bridge provides an internal (primary port) and an external (secondary port) time stamp which is used by the Master to adjust the Ref-Clock.

• The Bridge device must support the “External Synchronization Status” PDO 0x10F4 see document ETG.1020 chapter “21.1.2 Synchronization by a Bridge device”.

• During startup the two segments can be powered-on at different times. That means that there will be an absolute time difference between the two segments.

V3.1.1 39

Feature Pack: External Synchronization (2)

Page 40: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Ethernet over EtherCAT® (EoE)

Page 41: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT Master Core

41

Class A: Includes Virtual Ethernet Switch for EoE

EtherCAT Application

EC Link Layer

Standard Ethernet MAC

Process Data Image

cycliccommands

XML ParserMailbox Services

req. resp.

acycliccommands

OS Layer

Virtual Ethernet Switch for EoE

Switch Port

Web Server

V3.1.1

Page 42: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT Master Core

42

Class A: Includes Virtual Ethernet Switch for EoE

EtherCAT Application

EC Link Layer

Standard Ethernet MAC

Process Data Image

cycliccommands

XML ParserMailbox Services

req. resp.

acycliccommands

OS Layer

Virtual Ethernet Switch for EoE

OSNetwork Stack

IP-Address192.168.150.1

Network Driver

Net ID192.168.150.x

IP-Address192.168.150.5

IP-Address192.168.150.6

EoE Frame Raw Access

EoE Endpoint API

V3.1.1

Page 43: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Configure drives connected to the EtherCATnetwork without additional cables

TCP/IP

User Input

Third Party drive tool can be used in parallel to standard application

Tunneling Ethernet traffic through EtherCAT network (EoE protocol)

Parameters+

Diagnosis

V3.1.1 43

Page 44: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

44

Windows Network Driver for EoE Endpoint with RAS

V3.1.1

Real-Time Kernel/OS

EtherCAT Application

RAS Server

RAS Client (TCP) TCP/IP

Virtual Ethernet Switch

ParametersDiagnosis

EoE Endpoint API

Third Party Tool (Windows)

EoE TAP Network Driver (Windows)

EC-EoE Gateway

• EoE Endpoint API supported by RAS-Client

• Windows EoE TAP Adapter using Endpoint API and creates a virtual network interface

• EC-EoE Gateway enables virtual network

• Third Party tool can use TCP/IP to communicate with slave

Page 45: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

45

• EoE Endpoint API supported by RAS-Client

• Windows EoE TAP Adapter using Endpoint API and creates a virtual network interface

• EC-EoE Gateway enables virtual network

• Third Party tool can use TCP/IP to communicate with slave

Windows Network Driver for EoE Endpoint with RAS

V3.1.1

Real-Time Kernel/OS

EtherCAT Application

RAS Server

RAS Client (TCP) TCP/IP

Virtual Ethernet Switch

ParametersDiagnosis

EoE Endpoint API

EoE TAP Network Driver (Windows)

IP-Address192.168.150.1

Net ID192.168.150.x

IP-Address192.168.150.5

10.10.0.101

10.10.0.106

EC-EoE Gateway

Third Party Tool (Windows)

Page 46: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EoE TAP Network Driver (Windows)

IP-Address192.168.150.1

V3.1.1 46

Page 47: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Select TAP adapter used

• Select Master to connect to

• Start• EoE Gateway connects to remote

master and enables the TAP adapter

• IP-connection to remote system is available

• Any tool can then use slave devices which support EoE

EC-EoE-Gateway

IP-Address192.168.150.1

V3.1.1 47

Page 48: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Setting IP address in EC-Engineer

IP-Address192.168.150.5

Slave supports EoE

V3.1.1 48

Page 49: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Functional Safety over EtherCAT (FSoE)

Page 50: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

50

• Fully integrated solution: Safe and standard communication in one channel

• Decentralized Safety-Logic

• Standard Master controller routes the safety messages

Safety over EtherCAT: Implementation Example

V3.1.1

S

S

S

Safety Inputs

FSoE Slave

Safety Logic

FSoE Master

Safety Outputs

FSoE Slave

Safety Drives

FSoE Slave S

Master

Page 51: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

V3.1.1 51

Example: Safety configuration with Beckhoff TwinCAT

.xml

ENI File

Real-Time Kernel/OS

EtherCAT Application

Beckhoff TwinCAT

Master

Page 52: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• Information is given in ENI file

• Copying of the data will be handled by master stack automatically In the example below 48 bits from process data input memory starting at offset 0 are

copied to process data output memory at offset 136

V3.1.1 52

Safety requires Slave-to-Slave Communication

.xmlENI File

Page 53: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Performance Measurements

Page 54: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Device: TI AM3359 Industrial Communications Engine CPU: TI Sitara AM3359 (Cortex-A8), 600 MhzSoftware: EC-Master V3.1.1.01 TI-RTOS, Link Layer ICSS-PRUFeatures: Distributed Clocks with DCM Bus Shift

ARM Cortex-A8, 32-Bit, 600 MHzCPU load depending on number of slaves

Number of Slaves 16 32 64

Network cycle time 250 usec 500 usec 1000 usec

Payload 128 Bytes 256 Bytes 512 Bytes

EC-Master Function

Process Inputs [usec] 34.2 35.1 50.2

Send Outputs [usec] 17.0 19.1 33.1

Administration [usec] 11.7 14.2 28.0

Send Acyclic Frame [usec] 16.2 14.9 14.5

Total Time [usec] 79.1 83.3 125.8

CPU Load [percent] 31.6 % 16.7 % 12.5 %

V3.1.1 54

Page 55: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Device: Toradex Apalis iMX8 CPU: NXP i.MX 8QuadMax 2x Cortex™-A72, 4x Cortex™-A53, 1000 MhzSoftware: EC-Master V3.1.1.01 Linux_aarch64, Link Layer FSLFECFeatures: Distributed Clocks with DCM Bus Shift

ARM Cortex-A72, 64-Bit, 1000 MHzCPU load depending on number of slaves

Number of Slaves 16 32 64

Network cycle time 250 usec 500 usec 1000 usec

Payload 128 Bytes 256 Bytes 512 Bytes

EC-Master Function

Process Inputs [usec] 17.1 18.8 27.1

Send Outputs [usec] 5.2 5.3 6.1

Administration [usec] 3.6 5.0 12.0

Send Acyclic Frame [usec] 3.6 3.6 3.6

Total Time [usec] 29.5 32.7 48.8

CPU Load [percent] 11.8 % 6.6 % 4.8%

V3.1.1 55

Page 56: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Device: Industrial Board IB891-D5 (EC1)CPU: Intel Atom D510 1600MHzSoftware: EC-Master V3.1.1.01 for QNX_x64 , Link Layer Realtek 8169Features: Distributed Clocks with DCM Bus Shift

Intel x64, 64-Bit, 1600 MHzCPU load depending on number of slaves

Number of Slaves 16 32 64

Network cycle time 250 usec 500 usec 1000 usec

Payload 128 Bytes 256 Bytes 512 Bytes

EC-Master Function

Process Inputs [usec] 11.3 11.5 13.5

Send Outputs [usec] 6.3 6.4 6.9

Administration [usec] 5.8 8.0 15.7

Send Acyclic Frame [usec] 4.2 4.4 4.1

Total Time [usec] 27.6 30.3 40.2

CPU Load [percent] 11.0 % 6.0 % 4.0 %

V3.1.1 56

Page 57: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

EtherCAT® and GPL

EC-Master on Linux

Page 58: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

What is necessary to use EtherCAT?

• Member of the EtherCAT Technology Group (ETG)

• Recommended: Beckhoff “ETHERCAT MASTER LICENSE AGREEMENT”

• Whereas, Licensor is the owner of all intellectual property rights pertaining to the EtherCAT Technology, including but not limited to (a) the following German patent applications and patents: EP1590927, EP1789857, DE102004044764, DE102007017835 with corresponding applications or registrations in various other countries, and (b) the trademarks "EtherCAT“ and "Safety over EtherCAT", with applications or registrations in the European Community (CTM003122736, CTM006350029, CTM005460563) and corresponding registrations or applications in various other countries.

• Whereas, Licensee intends to create and/or sell or otherwise distribute a product incorporating the EtherCAT Technology;

• Whereas, Licensor is willing to permit Licensee to create and/or sell or otherwise distribute a product incorporating the EtherCAT Technology;

• Whereas, Licensee acknowledges Licensor’s commercially reasonable efforts to keep the

number of those EtherCAT Technology products in the market sold under the trade name

“EtherCAT” and not being fully compatible with the then current version of the EtherCAT

Technology at a minimum.

58

EtherCAT® Licensing

V3.1.1

Page 59: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

• The GPL is the first copyleft license for general use, which means that derived works can only be distributed under the same license terms.

• GPL:6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.http://www.gnu.org/licenses/gpl-2.0.html

• The Linux kernel is released under the GNU General Public License version 2.

Linux and the GNU General Public License (GPL)

V3.1.1 59

Page 60: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

ETG web site: http://www.ethercat.org/en/faq.html#790

3.4 How about Open Source? EtherCAT technology itself is not Open Source. EtherCAT cannot be licensed in conjunction with ANY Open Source License!

Backed by the standardization of EtherCAT by IEC, ISO and SEMI, access to EtherCAT technology is available to everyone to non-discriminatory terms. Additionally, Master Licenses are free of royalties. Maintenance and all further development of the technology is available to all users by membership within the ETG, the user group for EtherCAT technology. If you have questions regarding implementing or using EtherCAT in conjunction with shared source or open source systems please contact ETG headquarters or Beckhoff, the EtherCAT technology licensor.

What does this mean for EtherCAT?

V3.1.1 60

Page 61: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

The EC-Master stack communicates with the slaves by sending and receivingEtherCAT frames using an Standard Ethernet network adapter (MAC).

The Linux system includes different network drivers for the different adaptertypes. The Linux network driver can be used by means of an abstracted networkadapter type independend interface called SOCK_RAW to send and receiveframes, although the performance may be poor and real-time constraints aretypically not kept due to Linux network stack inclusion and driver code that is not optimized for high performance cyclic operation.

Because SOCK_RAW is typically available on every Linux Distributions’ Kernel, the pre-compiled EcMasterDemo can be used for evaluation of the EC-Master library‘s general functionality without compiling any host specific files. Fordiscreet slaves that e.g. implement Distributed Clocks, real-time constraintsmust be kept. In this case SockRaw is very likely not able to send and receiveframes in time and the EtherCAT slaves will refuse the operation. ThereforeSOCK_RAW should be only used for intial evaluation purpose and be replacedwith the acontis real-time driver as explained below.

Architecture 1: Linux Network Driver

V3.1.1 61

Page 62: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Ker

nel

Sp

ace

Use

r Sp

ace

EtherCAT Master Core

EtherCAT Application

SOCK_RAW DriverOS Adaptation

User Space

Native Ethernet Driver

HARDWARE

Standard Ethernet MAC

RAM FLASH

CPU

Linux Network Stack

Kernel functions

Architecture 1: Linux Network Driver

HW driver independent

SOCK_RAW interface

V3.1.1 62

Page 63: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

The acontis Real-time Driver replaces the standard Linux Ethernet network adapter (MAC) driver for real-time EtherCAT usage.

The driver runs in User Space and handles the MAC directly for high performance cyclic operation. It needs direct access to the MAC granted by an GPL‘ed Kernel Module called atemsys. The Kernel module must be compiled to match the running Kernel. Methods for Kernel module compilation can be found in the Linux Distribution‘s documentation. Additionally a build recipe for Yocto Linux is included.

The Real-time Driver is not GPL‘ed and must be licensed. It needs the atemsys loaded at the Linux target for running. With the granted access to the MAC HW it operates fast on sending and receiving frames by completely bypassing the Linux network stack.

The standard Linux network adapter driver may not operate at the same time on the same instance as the acontis Real-time Driver. It is therefore needed to unbind the network adapter instance by removing the driver from the system, unbinding the instance using the virtual sys-fs or in case of embedded devices by modifying the Linux Device Tree.

The atemsys is shipped with the EC-Master and should be updated if the EC-Master contains a newer version.

Architecture 2: acontis Real-time Driver

V3.1.1 63

Page 64: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Ker

nel

Sp

ace

Use

r Sp

ace

EtherCAT Master Core

EtherCAT Application

Real-time DriverOS Adaptation

User SpaceHARDWARE

Standard Ethernet MAC

RAM FLASH

CPU

Moduleatemsys

Kernel functions

Direct access to hardware granted by

atemsys

Architecture 2: acontis Real-time Driver

V3.1.1 64

Page 65: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

The Linux operating system provides drivers for most common Ethernet controllers and the related physical transceivers (PHY). The manufacturer specific PHY circuit is handled by an dedicated kernel driver.

To make use of this infrastructure, the acontis kernel module atemsys has to be included in the Linux device tree as an official driver for the Ethernet controller. As a result atemsys can interact with Linux drivers.

Depending on the hardware architecture, atemsys can grants access to the MDIO bus to the Linux drivers, or request MDIO operations by Linux drivers.

The PHY “OS Driver” functionality is configured exclusively through the Linux device tree and doesn’t required any additional configuration at the application level.

Architecture 3: acontis Real-time Driverwith Linux device tree support

65

Page 66: EtherCAT Master Stack · The demo runs in conjunction with MS .NET Framework as well as with Mono. C# Example application •EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application

Ker

nel

Sp

ace

Use

r Sp

ace

Real-time Driver (Link Layer)

StandardEthernetMAC

Module atemsys

Linux PHY driver

MDIO Interface

MDIO Register PHY

MDIO Data

Link Status

MDIO Bus

Link

MII/RGMII

EtherCAT Master Core

EtherCAT Application

OSLayer