Ether Cat 12 Mar 2010

47
1 EtherCAT Communication 1 © Copyright by Beckhoff, 2007 EtherCAT Technology Group EtherCAT Communication Communication Principles Florian Häfele EtherCAT Communication 2 EtherCAT Basics Slave Structure Physical Layer Device Model (ISO/OSI) Data Link Layer Frame Structure Addressing Commands Memory/Registers SyncManager FMMU Diagnosis Application Layer State Machine Mailbox Mailbox Interface EoE Ethernet CoE CANopen FoE File Access SoE Servo Drive Slave Information /IF Device Profiles Motivation Gateway Profiles Distributed Clocks Device Description Configuration Tool EtherCAT Master Standards © Copyright by Beckhoff, 2007 Topology EtherCAT Segment (Slaves) Master Flexible Topology Any number of physical layer changes possible Standard Ethernet 100m cable distance between 2 devices Up to 65.535 devices possible

Transcript of Ether Cat 12 Mar 2010

Page 1: Ether Cat 12 Mar 2010

1

EtherCAT Communication 1© Copyright by Beckhoff, 2007

EtherCAT Technology Group

EtherCAT Communication

Communication Principles

Florian Häfele

EtherCAT Communication 2

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Topology

EtherCAT Segment (Slaves)

Master

• Flexible Topology• Any number of physical layer changes possible• Standard Ethernet 100m cable distance between 2 devices• Up to 65.535 devices possible

Page 2: Ether Cat 12 Mar 2010

2

EtherCAT Communication 3

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Functional Principle: Ethernet „on the Fly“

Car 27

Analogy Fast Train:• „Train“ (Ethernet Frame) does not stop• Even when watching „train“ through narrow window one

sees the entire train• „Car“ (Sub-Telegram) has variable length• One can „extract“ or „insert“ single „persons“ (Bits) or

entire „groups“ – even multiple groups per train

EtherCAT Communication 4

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Functional Principle: Ethernet „on the Fly“

Slave Device

EtherCAT Slave Controller

Slave Device

EtherCAT Slave Controller

• Process data is extracted and inserted on the fly• Process data size per slave almost unlimited

(1 Bit…60 Kbyte, if needed using several frames)• Compilation of process data can change in each cycle,

e.g. ultra short cycle time for axis, and longer cycles for I/O update possible

• In addition asynchronous, event triggered communication

Page 3: Ether Cat 12 Mar 2010

3

EtherCAT Communication 5

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

DVI

IPC

....

Frame Processing within one node

EtherCAT Segment (Slaves)Master

vom Master

zum Master

vom Master

EtherCAT Communication 6

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Logical Process Data Image

logi

sche

sPr

ozes

sabb

ild: b

is4

GB

yte

0

232 Telegrammstruktur

Ethernet HDR HDR 1 PLC Data HDR 2 NC Data HDR n Data n CRC

PLC Data

Data n

NC DataSub-Telegramm 1

Sub-Telegramm 2

Sub-Telegramm n

DVI

IPC

....

Page 4: Ether Cat 12 Mar 2010

4

EtherCAT Communication 7

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Slave Structure

PHY PHY

Traf

o TrafoRJ4

5 RJ45

ESC

HostCPU

EEPROM

Standard Ethernet Physical Layer Components

DVI....

EtherCAT Master

EDSXML

ElectronicData Sheet

Slave

Slave-Hardware

Application Layer(Mailbox Protocols)

ESCConfiguration

Data

EtherCATSlave

Controller

EtherCAT Communication 8

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Ethernet on LVDS physics (E-Bus):

for modular devices

EtherCAT Physical Layers

• On cables: 100BaseTX or 100BaseFx• Device internal: E-Bus (LVDS)

Ethernet on 100BASE-TX;

up to 100 m, with transformer coupling

any number of physical layer

changes allowed

E-Bus

DVI

IPC

....

Page 5: Ether Cat 12 Mar 2010

5

EtherCAT Communication 9

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Physical Layer

• 100 BASE-TX– Most popular physical layer for Fast Ethernet– Shielded twisted pair (STP) with 2 pairs of wires– Cable categories CAT5, 6, 7 can be used– RJ45 connector standard, M12 connector for IP67– PHY Support for auto negotiation and auto crossover

recommended• 100 BASE-FX

– All media options possible– Simple solution for TX-to-FX converter

• E-BUS– Interface for low cost backplane applications– Widely used LVDS (Low Voltage Differential Signaling)

adopted– Use Manchester Bit Coding– LVDS: Low Voltage Differential Signaling according to

ANSI/TIA/EIA-644, also used in IEEE 802.3ae (10Gigabit Ethernet)

EtherCAT Communication 10

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Port Management

• A Slave Controller can have up to 4 EtherCAT Ports

• If a Port is closed the controller forward it to the next portPorts can be opened/closed automatically with link up or opened closed by EtherCAT command

• The EtherCAT frame processing and forwarding order depends on logical ports configured:

0 EtherCAT Processing Unit 3 / 3 1 / 1 2 / 2 0 4 ports

0 ECAT Proc. Unit 1 / 1 2 / 2 0 (log. ports 0,1, and 2)or0 ECAT Proc.Unit 3 / 3 1 / 1 0 (log. ports 0,1, and 3)

3 ports

0 EtherCAT Processing Unit 1 / 1 0 2 ports

Page 6: Ether Cat 12 Mar 2010

6

EtherCAT Communication 11

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Frame ProcessingAuto Forwarder and Loop Back

1

Port 2

Auto-Forwarder

Port 1

Port 3

Auto-Forwarder

Port 0

Loopback function

EtherCAT Processing Unit

Loopback function

ET1100

port 2 closed

port 2 open

port 3 open

port 3 closed

EtherCAT Communication 12

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

ISO/OSI Layer Model

• * „empty“ means that the layer behavior exists, but is not shown explicitly

7654321

empty*

OSILayers

Application Layer (AL)

Data Link Layer (DLL)

Physical Layer (PhL)

Page 7: Ether Cat 12 Mar 2010

7

EtherCAT Communication 13

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Device Model – ISO/OSI Reference

Physical Layer

EtherCAT Data Link Layer

SDO

Process DataMailbox

Object Dictionary

AL Control/AL Status

Applicatione.g. DS402 Drive Profile

PDO Mapping

IP

UDPTCP

HTTP, FTP, …

SoEServiceChannel

ServoApplicationAccordingIEC 61491

DataLink Layer(DL)

ApplicationLayer(AL)

DLAddress

DLInfo

Sync Man Settings

Slav

e In

form

atio

n

FMMUFMMUFMMUFMMU n

DL Control/DL Status

File Access

Appli-cation

LayerManagement

Ethernet

PhysicalLayer (PHY)

03.10.2007 EtherCAT Communication 14© Copyright by Beckhoff, 2007

Application

EtherCAT Slave Controller (ESC)

Applicatione.g. CiA402 Drive Profile

HTTP,FTP, ..

Appli-cation

PHY

Trafo

RJ45PHY

Traf

o

RJ4

5

FMMU

SyncMan1 MbxIn

SIIEEPROM

MII / EBUSPort 3

MII / EBUSPort 1

EtherCAT Processing Unit and Auto-Forwarder with Loop Back

LVDS

Con

Process DataMailboxRegisters

DataLinkLayer(DL)

PhysicalLayer(PL)

FMMU

SyncMan2 SyncMan3

SDO

Object Dictionary

PDO...

ApplicationLayer (AL)

FileAccess

TCP, UDP

ESC Address Space (DPRAM)

FMMUFMMU n

IP

PDO Mapping

CoECoEEoEFoEVoE

Process Data Interface (µC, SSI, I/O )

….

PHYManagement

FMMU n

SyncMan0 MbxOut

RD / WR

MII / EBUSPort 0

MII / EBUSPort 2

Ethernet HDRLRWProcess DataFPWRMailbox DataMore Datagrams..FCS ECAT HDR

WK

C

WK

C

HD

R

HD

R

Mailbox DLL

0x0000 0x1000

Page 8: Ether Cat 12 Mar 2010

8

EtherCAT Communication 15

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Data Link Layer – Overview

• Standard IEEE 802.3 Ethernet Frame– No special requirements for the master– Use of standard Ethernet infrastructure

• IEEE Registered EtherType: 88A4h– Optimized frame overhead– IP stack not required– Simple master implementation

• Additionally over UDP (IANA registered Port 88A4h)

– EtherCAT communication over the Internet possible– Using of standard sockets

• Frame processing at Slave side– EtherCAT Slave Controller processes the frame in

hardware• Communication Performance independent from processor power

– no time critical reaction at slave side in software

EtherCAT Communication 16

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Ethernet / EtherCAT Frame StructureEthernet Frame: max. 1514 Byte

Ethernet Header Ethernet Data FCS

Destination EtherType16 Bit48 Bit48 Bit 32 Bit

Source EtherCAT Data FCSEtherType 88A4h

Destination EtherTypeSource16 BitHeader Datagrams FCS

48 -1498 Byte

Simple EtherCAT Communication

1

1

UDP Destination Port 88A4h

16 Bit

Dest TypeEtherType 0800h

Src IP Header UDP H.160 Bit 64 Bit

Header Datagrams FCS48 -1470 Byte

2

EtherCAT communication over Internet 2

TypeRes.Length

1 Bit 4 Bit11 Bit

Type of following dataReserved

Length of following EtherCAT datagrams (not checked by slave)

Page 9: Ether Cat 12 Mar 2010

9

EtherCAT Communication 17

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Frame Header

TypeRes.Length4 Bit11 Bit 1 Bit

0 11 12 15

Type Meaning-----------------------------------------------------------------------0: Reserved1: EtherCAT Datagram (s)

the only type that is evaluated by the ESC2,3: Reserved4: Network Variables 5: Mailbox over IP6-15: Reserved for future use

EtherCAT Communication 18

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Datagrams

Ethernet H. Ethernet Data FCS

EtherCAT Datagrams FCS14 Byte 4 Byte2 Byte 44*-1498 Byte

Ethernet H. 10Len

* add 1-32 padding bytes if Ethernet frame is less than 64

EtherCAT Datagrams

Datag. Header Data WKC10 Byte 2 Bytemax. 1486 Byte

WKC = Working Counter

1st EtherCAT Datagram nth EtherCAT Datagram2nd…. ….

Page 10: Ether Cat 12 Mar 2010

10

EtherCAT Communication 19

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Working Counter Details

• EtherCAT Datagram ends with a 16 Bit Working Counter• Working Counter counts the number of interactions of

devices addressed by an EtherCAT Datagram• EtherCAT Slave Controller increments the Working

Counter in hardware – if the controller is addressed and the addressed memory is accessible (Sync Manager)

• Each Datagram should have an expected Working counter value – calculated by the configuration tool

• The Master checks the valid processing of EtherCAT Datagrams by comparing the Working Counter with the expected value

• Special case: RW addressing methods will increment WKC by 2 for write access and by 1 for read access

EtherCAT Communication 20

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Working Counter Example

PC1xread+1xwrite+ 1+read/ write = 5

node 2

DO=write

WC+1=2

node 1

DI = read

WC+1=1

node 3

DI/DO=read+write

WC+3=5

WC=0 WC=1 WC=2 WC=5

WC=5WC=5WC=5

• WKC valid: data of this datagram was written to and read from all addressed devices

• WKC invalid: memory of one or more devices was not accessible

Page 11: Ether Cat 12 Mar 2010

11

EtherCAT Communication 21

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Working Counter Example

WC+1

WC+1

WC+3

WC+1

WC+1

EtherCAT Communication 22

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Datagram Header Address

Ethernet H. Ethernet Data FCS

EtherCAT Datagrams FCS14 Byte 4 Byte2 Byte 44*-1498 Byte

Ethernet H. 10Len

* add 1-32 padding bytes if Ethernet frame is less than 64

EtherCAT Datagrams

Datag. Header Data WKC10 Byte 2 Bytemax. 1486 Byte

WKC = Working Counter

Cmd Idx Address Len R M IRQ8 Bit 8 Bit 32 Bit 16 Bit11 Bit 2

More EtherCAT Datagrams?

1st EtherCAT Datagram nth EtherCAT Datagram2nd…. ….

C R1 1 1

Circulating Datagram?

Page 12: Ether Cat 12 Mar 2010

12

EtherCAT Communication 23

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Datagram Header Address

Ethernet Frame Header Address

EtherCAT Addressing Overview

Segment Addressing

Device Addressing

Position Addressing

Logical Addressing

Node Addressing

MAC Address

Process Data Address

Assigned Node Address

Address by physical Position

EtherCAT Communication 24

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Segment Addressing by MAC Address

EtherCAT Segment = Ethernet Device

EtherCAT Segment = Ethernet Device

MasterDevice Switch

SegmentAddressSlave Device

Slave Device

Slave Device

Slave Device

Slave Device

Slave Device

Generic Ethernet Device

Slave Device

Slave Device

Slave Device

Slave Device

Slave DeviceMaster

Device

SegmentAddressSlave Device

• Direct mode (no switch): broadcast MAC AddressEtherCAT Segment = Ethernet Device

Slave Device

Slave Device

Slave Device

Slave Device

Slave Device

Slave Device

MasterDevice

• Open mode: One MAC-Address for an EtherCAT Segment

Page 13: Ether Cat 12 Mar 2010

13

EtherCAT Communication 25

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Addressing

Ethernet H. Ethernet Data FCS

EtherCAT Datagrams FCS14 Byte 4 Byte2 Byte 44*-1498 Byte

Ethernet H. 10Len

* add 1-32 padding bytes if Ethernet frame is less than 64

EtherCAT Datagrams

Datag. Header Data WKC10 Byte 2 Bytemax. 1486 Byte

WKC = Working Counter

Cmd Idx Address Len R M IRQ8 Bit 8 Bit 32 Bit 16 Bit11 Bit 4 1

1st EtherCAT Datagram nth EtherCAT Datagram2nd…. ….

EtherCAT Communication 26

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Address Field

Auto Increment Addressing (local)

Cmd Idx

Position Offset

Len R M IRQ

Logical Address

8 Bit 8 Bit

16 Bit 16 Bit

16 Bit11 Bit 2

Address Offset

Address32 Bit

Fixed Addressing (local)

Logical Addressing (global)

• 32 Bit address space

- used for 16 bit device addressing (65.535 devices possible) and 16 bit for addressing local memory space of device (max. 64kByte)

or

- 32 bit logical addressing

C R1 1 1

Page 14: Ether Cat 12 Mar 2010

14

EtherCAT Communication 27

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Auto Increment Addressing

• Negative Auto Increment Address for every slave depending on position (16 bit)

• Slave which reads address == 0x0000 is addressed

• Every slave increments address by 1

• Offset addresses local memory space of device

• Usually used during scan of hardware configuration

DVI

IPC

....

0xFF

FE0x

FFFF

0xFF

FD

0xFF

FC

0xFF

FB

0xFF

F80x

FFF9

1 2 3 45 6

7 8 9

0xFF

FA

0x00

00

Position Offset16 Bit 16 Bit

EtherCAT Communication 28

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Fixed Addressing

• Every Slave has a fixed address (16 bit)

• Usually assigned during hardware configuration scan

• Independent from slave position

• Fixed address lost after power loss

DVI

IPC

....

0x3E

A0x

3E9

0x3E

B0x

3EC

1 2 3 4

5 6

7 8 9

0x3E

D

0x3E

E

0x3E

F0x

3F0

0x3F

1

Address Offset16 Bit 16 Bit

Page 15: Ether Cat 12 Mar 2010

15

EtherCAT Communication 29

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Logical Addressing

• Slave reads from/ writes its data into the 4 GByte great Ethernet frame (fragmented)

0

232 Telegrammstruktur

Ethernet HDR HDR 1 PLC Data HDR 2 NC Data HDR n Data n CRC

PLC Data

Data n

NC DataSub-Telegramm 1

Sub-Telegramm 2

Sub-Telegramm n

DVI

IPC

....

Logi

cal p

roce

ss im

age

up to

4 G

Byt

e

Logical Address32 Bit

EtherCAT Communication 30

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Commands

• Different commands to optimize reading and writing for all access methods within a Fieldbus communication system

Cmd Idx Len R M IRQ

32 Bit logical addressR, W, RWLogical

CommentOffsetAddressAccessCmd Type

Local Memory Address

(increments)R, W, RWBroadcast

Match address value to local address register

Local Memory Address

Address(configured)

R, W, RW, RMW

configured Address

Position value 0(at entry) addressed

Local Memory Address

Position(increments)

R, W, RW, RMW

Auto Increment

No OperationNOP

Address Offset C R

Page 16: Ether Cat 12 Mar 2010

16

EtherCAT Communication 31

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Commands

• Broadcast Read– Individual Bits of a Byte will be added with a bitwise

OR operation between incoming data and local data

• Read Write Actions– Exchange of incoming data and local data

(exception: Broadcast – see broadcast read)

• Read Multiple Write Actions (RMW)– Addressed Station will read the others will write

EtherCAT Communication 32

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Local Address Space of ESC

Registers

User memoryprocess data in

process data out

mailbox data out

mailbox data in

0x0110 DL Control0x0110 DL Status0x0120 AL Control0x0130 AL Status……

4 kByte

1..60 kByte

ESC

0x1000

0xFFFF

0x0000

0x0FFF

Page 17: Ether Cat 12 Mar 2010

17

EtherCAT Communication 33

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Local Address Space of ESC

• 64 kByte address space• Divided into registers and dual ported RAM (DPRAM)• First 4 kByte are reserved for registers• DPRAM starts at 1000h• DPRAM size depends on Slave Controller implementation

(up to 60 kByte, 4kByte in actual FPGA implementation)• Addressing of registers and DPRAM same• Register Write is different –

shadow Register for all Registers integratedDPRAM write is not shadowed

EtherCAT Communication 34

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Register of EtherCAT Slave Controller

• First 1000h bytes (4 kbytes) of local address space• Read access for both sides (EtherCAT and application)• Write access from EtherCAT for most of the registers

– Master has to configure the Slave Controller• No address settings needed• FMMU and Sync Manager configuration can be

optimized for available bandwidth and cycle times– Exceptions that are writable from the application side:

• AL Status Register, AL Status Code Register, AL Event Mask Register, Sync Manager Disable Registers, AL Identification Registers

• Process Data Interface (PDI) register initialized from Slave Information interface (Serial EEPROM)

Page 18: Ether Cat 12 Mar 2010

18

EtherCAT Communication 35

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Register

• Registers might be monitored via configuration tool

EtherCAT Communication 36

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

SyncManager Overview

• SyncManager protects a DPRAM section from simultaneous access data consistency

• Mailbox Type– 1 buffer SyncManager supports handshake– Data overflow protection– Writing side must write before reading side can read– Reading side must read before writing side can write again

• Buffered Type– 3 buffer SyncManager guarantees consistent data delivery

and access to the newest data any time – Always a free buffer to write– Always a consistent buffer to read (except before the first

writing)– Usually used for process data communication

• Up to 16 independent SyncManger channels possible• The SyncManager configuration registers start at address

0x0800

Page 19: Ether Cat 12 Mar 2010

19

EtherCAT Communication 37

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Buffered Type (3 buffers) Write Example

• Characteristic: Data always available for both sides• Requires 3 (consecutive) memory areas

ECAT NEXT USEREtherCAT PDI

Write end

Write begin WRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITE1 2 3

Read end

2

3Read latest available data

Read latest available data

READ READ READREAD READ READREAD READ READREAD READ READREAD READ READ

Write begin

2ECATECATECATECATECATECATECATECATECATECATECATECATECATECAT

1WRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITE

1WRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITEWRITE WRITE WRITE

3READ READREAD READ READREAD READ READ

….Go on Reading

a

b

c

Cycle begins again a

EtherCAT Communication 38

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Mailbox Type (1 buffer) Read Example

• Allows handshake Communication• Useful for non-Process Data• Handshake mechanism – one side has control

EtherCATMaster

FailedMBX Empty

Read

ReadWKC = 0

Write

Write

MBX Full Successfull

Slave

MBX EmptyRead

ReadWKC = 1

Successfull

Page 20: Ether Cat 12 Mar 2010

20

EtherCAT Communication 39

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Fieldbus Memory Management Unit (FMMU)

• Maps a section of the local address space into the global address space and vice versa

• Read and write access distinguishable• Bitwise configuration of the memory section possible• Up to 16 independent FMMU channels possible

– FMMU configuration registers start at address 0x0600

• Operation samples:• Mapping of process data into the global address space• Mapping of status bits from the register section

– Access to device specific status information with a minimum overhead – e.g. fill status of a sync manager channel

EtherCAT Communication 40

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

FMMU Usage for Addressing

• Global address space• 4 GByte address space• Mapping to local addresses by

Fieldbus Memory Management Units (FMMU)• All EtherCAT devices can map data in a single EtherCAT

Datagram LRW – depending on the FMMU configuration

Ethernet HDR EH Data FCSFH WKC

Page 21: Ether Cat 12 Mar 2010

21

EtherCAT Communication 41

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

FMMU Setup

1. Master reads hardware configuration including input and output data length of each slave

2. Master organizes mapping of process data3. Master distributes information (start address etc.) for

every slave about where process data in logical process image is provided

4. Process data communication starts

EtherCAT Communication 42

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Monitoring of EtherCAT Communication

Switch

Master

• Masters sends an EtherCAT Frame (broadcast) Monitor gets the first copy (unprocessed)

• Frame returns from EtherCAT Slave Devices Monitor gets the second copy (processed)

• DLL for readable format available on EtherCAT Web site

Network Monitor

Page 22: Ether Cat 12 Mar 2010

22

EtherCAT Communication 43

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Monitoring of EtherCAT Communication

Master

• Masters sends an EtherCAT Frame (broadcast) Monitor gets the first copy (unprocessed)

• Frame returns from EtherCAT Slave Devices Monitor gets the second copy (processed)

• DLL for readable format available on EtherCAT Web site

Network Monitor

Attention: At low cycle times order of frames might be mixed because of timing restrictions within NDIS protocol driver

EtherCAT Communication 44

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Purpose of Application Layer (AL)

• EtherCAT State Machine• Mailbox Interfaces and Protocols

– Ethernet over EtherCAT– CANopen over EtherCAT– Filetransfer over EtherCAT– Servo Drive over EtherCAT

• Slave Information Interface (SII)

Page 23: Ether Cat 12 Mar 2010

23

03.10.2007 EtherCAT Communication 45© Copyright by Beckhoff, 2007

Application

EtherCAT Slave Controller (ESC)

Applicatione.g. CiA402 Drive Profile

HTTP,FTP, ..

Appli-cation

PHY

Trafo

RJ45PHY

Traf

o

RJ4

5

FMMU

SyncMan1 MbxIn

SIIEEPROM

MII / EBUSPort 3

MII / EBUSPort 1

EtherCAT Processing Unit and Auto-Forwarder with Loop Back

LVDS

Con

Process DataMailboxRegisters

DataLinkLayer(DL)

PhysicalLayer(PL)

FMMU

SyncMan2 SyncMan3

SDO

Object Dictionary

PDO...

ApplicationLayer (AL)

FileAccess

TCP, UDP

ESC Address Space (DPRAM)

FMMUFMMU n

IP

PDO Mapping

CoECoEEoEFoEVoE

Process Data Interface (µC, SSI, I/O )

….

PHYManagement

FMMU n

SyncMan0 MbxOut

RD / WR

MII / EBUSPort 0

MII / EBUSPort 2

Ethernet HDRLRWProcess DataFPWRMailbox DataMore Datagrams..FCS ECAT HDR

WK

C

WK

C

HD

R

HD

R

Mailbox DLL

0x0000 0x1000

EtherCAT Communication 46

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Purpose of EtherCAT State Machine

• State Machine is build upon the Data Link Layer • Defines general communication states of EtherCAT slave

devices• Specifies the initialization and error handling of EtherCAT

slave devices Boot-up of the network• States correspond to the communication relationship

between master and slave• Requested and current state of a slave device are

reflected in the AL Control and AL Status registers• Five states are defined:

– ‘Init’, ‘Pre-Operational’, ‘Safe-Operational’, ‘Operational’

– ‘Bootstrap’ optional state for firmware updates

Page 24: Ether Cat 12 Mar 2010

24

EtherCAT Communication 47

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT State Machine

Init

(IP)

Pre-Operational

Operational

Safe-Operational

(OP)

(PI)

(PS) (SP)

(OS)(SO)

(SI)

(OI)

Bootstrap(optional)

(IB) (BI)

EtherCAT Communication 48

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

State Machine / Init

• ‘Init’ State• No communication on the

Application Layer• Master has access to the

DL-Information registers

• Transition to ‘Pre-Operational’• Master configures register, at least:

– DL Address register– Sync Manager channels for Mailbox communication

• Master requested ‘Pre-Operational’ state– sets AL Control register– wait for AL Status register confirmation

Init

Pre-Operational

Operational

Safe-Operational

Page 25: Ether Cat 12 Mar 2010

25

EtherCAT Communication 49

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

State Machine / Pre-Operational

• ‘Pre-Operational’ State• Mailbox communication on the

Application Layer• No Process Data communication

• Transition to ‘Safe-Operational’• Master configures parameter using the Mailbox

– e.g.: Process Data Mapping• Master configures DL Register

– SyncManager channels for Process Data communication

– FMMU channels• Master requested ‘Safe-Operational’ state

Init

Pre-Operational

Operational

Safe-Operational

EtherCAT Communication 50

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

State Machine / Safe-Operational

• ‘Safe-Operational’ State• Mailbox communication on the

Application Layer• Process Data communication,

but only Inputs are evaluated –Outputs in ‘Safe’ state

• Transition to ‘Operational’• Master sends valid Outputs• Master requested ‘Operational’ state

(AL Control/Status)

Init

Pre-Operational

Operational

Safe-Operational

Page 26: Ether Cat 12 Mar 2010

26

EtherCAT Communication 51

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

State Machine / Operational

• ‘Operational’ State• Inputs and Outputs are valid

Init

Pre-Operational

Operational

Safe-Operational

EtherCAT Communication 52

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

State Machine / Bootstrap

• ‘Bootstrap’ State• ‘Bootstrap’ State is optional –

but recommended if firmwareupdates necessary

• State changes only from and to ‘Init’• No Process Data communication • Communication via Mailbox on Application Layer• Special mailbox configuration possible,

e.g. larger mailbox size• Only FoE protocol available (possibly limited “file” range)

Init

Pre-Operational

Operational

Safe-Operational

Bootstrap

Page 27: Ether Cat 12 Mar 2010

27

EtherCAT Communication 53

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

State Machine / Control and Status

• Requested and current state of a slave device are reflected in the AL Control and AL Status registers

– AL Control (0x0120)Initiate State Transition of Device State Machine

– AL Status (0x0130)Actual State of Device State Machine

– AL Status Code (0x0134)Reason of error or other status code

EtherCAT Communication 54

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Full duplex capableMailbox Transfer for Parameter Data

Mailbox Transfer

DVI

IPC

....

Statusword0x6041

Controlword0x6040

Actual values0x2070

Motor parameter0x2040

Velocity control0x2010

Current control0x2000

TxPDO Mapping0x1A00

RxPDO Mapping0x1600

ValueIndex

Device Parameter (example)

Simple IO-DeviceNo Parameter

No Mailbox necessary

State "PreOperational"

Page 28: Ether Cat 12 Mar 2010

28

EtherCAT Communication 55

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Purpose of Mailbox Transfer

• Standard way to exchange Parameter Data• The Mailbox Interface is optional – but recommended• Needed if Process Data configurable or any other non

cyclic services• Full duplex capable

(Slave can initiate a communication)• 2 Sync Manager channels reserved

– Sync Manager 0 : Master to Slave– Sync Manager 1 : Slave to Master

• Available at early stage of communication (State Pre-Operational)

• Multi protocol capable

EtherCAT Communication 56

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Mailbox Protocol Types

• Ethernet over EtherCAT (EoE)– Tunnels standard Ethernet Frames over EtherCAT

• CANopen over EtherCAT (CoE)– Access of a CANopen object dictionary and its objects– CANopen Emergency and optional event driven PDO

messages

• File Access over EtherCAT (FoE)– Download and upload firmware and other ‘files’

• Servo Drive over EtherCAT (SoE)– Access the Servo Profile Identifier (IDN)

• Vendor specific Profile over EtherCAT (VoE)– First DWORD contains the Vendor ID, the next WORD

contains a Vendor Type, the rest is vendor specific

Page 29: Ether Cat 12 Mar 2010

29

EtherCAT Communication 57

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Mailbox Interface

• Datagram within an EtherCAT Frame• 2 Sync Manager channels (1 buffer-mode) reserved

– Sync Manager 0 : Master to Slave Mbx– Sync Manager 1 : Slave to Master Mbx

EC HeaderType = 1

EtherCAT Data

1st EtherCAT Datagram nth EtherCAT Datagram…

Ethernet HeaderType = 88A4h

FCS

2nd …

Datag. Header Data WKC

Mailbox Protocol

Mbx Header Command Cmd specific data

EtherCAT Communication 58

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Ethernet over EtherCAT (EoE)

virtual Ethernet Switch

Functionality

Web servervirtual MAC Address

IP Address

Label printer Web access on device withweb server

Even via Internet

Switchport-Terminal

Master

TCP/IP

Page 30: Ether Cat 12 Mar 2010

30

EtherCAT Communication 59

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Purpose of Ethernet over EtherCAT (EoE)

• Tunnels transparently Ethernet Frames over EtherCAT• Tunneling reduces the cycle times without restrictions and

to optimized available bandwidth• Used for devices with TCP/IP stacks (e.g. Web Server)

and for infrastructure devices like Switch Terminals• Allows to access corresponding devices in the normal IP

network in combination with a ‘Virtual Ethernet Switch’(Layer 2) on the master side

EtherCAT Communication 60

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

CANopen over EtherCAT (CoE)

• Recommended protocol for Service Data Access– Configuration of communication parameter– Configuration of device specific parameter

• Easy migration path from CANopen Devices to EtherCAT CoEDevices

– Protocol Stacks can be re-used

Page 31: Ether Cat 12 Mar 2010

31

EtherCAT Communication 61

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

File Access over EtherCAT (FoE)

• Similar to TFTP (Trivial File Transfer Protocol, RFC 1350)

• Simple to implement – suitable for bootstrap loaders

• 6 Services are defined:– WRQ: Write request with “file name”– RRQ: Read request with “file name”– DATA: Data block (full mailbox size used)– ACK: Acknowledgment of DATA and WRQ requests– ERR: Error notification with predefined error codes– BUSY: Busy notification in case of longer procedures,

extension to TFTP (e.g. erasing of flash modules)

• Special mailbox configuration for bootstrap mode possible– Fixed addresses and fixed size of the mailbox– Configuration defined by device (EEPROM)

EtherCAT Communication 62

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Servo Drive over EtherCAT (SoE)

• Implements Service Channel– Read / Write to several elements of an IDN (Ident number)– Support of Procedure Commands– Slave Info

• The mapping of the IEC 61800-7-1 Annex D (SERCOS™) on EtherCAT is described in IEC 61800-7-3 Annex D

Page 32: Ether Cat 12 Mar 2010

32

EtherCAT Communication 63

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Slave Information Interface (SII)

PHY PHY

Traf

o TrafoRJ4

5 RJ45

ESC

HostCPU

EEPROM

DVI....

EDSXML

Slave

ESCConfiguration

Data

03.10.2007 EtherCAT Communication 64© Copyright by Beckhoff, 2007

Application

EtherCAT Slave Controller (ESC)

Applicatione.g. CiA402 Drive Profile

HTTP,FTP, ..

Appli-cation

PHY

Trafo

RJ45PHY

Traf

o

RJ4

5

FMMU

SyncMan1 MbxIn

SIIEEPROM

MII / EBUSPort 3

MII / EBUSPort 1

EtherCAT Processing Unit and Auto-Forwarder with Loop Back

LVDS

Con

Process DataMailboxRegisters

DataLinkLayer(DL)

PhysicalLayer(PL)

FMMU

SyncMan2 SyncMan3

SDO

Object Dictionary

PDO...

ApplicationLayer (AL)

FileAccess

TCP, UDP

ESC Address Space (DPRAM)

FMMUFMMU n

IP

PDO Mapping

CoECoEEoEFoEVoE

Process Data Interface (µC, SSI, I/O )

….

PHYManagement

FMMU n

SyncMan0 MbxOut

RD / WR

MII / EBUSPort 0

MII / EBUSPort 2

Ethernet HDRLRWProcess DataFPWRMailbox DataMore Datagrams..FCS ECAT HDR

WK

C

WK

C

HD

R

HD

R

Mailbox DLL

0x0000 0x1000

Page 33: Ether Cat 12 Mar 2010

33

EtherCAT Communication 65

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Purpose of Slave Information Interface

• The mandatory Slave Information Interface (SII) consists of all objects that can be stored persistently.

• The information is stored in an EEPROM• EtherCAT Slave Controller has SPI interface to EEPROM

– 1 kBit … 4 MBit• The SII contains

– boot configuration data – device identity (mandatory)

• Vendor Id, Product Code, Revision No, Serial No• Same information in CoE object 0x1018

– application information data• Contains additional information (optional)

– Subdivided in categories

EtherCAT Communication 66

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

PDI access to SII (E²PROM)

• Standard: EEPROM assigned to EtherCAT Master• Master can grant access to PDI

– Change from INIT to PREOP Master• PDI can check SII content (e.g. Firmware

Revision compatible to Hardware Revision)(before ALCtrl=2 until ALStatus=2)

– Change from INIT to BOOT and while in BOOT• After Firmware Update PDI can update SII

information(before ALCtrl=3, ALCtrl=1 until ALStatus=1)

• Slave Sample Code V4.0 contains SII access from PDI

Page 34: Ether Cat 12 Mar 2010

34

EtherCAT Communication 67

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Device Profiles – Motivation

• The main issues of this device model are– modeling of structures within a device – usable for a large number of devices from very

simple one to complex sub-structured – easy way for master and configuration devices to

handle the device – use of similar channel profiles in all device types

shown below

EtherCAT Communication 68

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Fieldbus Gateway Profiles

• Gateways from EtherCAT to legacy Fieldbusses like- CANopen- Profibus- DeviceNet- …

Page 35: Ether Cat 12 Mar 2010

35

EtherCAT Communication 69

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

M S

S

S S S S S

S

∆t

Purpose of Distributed Clocks (DC)

Precise Synchronization (<< 1 µs!) by exact adjustment of distributed clocks

DVI

IPC

....

EtherCAT Communication 70

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

M S

S

S S S S S

S

External Clock Synchronization: IEEE 1588

Switchport with integrated IEEE 1588 Boundary Clock

DVI

IPC

....

IEEE 1588 Grandmaster

Clock

BoundaryClock

Page 36: Ether Cat 12 Mar 2010

36

EtherCAT Communication 71

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Distributed Clocks – Features

• Synchronization of EtherCAT devices• Definition of a System Time

– Beginning on January, 1st 2000 at 0:00h– Base unit is 1 ns– 64 bit value (enough for more than 500 years)– Lower 32 bits spans over 4.2 seconds

• Normally enough for communication and time stamping

• Definition of a Reference Clock– One EtherCAT Slave will be used as a Reference Clock– Reference Clock distributes its Clock cyclically– Reference Clock adjustable from a “global” Reference

Clock – IEEE 1588

EtherCAT Communication 72

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Distributed Clocks Unit

EtherCAT Slave Controller (ESC)

FMMU n

SyncMan

EtherCAT Address Space

EtherCAT Processing Unit and Auto-Forwarder with Loop Back

Port 0 Port 1 Port 2 Port 3

PHY

Traf

o

RJ4

5

PHY

Trafo

RJ45

Distributed Clocks

SPI / µC parallelDigital I/O Sync0 / Latch0

Sync1 / Latch1IRQ

Process Data Interface (PDI)

Sync / Latch Unit

DC Control

System Time

Offset

Delay

Page 37: Ether Cat 12 Mar 2010

37

EtherCAT Communication 73

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Features of DC Unit within ESC

• Provider for local time signals– Generation of synchronous local output signals

(SYNC0, SYNC1 Signals)– Generation of synchronous Interrupts

• Synchronous Digital Output updates and Input sampling• Precise time stamping of input events (Latch unit)

EtherCAT Communication 74

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Features of DC Unit within ESC

• Propagation delay measurement support– Each EtherCAT slave controller measures the delay

between the two directions of a frame– Master calculates the propagation delays between all

slaves • Offset compensation to Reference Clock

– Offset between local clock and Reference Clock– Same absolute system time in all devices– Simultaneousness (clear below 100ns difference) in

all devices• Drift compensation to Reference Clock

– DC Control Unit

Page 38: Ether Cat 12 Mar 2010

38

EtherCAT Communication 75

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

DC – Propagation Delay Measurement (I)

EtherCAT Node measures time difference between leaving and returning frame

vom MasterEtherCAT Frame

EtherCAT Communication 76

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

DC – Propagation Delay Measurement (II)

Propagation delays between any nodes can be computed

DVI

IPC

....

Page 39: Ether Cat 12 Mar 2010

39

EtherCAT Communication 77

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

MS

S

S S S S S

S

∆t

Offset and Drift Compensation

Same System Time in all devices

DVI

IPC

....

Global System Timee.g. by RTC or IEEE1588Reference: Jan 1st 2000

IndividualSystem Time Offset

EtherCAT Communication 78

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Device Description Overview

• Device Description File in XML format• One file suitable for a set of devices (from one Vendor)

• File contains information about:– Vendor

• Vendor ID, Name, Logo, …– Device groups

• Organization units to help configuration tools– Device

• Device Identity, Name, PDI type– PDO Mapping– FMMU / SyncManager

• number and usage

• Schema is defined in “EtherCATInfo.xsd”• Can be viewed with Browser, Text Editor or XML Editors

Page 40: Ether Cat 12 Mar 2010

40

EtherCAT Communication 79

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

XML and EEPROM

ConfigTool

XML

EEPROM0110010001010… (*.bin)

Configuration Tool generates binary file from device description to update EEPROM on slave

EtherCAT Communication 80

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Configuration Tool

• Configure EtherCAT Slave devices– Evaluate XML device description– Evaluate EEPROM information – if online

• Generate network initialization commands– Information for the EtherCAT driver– Initialization commands correspond to State Machine

transitions• Generates cyclic commands

– Information for the EtherCAT driver

Page 41: Ether Cat 12 Mar 2010

41

EtherCAT Communication 81

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Network Configuration

EtherCAT Configuration Tool

(Offline)

EtherCAT Master Driver

(Online)

XMLFile

Device Descriptions(XML)

ConfigurationInformation (XML)

General ExchangeFormat

ConfigurationInformation (binary)Vendor specific

Format

E2PROMInformation

EtherCAT Communication 82

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Configuration Exchange Format

• Vendor and Driver independent format• Master Vendor must not imperatively develop an own

Configuration Tool• Contains

– initialization commands – per slave device– cyclic process data commands– information about the mailboxes

Page 42: Ether Cat 12 Mar 2010

42

EtherCAT Communication 83

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Master

• Configuration with help of an EtherCAT configuration XML file

• Send and receive raw Ethernet frames from a network adapter

• Management of the EtherCAT slaves– Sending init commands defined in the XML file

• Mailbox Communication– CANopen over EtherCAT protocol (CoE)– Servo-Profile over EtherCAT protocol (SoE)– Ethernet over EtherCAT protocol (EoE)– Filetransfer over EtherCAT protocol (FoE)

• Software-integrated switch functionality • Cyclic process data communication

EtherCAT Communication 84

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

What does an EtherCAT Master do?

• Parse XML Hardware configuration file (initialization, state machine, and process data mapping)

• Initialization of Fieldbus• Runs State Machine• Interface to application• Interface to network driver• Sends cyclic process data commands• Sends mailbox commands• Handles various protocols

Page 43: Ether Cat 12 Mar 2010

43

EtherCAT Communication 85

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

EtherCAT Master Block Diagram

System Configuration

Tool

EtherCAT Master Driver

Control Task

Standard Ethernet MAC

HDR Process Data

XML Parser

Process Image(XML)

HW ConfigInit Cmds

XML

Device Description

XML

Network DescriptionInitialization CommandsProcess Image

Online functions

EtherCAT Master

EtherCAT Communication 86

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Prerequisites for EtherCAT Master (Real Time)

• Hardware• Standard network controller using DMA

– NO special plug in card needed– Speed and Quality important

• No switches or hubs required• Cache design, CPU • Low jitter, x86 Dual Xeon < 2 µs

• Software• Realtime kernel• Configuration tool

Page 44: Ether Cat 12 Mar 2010

44

EtherCAT Communication 87

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Standards and References

• Specification of EtherCAT has been done in the EtherCAT Technology Group (ETG)

• Specifications available at www.EtherCAT.org– XML File Style sheet– Datasheets of ESC, ...– Modular Device Profile – Reports of ETG TC meetings

• International standardization

EtherCAT Communication 88

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Standards and References

•EtherCAT is part of different international standardization efforts

Type 12: EtherCAT Specification

Replaced by IEC 61158

Remarks

Part 6: Application Layer protocol specification

Part 5: Application Layer service definition

Part 4: Data Link Layer protocol specification

Part 3: Data Link Layer service definition

Part 2: Physical Layer service definition and protocol specification

IS

PAS

StatusTitleStandard

Part 1: Overview and guidance

Digital data communication for measurement and control – Fieldbus for use in industrial control systems

IEC 61158

Real Time Ethernet control automation technology (ETHERCAT)

IEC/PAS 62407

PASPAS : Public available standard: Public available standardISIS : International Standard: International Standard

Page 45: Ether Cat 12 Mar 2010

45

EtherCAT Communication 89

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Standards and References

Mapping EtherCAT to CANopen DS402 and SERCOS

Part 7: Drive Profiles

CPF12: EtherCAT

Remarks

FDISPart 7-3: Generic interface and use of profiles for power drive systems – Mapping of profiles to network technologies

FDISPart 7-2: Generic interface and use of profiles for power drive systems – Profile specifications

FDISPart 7-1: Generic interface and use of profiles for power drive systems – Interface definition

Adjustable speed electrical power drive systems

IEC 61800

ISPart 2: Additional profiles for ISO/IEC 8802-3 based communication networks in real-time applications

ISPart 1: Profile sets for continuous and discrete manufacturing relative to fieldbus use in industrial control systems

Digital data communication for measurement and control

IEC 61784

StatusTitleStandard

CPFCPF : : CommunicationCommunication profileprofileFDISFDIS : Final : Final DraftDraft International StandardInternational Standard

EtherCAT Communication 90

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

Standards and References

Mapping EtherCAT to CANopen DS301

PRF AmdPart 4 Amd 2: Profiles for Modbus TCP, EtherCAT and ETHERNET Powerlink

CANopenEd 1Industrial automation systems and integration -- Open systems application integration framework

ISO 15745

RemarksStatusTitleStandard

PRF PRF AmdAmd: : : Proof of a new International Standard, Amendment: Proof of a new International Standard, Amendment

Page 46: Ether Cat 12 Mar 2010

46

EtherCAT Communication 91

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

IEC 61158

• Digital data communication for measurement and control –Fieldbus for use in industrial control systems

• The communication standard

• EtherCAT is named Type 12 in IEC 61158 (no brand names allowed)

• Transformation of the communication protocol to a common model

EtherCAT Communication 92

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

IEC 61158 – DL/AL services and protocols

DL ServicesPart 3 in IEC 61158

• Model and Concepts• Service description• Register Description

(DL objects)

DL ProtocolPart 4 in IEC 61158

• Coding• Medium Access• State Machines

AL ServicesPart 5 in IEC 61158

• Model and Concepts• Data type definitions• Application Objects• Service description• Communication Management

AL ProtocolPart 6 in IEC 61158

• Syntax definition and Coding• Application Relationship

Procedures• State Machines

Users Implementers

Page 47: Ether Cat 12 Mar 2010

47

EtherCAT Communication 93

EtherCAT BasicsSlave StructurePhysical LayerDevice Model (ISO/OSI)Data Link Layer

Frame StructureAddressingCommandsMemory/RegistersSyncManagerFMMUDiagnosis

Application LayerState Machine

MailboxMailbox InterfaceEoE EthernetCoE CANopenFoE File AccessSoE Servo Drive

Slave Information /IFDevice Profiles

MotivationGateway Profiles

Distributed ClocksDevice DescriptionConfiguration ToolEtherCAT MasterStandards

© Copyright by Beckhoff, 2007

IEC 61800-7

IEC 61800-7-1 Interface definition

Annex A:Mapping to

CiA402

Annex B:Mapping to

CIP

Annex C:Mapping toPROFIdrive

IEC TR 62390Device profile guideline

IEC 61800 Parts 1 to 6Adjustable speed electrical power drive systems

Annex D:Mapping toSERCOS

Abstractmodels

GenericPDSinterface

Mapping tosolutions(profiles)

Driveprofiles

Annex D:Profile

SERCOS

Annex C:Profile

PROFIdrive

Annex B:ProfileCIP

Annex A:Profile

CiA402

IEC 61800-7 Generic interface and use of profiles for power drive systems

IEC 61800-7-2 Profile specifications

Mapping toCANopen

Mapping toEtherCAT

Mapping toPROFIBUS

Mapping toPROFINET

Mapping tonetworktechnologies

Mapping toDeviceNet

Mapping toEtherNet/IP

Mapping toSERCOS

I + II

Mapping toSERCOS

III

Mapping toETHERNETPowerlink

Mapping toEtherCAT

Mapping toControlNet

IEC 61800-7-3 Mapping of profiles to network technologies

Annex A Annex B Annex C Annex D

EtherCAT is Part of the drives standard in Annex A and D

SERCOS interface™ is a trade name of Interests Group SERCOS interface e.V. Compliance to this profile does not require use of the trade name SERCOS

interface. Use of the trade name SERCOS interface requires permission of the trade name holder.