Difference between revisions of "EtherCAT Master"

From ERIKA WIKI
Jump to: navigation, search
(Motion control of CiA 402 compliant devices)
(Motion control of CiA 402 compliant devices)
Line 200: Line 200:
  
 
<table class="wikitable"><tr><th class="confluenceTh">State</th><th class="confluenceTh">Statusword Bits</th><th class="confluenceTh">Functional Meaning</th></tr><tr><td class="confluenceTd">Not ready to switch on</td><td class="confluenceTd">xxxx xxxx x0xx 0000</td><td class="confluenceTd">No CiA mode of operation selected</td></tr><tr><td class="confluenceTd">Switch on disabled<sup>(1)</sup></td><td class="confluenceTd">xxxx xxxx x100 0000</td><td class="confluenceTd">No motor torque - drive disabled</td></tr><tr><td class="confluenceTd">Ready to switch on</td><td class="confluenceTd">xxxx xxxx x01x 0001</td><td class="confluenceTd">No motor torque - drive disabled</td></tr><tr><td class="confluenceTd">Switched on</td><td class="confluenceTd">xxxx xxxx x01x 0011</td><td class="confluenceTd">No motor toque - drive disabled</td></tr><tr><td class="confluenceTd">Operation Enabled</td><td class="confluenceTd">xxxx xxxx x01x 0111</td><td class="confluenceTd">Motor has torque - drive enabled</td></tr><tr><td colspan="1" class="confluenceTd">Fault reaction active<sup>(1)</sup></td><td colspan="1" class="confluenceTd">xxxx xxxx x0xx 1111</td><td colspan="1" class="confluenceTd">Motor is losing torque - drive disabling</td></tr><tr><td colspan="1" class="confluenceTd">Fault</td><td colspan="1" class="confluenceTd">xxxx xxxx x0xx 1000</td><td colspan="1" class="confluenceTd">No motor torque - drive disabled</td></tr><tr><td colspan="1" class="confluenceTd">Quick stop active<sup>(2)</sup></td><td colspan="1" class="confluenceTd">xxxx xxxx x00x 0111</td><td colspan="1" class="confluenceTd">Not implemented</td></tr></table>
 
<table class="wikitable"><tr><th class="confluenceTh">State</th><th class="confluenceTh">Statusword Bits</th><th class="confluenceTh">Functional Meaning</th></tr><tr><td class="confluenceTd">Not ready to switch on</td><td class="confluenceTd">xxxx xxxx x0xx 0000</td><td class="confluenceTd">No CiA mode of operation selected</td></tr><tr><td class="confluenceTd">Switch on disabled<sup>(1)</sup></td><td class="confluenceTd">xxxx xxxx x100 0000</td><td class="confluenceTd">No motor torque - drive disabled</td></tr><tr><td class="confluenceTd">Ready to switch on</td><td class="confluenceTd">xxxx xxxx x01x 0001</td><td class="confluenceTd">No motor torque - drive disabled</td></tr><tr><td class="confluenceTd">Switched on</td><td class="confluenceTd">xxxx xxxx x01x 0011</td><td class="confluenceTd">No motor toque - drive disabled</td></tr><tr><td class="confluenceTd">Operation Enabled</td><td class="confluenceTd">xxxx xxxx x01x 0111</td><td class="confluenceTd">Motor has torque - drive enabled</td></tr><tr><td colspan="1" class="confluenceTd">Fault reaction active<sup>(1)</sup></td><td colspan="1" class="confluenceTd">xxxx xxxx x0xx 1111</td><td colspan="1" class="confluenceTd">Motor is losing torque - drive disabling</td></tr><tr><td colspan="1" class="confluenceTd">Fault</td><td colspan="1" class="confluenceTd">xxxx xxxx x0xx 1000</td><td colspan="1" class="confluenceTd">No motor torque - drive disabled</td></tr><tr><td colspan="1" class="confluenceTd">Quick stop active<sup>(2)</sup></td><td colspan="1" class="confluenceTd">xxxx xxxx x00x 0111</td><td colspan="1" class="confluenceTd">Not implemented</td></tr></table>
 +
 +
<sup>(1)</sup> these states are automatically transitioned through
 +
 +
<sup>(2)</sup> quick stop active is not currently implemented
 +
 +
== Controlling a CiA 402 drive with Erika + SOEM ==
  
 
== Demo: controlling the ELMO Gold Duet 40 ==
 
== Demo: controlling the ELMO Gold Duet 40 ==

Revision as of 15:15, 24 April 2019

Introduction

In the context of the I-MECH project, funded by the European Commission under the ECSEL programme, we have ported the SOEM EtherCAT library on ERIKA.
Such experimental support will be soon released in the next stable version of the RTOS. This page explains how to setup and run the provided demo.

Requirements

For running the demo, an x86-64 platform with the following characteristics is needed:

  • Supporting hardware-assisted virtualization (i.e. VT-x, VT-D, EPT) and capable of running the Xen hypervisor in HVM mode.
  • With an Intel i210 network interface.

Demo

The provided demo assumes the Intel i210 network interface to be connected to a Beckhoff EL2004 EtherCAT slave. The demo has been tested on Advantech ARK-3520P-U7A1E.

To run the provided EtherCAT master demo, follow the next steps:

  1. Download the EtherCAT SOEM library for ERIKA3
  2. Download the bare-metal x86 toolchain available at this link http://erika-enterprise.com/download/erika3_x86_64_xtools.tar.gz and extract the downloaded archive on a local directory
  3. (optional) Put the directory containing the toolchain binaries in the PATH environment variable before running RT-Druid.
  4. Run the RT-Druid tool
  5. Create a new project by clicking on NewRT-Druid v3 Oil and C/C++ Project as shown in the next Figure:
    Figure 1: Create a new RT-Druid project.
  6. Name the new project (e.g., mytest) and select the Cross-GCC as shown in the next Figure:
    Figure 2: Naming the new RT-Druid project.
  7. Check the box for using an existing template and select x86-64XenEtherCAT SOEM demoas shown in the next Figure:
    Figure 3: Selecting the EtherCAT template.
  8. Right click the project and select Properties as shown in the following Figure:
    Figure 4: Eclipse project properties.
  9. Click OilGenerator properties, enable project specific settings and specify the directory containing the SOEM library for ERIKA3:
    Figure 5: Setting the path of the SOEM library.
  10. If you didn't put the toolchain in the PATHdirectory, also set the GNU Compiler prefix property to /full/path/x-tools/x86_64-unknown-elf/bin/x86_64-unknown-elf-.
  11. Edit the main.c file and set the SLAVE_NB variable for the Bechkhoff EL2004 slave (note that the SOEM library numbers slaves starting from 1).
  12. Follow the instructions at this page for building and running the Xen iso image.

Motion control of CiA 402 compliant devices

CiA® 402 refers to CAN in Automation (CiA) CANopen® Drives and Motion Control Profile 402, which standardizes the functional behavior of controllers for servo drives, frequency inverters, and stepper motors.

The profile describes the Finite State Automation (FSA) of the device, where each state specifies the internal/external behavior and the accepted commands:

Figure 6:FSA of CiA402.

The generic CanOpen specification for the automation provides an Object Dictionary, a grouping of objects accessible via the network in an ordered pre-defined fashion. Each object within the dictionary is addressed using a 16-bit index.

The CiA 402 extends the basic dictionary with specific objects and among these we can find Controlword and Statusword.

The Controlword is used to set the required states in the state machine. Object ID is 0x6040 and bits are defined as follows:

Bit Name Abbreviation
0 Switch On SO
1 Enable Voltage EV
2 Quick Stop QS
3 Enable Operation EO
4-6 Operation mode specific OMS
7 Fault Reset <F/td>
8 Halt H
9 Operation Mode Specific OMS
10 Reserved R
11-15 Manufacturer specific MS

The following bits are required when transitioning between states:

TransitionValue (h)

BITS

0
(SO)
1
(EV)
2
(QS)
3
(EO)
4-6
(OMS)
7
(F)
8-15
15Fault → Ready to switch on0x860110xxx1xxxxxxxx

8/9/0

Non fault → Ready to switch on

0x06

0

1

1

0

xxx

0

xxxxxxxx

3/5→ Switched on(1)0x071110xxx0xxxxxxxx
4/4a→ Operation enabled

0x0F/0x1F

1111xxx0xxxxxxxx

(1) The switched on state is often bypassed by the master

The Statusword provides information that is sent from the drive device back to the controller about the operational status. Object ID is 0x6041 and defined bits are:

Bit Name Abbreviation
0 Ready to Switch On RTSO
1 Switched On SO
2 Operation Enable OE
3 Fault F
4 Voltage Enabled VE
5 Quick Stop QS
6 Switch On Disabled SOD
7 Warning W
8 Manufacturer Specific MA
9 Remote RM
10 Target Reached TR
11 Internal Limit Active ILA
12-13 Operation Mode Specific OMS
14-15 Manifacturer Specific MS

The following table outlines the Statusword bits and the represented state:

StateStatusword BitsFunctional Meaning
Not ready to switch onxxxx xxxx x0xx 0000No CiA mode of operation selected
Switch on disabled(1)xxxx xxxx x100 0000No motor torque - drive disabled
Ready to switch onxxxx xxxx x01x 0001No motor torque - drive disabled
Switched onxxxx xxxx x01x 0011No motor toque - drive disabled
Operation Enabledxxxx xxxx x01x 0111Motor has torque - drive enabled
Fault reaction active(1)xxxx xxxx x0xx 1111Motor is losing torque - drive disabling
Faultxxxx xxxx x0xx 1000No motor torque - drive disabled
Quick stop active(2)xxxx xxxx x00x 0111Not implemented

(1) these states are automatically transitioned through

(2) quick stop active is not currently implemented

Controlling a CiA 402 drive with Erika + SOEM

Demo: controlling the ELMO Gold Duet 40