Difference between revisions of "Category:EtherCAT:ECAT GENERAL GUIDE"

From SoftMC-Wiki
Jump to: navigation, search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Languages|EtherCAT:ECAT_GENERAL_GUIDE}}
 
{{Category
 
{{Category
 
|description=EtherCAT - General Guide
 
|description=EtherCAT - General Guide
Line 11: Line 12:
 
http://en.wikipedia.org/wiki/EtherCAT
 
http://en.wikipedia.org/wiki/EtherCAT
  
softMC's current main fieldbus is EtherCAT and this guide will help you to better understand and setup the system.<br/>
+
At present, the main softMC fieldbus is EtherCAT. This article serves as a guide to help you understand and setup the system.
A part of softMC is a software entity called "EtherCAT Master". The ECat master is a part of the Linux kernel and it works in parallel to the Real-Time Motion task of the softMC.
+
 
Connecting the softMC to ECat slaves isn't enough to create motion. A few actions must be carried out in order to setup the real-time communication that allows motion.
+
softMC has a software component called '''EtherCAT Master'''. The EtherCAT master is a part of the Linux kernel, and it works in parallel to the real-time motion task of the softMC.
 +
 
 +
Connecting the softMC to EtherCAT slaves isn't enough to create motion. A few actions must be carried out in order to setup the real-time communication that allows motion.
 +
 
 
The entire EtherCAT configuration and setup process is performed by [[:Category:EtherCAT:EC SETUP|EC_SETUP.PRG]].
 
The entire EtherCAT configuration and setup process is performed by [[:Category:EtherCAT:EC SETUP|EC_SETUP.PRG]].
  
==EtherCAT slaves and EtherCAT modes==
+
==EtherCAT Slaves and EtherCAT Modes==
Communication with an ECat slave can be done via SDO or via PDO. When a slave is powered up it automatically gets into ECat mode "INIT". If the slave senses that an ECat master is connected to the [[:File:Axystems;EC_master_slave_position_topology.PNG|physical topology]] it automatically gets into ECat mode "PREOP". In this mode the ECat master can communicate with the slave, query some basic data that will later be used to setup the real-time communication, and allow the user to communicate with the slave via SDO. SDO communication isn't real-time. It is useful to gather data and configure the slave before starting the real-time communication.
+
{{Note/Important|EtherCAT modes are NOT motion operation modes (Position, Velocity, etc...)}}
 +
Communication with an EtherCAT slave can be done via SDO or via PDO. When a slave is powered up it automatically gets into EtherCAT mode "INIT". If the slave senses that an EtherCAT master is connected to the [[:File:Axystems;EC_master_slave_position_topology.PNG|physical topology]] it automatically gets into EtherCAT mode "PREOP". In this mode the EtherCAT master can communicate with the slave, query some basic data that will later be used to setup the real-time communication, and allow the user to communicate with the slave via SDO. SDO communication isn't real-time. It is useful to gather data and configure the slave before starting the real-time communication.
 
To use SDO communication please refer to:
 
To use SDO communication please refer to:
 
* [[EtherCAT:EC SDO READ|EC_SDO_READ]]
 
* [[EtherCAT:EC SDO READ|EC_SDO_READ]]
Line 25: Line 30:
 
* [[EtherCAT:EC SDO READ STRING|EC_SDO_READ_STRING]]
 
* [[EtherCAT:EC SDO READ STRING|EC_SDO_READ_STRING]]
 
<br/>
 
<br/>
From the ControlStudio's terminal the user can learn about the state of the ECat master and what slaves are found by the ECat master on the [[:File:Axystems;EC_master_slave_position_topology.PNG|physical topology]]:
+
From the ControlStudio terminal the user can learn about the state of the EtherCAT master and what slaves are found by the EtherCAT master on the [[:File:Axystems;EC_master_slave_position_topology.PNG|physical topology]]:
 
* [[EtherCAT:EC_MASTER|EC_MASTER]]
 
* [[EtherCAT:EC_MASTER|EC_MASTER]]
 
* [[EtherCAT:EC_SLAVES|EC_SLAVES]]
 
* [[EtherCAT:EC_SLAVES|EC_SLAVES]]
Line 31: Line 36:
 
* [[EtherCAT:EC MASTER OPMODE|EC_MASTER_OPMODE]]
 
* [[EtherCAT:EC MASTER OPMODE|EC_MASTER_OPMODE]]
  
Usually an ECat slave has many SDO objects that can be read or written.
+
Usually an EtherCAT slave has many SDO objects that can be read or written.
  
When the real-time communication is initiated the ECat master asks the slaves to rise to Ethercat mode "SAFEOP". In this mode the clocks of the slaves
+
When the real-time communication is initiated the EtherCAT master asks the slaves to rise to Ethercat mode "SAFEOP". In this mode the clocks of the slaves
and the master are synchronized. This process may take up to a 30 seconds and it depends on the number of slaves in the topology. Once the clocks are synchronized the ECat master asks the slaves to change mode to "OP" and real-time communication is established.<br/>
+
and the master are synchronized. This process may take up to a 30 seconds and it depends on the number of slaves in the topology. Once the clocks are synchronized the EtherCAT master asks the slaves to change mode to "OP" and real-time communication is established.<br/>
 
We call this process <u>"Start Master"</u>.
 
We call this process <u>"Start Master"</u>.
  
 
==Real-Time Communication and PDOs==
 
==Real-Time Communication and PDOs==
Once the ECat master is started, the clocks are in sync and all the slaves are in "OP" mode, data is flowing back and forth between the ECat master and the slaves. A round trip is completed within a deterministic cycle time that is chosen by the user. At the moment softMC supports cycle times of:
+
Once the EtherCAT master is started, the clocks are in sync and all the slaves are in "OP" mode, data is flowing back and forth between the EtherCAT master and the slaves. A round trip is completed within a deterministic cycle time that is chosen by the user. At present, softMC supports cycle times of:
 
4000us, 2000us, 1000us, 500us, 250us.
 
4000us, 2000us, 1000us, 500us, 250us.
Please refer to:
+
Refer to:
 
* [[EtherCAT:EC_SET_BUS_CYCLETIME|EC_SET_BUS_CYCLETIME]]
 
* [[EtherCAT:EC_SET_BUS_CYCLETIME|EC_SET_BUS_CYCLETIME]]
 
* [[EtherCAT:EC_GET_BUS_CYCLETIME|EC_GET_BUS_CYCLETIME]]
 
* [[EtherCAT:EC_GET_BUS_CYCLETIME|EC_GET_BUS_CYCLETIME]]
  
A limited amount of data can be exchanged each cycle between the ECat master and slaves. This data is mapped to "PDOs".
+
A limited amount of data can be exchanged each cycle between the EtherCAT master and slaves. This data is mapped to "PDOs".
 
Each slave has a fixed and limited list of objects that are mapped to PDOs. Some PDOs are transmitted from the slave to the master (Tx PDOs) and some are read from the master by the slave (Rx PDOs).  
 
Each slave has a fixed and limited list of objects that are mapped to PDOs. Some PDOs are transmitted from the slave to the master (Tx PDOs) and some are read from the master by the slave (Rx PDOs).  
  
Line 57: Line 62:
 
</pre>
 
</pre>
  
[[Image:ecat_gen1.PNG|Example of PDOs list of 1 STX CDHD drive attached to softMC|ethercat pdos]]
+
[[File:ecat_gen1.PNG|left|alt=ethercat pdos||Example of PDOs list of 1 STX CDHD drive attached to softMC]]
  
 
==Creating Motion==
 
==Creating Motion==
Most ECat slaves are motion drives. In order to create real-time communication that allows motion only a few objects are required. CANopen DS 402 standard defines their addresses:<br/>
+
Most EtherCAT slaves are motion drives. In order to create real-time communication that allows motion only a few objects are required. CANopen DS 402 standard defines their addresses:<br/>
  
From ECat master to slave:<br/>
+
From EtherCAT master to slave:<br/>
 
Control word - 0x6040:0x0<br/>
 
Control word - 0x6040:0x0<br/>
 
Position command - 0x607a:0x0<br/>
 
Position command - 0x607a:0x0<br/>
  
From slave to ECat master:<br/>
+
From slave to EtherCAT master:<br/>
 
Status word - 0x6041:0x0<br/>
 
Status word - 0x6041:0x0<br/>
 
Position feedback - 0x6064:0x0<br/>
 
Position feedback - 0x6064:0x0<br/>
  
The ECat slave must have these four objects mapped to PDOs in order to allow motion.<br/>
+
The EtherCAT slave must have these four objects mapped to PDOs in order to allow motion.<br/>
These PDOs are Motion Critical therefore they are handled by the softMC's motion task. The user doesn't read or write them explicitly, however, other PDOs that aren't Motion Critical can be read/written by the user, for example, reading Digital Inputs (0x60FD:0x0) or writing Digital Outputs (0x60FE:0x1).
+
These PDOs are Motion Critical therefore they are handled by the softMC's motion task. The user doesn't read or write them explicitly, however, other PDOs that aren't Motion Critical can be read/written by the user, for example, reading Digital Inputs via PDO 0x60FD:0x0 or writing Digital Outputs via PDO 0x60FE:0x1. Refer to [[EtherCAT:DIGITAL-IOS|DIGITAL-IOS]] for more information about digital I/Os.
  
==EtherCAT configuration and initiation with softMC==
+
==EtherCAT Configuration and Initiation with softMC==
 
===Global Libraries===
 
===Global Libraries===
A few libraries must be globally loaded in softMC in order to work with the ECat master.<br/>
+
A few libraries must be globally loaded in softMC in order to work with the EtherCAT master.<br/>
The first and most vast is ETHERCAT.LIB. This library holds all the interfaces to the firmware, including ECat master commands, configuration and monitoring.
+
The first and most vast is ETHERCAT.LIB. This library holds all the interfaces to the firmware, including EtherCAT master commands, configuration and monitoring.
Next libraries are more device specific. EC_CDHD.LIB is a library that holds specific data about the STX CDHD drive, and it allows high resolution configuration and handling of the device. There are a few more device specific libraries and over time this list will expand.
+
Next libraries are more device specific. EC_CDHD.LIB is a library that holds specific data about the CDHD drive, and it allows high resolution configuration and handling of the device. There are a few more device specific libraries and over time this list will expand.
  
==="One Ring To Rule Them All" - The script EC_SETUP.PRG===
+
===EC_SETUP.PRG Script ("One Ring To Rule Them All")===
This script allows automatic configuration and initiation of the ECat slaves and ECat master.<br/>
+
This script allows automatic configuration and initiation of the EtherCAT slaves and EtherCAT  master.<br/>
It iterates over the slaves identifying each slave and configuring it according to the specific data that is found in the slave's corresponding library. The ECat master must know exactly about each slave and its PDOs in order to manage the real-time communication. The script extracts data from each slave about its mapped PDOs. A data base about the entire ethercat topology is built and sent to the ECat master and the master is "started".
+
It iterates over the slaves identifying each slave and configuring it according to the specific data that is found in the slave's corresponding library. The EtherCAT master must know exactly about each slave and its PDOs in order to manage the real-time communication. The script extracts data from each slave about its mapped PDOs. A data base about the entire ethercat topology is built and sent to the EtherCAT master and the master is "started".
  
Once there's PDO communication between the ECat master and slaves, we can start creating motion.
+
Once PDO communication between the EtherCAT master and slaves is established, you can start creating motion.
  
 
To use PDO communication please refer to:
 
To use PDO communication please refer to:
Line 91: Line 96:
  
 
==Getting Started==
 
==Getting Started==
The EtherCAT software is loaded and launched automatically by EC_START.PRG that is launched by AUTOEXEC.PRG.<br/>
+
The EtherCAT software libraries are globally loaded by CONFIG.PRG and the setup sequence is launched automatically by AUTOEXEC.PRG.<br/>
EC_START.PRG globally loads all the EtherCAT libraries and launches EC_SETUP.PRG. Once EC_SETUP.PRG is terminated EC_START.PRG is also terminated and AUTOEXEC.PRG launches AX_SETUP.PRG to setup all the axes parameters (Not related to EtherCAT). <br/>
+
AUTOEXEC.PRG loads and starts EC_SETUP.PRG and waits for its termination. Once EC_SETUP.PRG is terminated AUTOEXEC.PRG launches AX_SETUP.PRG to setup all the axes parameters (Not related to EtherCAT). <br/>
So, to conclude, you need the following files to start up EtherCAT:<br/>
+
Thus, you need the following files to start up EtherCAT:<br/>
 
<br/>
 
<br/>
 
CONFIG.PRG<br/>
 
CONFIG.PRG<br/>
 
AUTOEXEC.PRG<br/>
 
AUTOEXEC.PRG<br/>
EC_START.PRG<br/>
 
 
EC_SETUP.PRG<br/>
 
EC_SETUP.PRG<br/>
 
AX_SETUP.PRG<br/>
 
AX_SETUP.PRG<br/>
Line 103: Line 107:
 
ETHERCAT.LIB<br/>
 
ETHERCAT.LIB<br/>
 
EC_CDHD.LIB<br/>
 
EC_CDHD.LIB<br/>
EC_IOMOD.LIB<br/>
+
ECX_DIO8.LIB<br/>
 
EC_AI8ME.LIB<br/>
 
EC_AI8ME.LIB<br/>
 
CPX_FB38.LIB<br/>
 
CPX_FB38.LIB<br/>
Line 109: Line 113:
 
EC_USER.LIB<br/>
 
EC_USER.LIB<br/>
  
 +
Send all the above files to softMC<br/>
 +
To start the sequence, go to the ControlStudio terminal, and enter:
 +
<pre>reset all
 +
load AUTOEXEC.PRG</pre>
  
 
==Downloads==
 
==Downloads==
Line 118: Line 126:
 
ETHERCAT.LIB<br/>
 
ETHERCAT.LIB<br/>
 
EC_CDHD.LIB<br/>
 
EC_CDHD.LIB<br/>
EC_IOMOD.LIB<br/>
+
ECX_DIO8.LIB<br/>
 
EC_AI8ME.LIB<br/>
 
EC_AI8ME.LIB<br/>
 
CPX_FB38.LIB<br/>
 
CPX_FB38.LIB<br/>
Line 131: Line 139:
 
CONFIG.PRG<br/>
 
CONFIG.PRG<br/>
 
AUTOEXEC.PRG<br/>
 
AUTOEXEC.PRG<br/>
EC_START.PRG<br/>
 
 
EC_SETUP.PRG<br/>
 
EC_SETUP.PRG<br/>
 
AX_SETUP.PRG<br/>
 
AX_SETUP.PRG<br/>
Line 138: Line 145:
  
 
==See Also==
 
==See Also==
* [[:Category:EtherCAT:EC SETUP|Setup EtherCAT]] - How to setup EtherCAT
+
* [[:Category:EtherCAT:EC SETUP|Setup EtherCAT]] - How to Setup EtherCAT
 
+
* [[EtherCAT:DIGITAL-IOS|DIGITAL-IOS]]
  
  

Latest revision as of 09:19, 3 May 2017

Language: English

Category:EtherCAT:ECAT GENERAL GUIDE EtherCAT - General Guide

The front page is EtherCAT

Introduction

From Wikipedia:
"EtherCAT - Ethernet for Control Automation Technology - is an Ethernet-based fieldbus system, invented by Beckhoff Automation. The protocol is standardized in IEC 61158 and is suitable for both hard and soft real-time requirements in automation technology.

The goal during development of EtherCAT was to apply Ethernet for automation applications requiring short data update times (also called cycle times; ≤ 100 µs) with low communication jitter (for precise synchronization purposes; ≤ 1 µs) and reduced hardware costs."

http://en.wikipedia.org/wiki/EtherCAT

At present, the main softMC fieldbus is EtherCAT. This article serves as a guide to help you understand and setup the system.

softMC has a software component called EtherCAT Master. The EtherCAT master is a part of the Linux kernel, and it works in parallel to the real-time motion task of the softMC.

Connecting the softMC to EtherCAT slaves isn't enough to create motion. A few actions must be carried out in order to setup the real-time communication that allows motion.

The entire EtherCAT configuration and setup process is performed by EC_SETUP.PRG.

EtherCAT Slaves and EtherCAT Modes

IMPORTANT.svgIMPORTANT
EtherCAT modes are NOT motion operation modes (Position, Velocity, etc...)

Communication with an EtherCAT slave can be done via SDO or via PDO. When a slave is powered up it automatically gets into EtherCAT mode "INIT". If the slave senses that an EtherCAT master is connected to the physical topology it automatically gets into EtherCAT mode "PREOP". In this mode the EtherCAT master can communicate with the slave, query some basic data that will later be used to setup the real-time communication, and allow the user to communicate with the slave via SDO. SDO communication isn't real-time. It is useful to gather data and configure the slave before starting the real-time communication. To use SDO communication please refer to:


From the ControlStudio terminal the user can learn about the state of the EtherCAT master and what slaves are found by the EtherCAT master on the physical topology:

Usually an EtherCAT slave has many SDO objects that can be read or written.

When the real-time communication is initiated the EtherCAT master asks the slaves to rise to Ethercat mode "SAFEOP". In this mode the clocks of the slaves and the master are synchronized. This process may take up to a 30 seconds and it depends on the number of slaves in the topology. Once the clocks are synchronized the EtherCAT master asks the slaves to change mode to "OP" and real-time communication is established.
We call this process "Start Master".

Real-Time Communication and PDOs

Once the EtherCAT master is started, the clocks are in sync and all the slaves are in "OP" mode, data is flowing back and forth between the EtherCAT master and the slaves. A round trip is completed within a deterministic cycle time that is chosen by the user. At present, softMC supports cycle times of: 4000us, 2000us, 1000us, 500us, 250us. Refer to:

A limited amount of data can be exchanged each cycle between the EtherCAT master and slaves. This data is mapped to "PDOs". Each slave has a fixed and limited list of objects that are mapped to PDOs. Some PDOs are transmitted from the slave to the master (Tx PDOs) and some are read from the master by the slave (Rx PDOs).

From the Linux terminal it is possible to list the available PDOs in each slave. Do the following:

1. Connect to the softMC using ssh or serial console.
2. In the Linux terminal type:

-bash-3.2$ ethercat pdos
....
....
ethercat pdos

Creating Motion

Most EtherCAT slaves are motion drives. In order to create real-time communication that allows motion only a few objects are required. CANopen DS 402 standard defines their addresses:

From EtherCAT master to slave:
Control word - 0x6040:0x0
Position command - 0x607a:0x0

From slave to EtherCAT master:
Status word - 0x6041:0x0
Position feedback - 0x6064:0x0

The EtherCAT slave must have these four objects mapped to PDOs in order to allow motion.
These PDOs are Motion Critical therefore they are handled by the softMC's motion task. The user doesn't read or write them explicitly, however, other PDOs that aren't Motion Critical can be read/written by the user, for example, reading Digital Inputs via PDO 0x60FD:0x0 or writing Digital Outputs via PDO 0x60FE:0x1. Refer to DIGITAL-IOS for more information about digital I/Os.

EtherCAT Configuration and Initiation with softMC

Global Libraries

A few libraries must be globally loaded in softMC in order to work with the EtherCAT master.
The first and most vast is ETHERCAT.LIB. This library holds all the interfaces to the firmware, including EtherCAT master commands, configuration and monitoring. Next libraries are more device specific. EC_CDHD.LIB is a library that holds specific data about the CDHD drive, and it allows high resolution configuration and handling of the device. There are a few more device specific libraries and over time this list will expand.

EC_SETUP.PRG Script ("One Ring To Rule Them All")

This script allows automatic configuration and initiation of the EtherCAT slaves and EtherCAT master.
It iterates over the slaves identifying each slave and configuring it according to the specific data that is found in the slave's corresponding library. The EtherCAT master must know exactly about each slave and its PDOs in order to manage the real-time communication. The script extracts data from each slave about its mapped PDOs. A data base about the entire ethercat topology is built and sent to the EtherCAT master and the master is "started".

Once PDO communication between the EtherCAT master and slaves is established, you can start creating motion.

To use PDO communication please refer to:

Getting Started

The EtherCAT software libraries are globally loaded by CONFIG.PRG and the setup sequence is launched automatically by AUTOEXEC.PRG.
AUTOEXEC.PRG loads and starts EC_SETUP.PRG and waits for its termination. Once EC_SETUP.PRG is terminated AUTOEXEC.PRG launches AX_SETUP.PRG to setup all the axes parameters (Not related to EtherCAT).
Thus, you need the following files to start up EtherCAT:

CONFIG.PRG
AUTOEXEC.PRG
EC_SETUP.PRG
AX_SETUP.PRG

ETHERCAT.LIB
EC_CDHD.LIB
ECX_DIO8.LIB
EC_AI8ME.LIB
CPX_FB38.LIB
EC_HCNC.LIB
EC_USER.LIB

Send all the above files to softMC
To start the sequence, go to the ControlStudio terminal, and enter:

reset all
load AUTOEXEC.PRG

Downloads

All downloads correspond to softMC's formal release version ECAT 0.4.13.2rc2

EtherCAT libraries -
Contents:
ETHERCAT.LIB
EC_CDHD.LIB
ECX_DIO8.LIB
EC_AI8ME.LIB
CPX_FB38.LIB
EC_HCNC.LIB
EC_USER.LIB

File:ecat libs.zip

EtherCAT programs -
Contents:
CONFIG.PRG
AUTOEXEC.PRG
EC_SETUP.PRG
AX_SETUP.PRG

File:ecat prgs.zip

See Also


This category currently contains no pages or media.