001 - EtherCAT evaluation

Changelog

Version

Remark

Version

Remark

1.0

Initial Release

1.1

Update to version 1.2.018 of the sample code

1.2

Update to version 1.2.0.35 of the sample code

1.3

Extended documentation of example functions

1.4

Added EtherCAT® trademark

Table: Changelog

Introduction

Scope

This document describes the process of running EtherCAT® using the ccm module.
It describes the initial setup of the device and the usage of the example application.

EtherCAT® is a registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.

Document structure

Chapter

Content

Chapter

Content

Introduction

Introduction of this document

EtherCAT® Evaluation

Basic information for evaluation

Logging

How to get log messages

Initial Setup

How to initially setup the EtherCAT device

Firmware Update

How to do a firmware update of the communication module

Example features

Description of features of the example application

Table: Content of this document

EtherCAT® evaluation hardware

A working setup with an Application Controller (AC) - e.g. Synergy S7G2SK - and Communication Controller (CC) - iRJ45 or SoM - is required.

It is required to run the EtherCAT® example on the target device.

 

The additional board shown in the figure below provides an ID switch for Explicit Device Identification. The switch can be set to a value between 0 and 15.

The binary coded value can be seen on the LEDs on the board.

 

Following table shows the description of the available ports:

Port

Function

Port

Function

X1

EtherCAT IN

X2

EtherCAT OUT

Table: Ports of evaluation system

Logging (S7G2SK)

To get feedback from the application, all log messages from AC and CC are transmitted to the UART of the AC. This is an option used for the EtherCAT® example s09_ecat_slave. It is achieved using an RPC function call at application setup time:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 /****************************************************************************/ /** Application Setup * * Setup the application. */ GOAL_STATUS_T appl_setup( void ) { GOAL_STATUS_T res; /* result */ char strVersion[APPL_VERSION_LEN]; /* version string */ uint16_t devType = 0; /* device type */ GOAL_ETH_MAC_ADDR_T mac; /* mac address */ uint8_t fwSignature[16]; /* firmware signature */ uint32_t valObj = 0; /* object dictionary value */ /* enable logging from AC to CC */ res = appl_ccmLogToAcEnable(); if (GOAL_RES_ERR(res)) { goal_logErr("failed to enable logging from CC to AC"); } ... }

For the Synergy S7G2SK an USB to Serial Adapter is required, e.g. the FTDI. To use the UART on the Synergy S7G2SK, please also check the user manual on the Renesas website.

Please set jumper J9 to 3-5 and 4-6 (RS485 mode). Then the UART TX line from the Synergy CPU will be connected to Pin 4 of J10. This is where the RX line from the USB-Serial converter needs to be connected. The UART is configured with baudrate 115200 and settings 8N1.

If everything is connected correctly, the following serial log will be shown:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... [AC_I|appl_httpSetup:93] setup web server [AC_I|goal_httpNewAc:951] HTTP Application Core successfully started [CC_I|goal_httpNewCc:861] HTTP Communication Core successfully started [CC_I|goal_httpResRegCc:767] called [CC_I|goal_httpResRegCc:767] called [CC_I|goal_httpResRegCc:767] called [CC_I|goal_httpResRegCc:767] called [CC_I|goal_httpResRegCc:767] called [AC_I|appl_httpSetup:138] web server setup done [CC_I|goal_httpResRegCc:767] called [AC_I|appl_setup:430] CCM version : 1.2.0.35 [AC_I|appl_setup:431] CCM device : 1 [AC_I|appl_setup:433] CCM Serial : 2e:09:0a:03:df:f5 [AC_I|appl_setup:452] CCM fw signature: cb:02:ff:62:31:3b:85:da:24:cd:63:11:ec:12:44:32 [AC_I|appl_setup:477] cfg variable (dd:customer id) changed to 12345678. [AC_I|appl_setup:491] cfg variable (dd:customer id) changed to 0. [AC_I|goal_miMctcRpcSyncLoop:1094] local setup done [AC_I|goal_memInitDone:152] fixed memory usage: 74860/262144 bytes bytes [AC_I|goal_memInitDone:157] fixed memory usage: (29%) [CC_I|goal_memInitDone:152] fixed memory usage: 152518/259072 bytes bytes [CC_I|goal_memInitDone:157] fixed memory usage: (59%)

Initial setup of the EtherCAT® device

Preparations

For the Renesas RIN32M3 module the following EtherCAT® example is prepared in the software delivery: projects/2015013_irj45/ac/09_ecat_slave

The associated device description for configuration tools is located here: appl/2015013_irj45/ac/09_ecat_slave/esi/09_evat_slave_renesas.xml

Setup from the application controller

Initially the EEPROM of the EtherCAT® device, which stores the SII information for configuration and identification, is empty. For an EtherCAT® slave to correctly operate its identification must be configured, which is stored in the EEPROM connected to the EtherCAT® controller. Programming of this memory is
possible in different ways. For convenience it is possible to configure these information initially using the application controller.

It is not recommended to overwrite those information with each start of the application controller. The data also contains addressing information which can be written by the EtherCAT® master. By overwriting this data, addressing of the EtherCAT® slave may fail in certain scenarios.

To trigger writing of the SII data by the application controller following sequence needs to be proceeded:

Edit the file appl/2015013_irj45/ac/09_ecat_slave/goal_appl.c

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 /****************************************************************************/ /* Local defines */ /****************************************************************************/ #define APPL_VERSION_LEN 32 #define APPL_ECAT_PDO_BUF_SIZE 12 /**< PDO buffer size */ /**< timeout trigger in ms */ #define APPL_TIMEOUT_TRIGGER_VAL (25 * GOAL_TIMER_MSEC) /* Note: By setting this define, the SII eeprom will be overwritten. This should only be done initially since the PLC can store additional information in this area, e.g. the configured station alias. */ /**< set to force overwriting of slaves sii eeprom */ #define APPL_ECAT_SII_INIT 0

Change define APPL_ECAT_SII_INIT

1 2 /**< set to force overwriting of slaves sii eeprom */ #define APPL_ECAT_SII_INIT 1

Compile and run the application

The log should now contain the following lines:

1 2 3 4 5 6 7 8 [AC_I|goal_init:185] GOAL initialized [AC_I|appl_setup:245] initializing EtherCAT SSI data [AC_I|replaceString:997] replace string at position 234 [AC_I|replaceString:997] replace string at position 249 [AC_I|replaceString:997] replace string at position 214 ... [CC_I|appl_ccmEcatSsiUpdateServer:917] called

Reset the define APPL_ECAT_SII_INIT

1 2 /**< set to force overwriting of slaves sii eeprom */ #define APPL_ECAT_SII_INIT 1

Compile and run the application

The device is now ready for operation.

Setup from a Configuration Tool

Initial setup of an EtherCAT® device is also possible over EtherCAT®. This process is shown using CODESYS, see figure below. At first a project with an EtherCAT® master is required. The ESI file 09_ecat_slave_renesas.xml needs to be installed to the device repository of the Configuration Tool.

 

EtherCAT® masters can determine information about slaves from multiple sources. Initial detection is done using the information in the SII. This is data stored in the device (usually an EEPROM). This data is accessible over EtherCAT®.

 

To configure the device initially, at first it must be added to the EtherCAT® master manually. This procedure is shown here in figure.

 

Now writing of the ESI information within the devices EEPROM is possible using “Write E2PROM XML”. After a Power Cycle, the device should work properly in EtherCAT® slave mode.

Setup from Industrial Communication Explorer

Beside the use of CODESYS it is also possible to use the Industrial Communication Explorer (ICE) to flash the EEPROM content.

The scanning for EtherCAT® Nodes is described here. Refer to this page to flash the EEPROM.

Please note, that the ICE shows the modulename (configured at the CM variables) in the “Network Navigator”. This name is independant from the “Manufacturer Device Name” configured in the EEPROM and application.

Firmware Update

This chapter describes the process of updating the firmware over EtherCAT®.

Firmware Update Procedure

If the communication module is in EtherCAT® mode, the HTTP Update method will not work. Thus an update over FoE is possible.

Firmware update is possible using the Industrial Communication Explorer, which will use the firmware package *.pfw for updating a device running in EtherCAT® mode using FoE. Manual update is also possible.

At first the *.pfw file needs to be extracted (it's a zip archive). The containing file irj45_port.bin is required for firmware update.

The example application 09_ecat_slave sets the following properties for FoE firmware update of the communication module:

Firmware Update property

Value

Firmware Update property

Value

Update requires BOOT state

YES

Filename

ccm.efw

Password

0

Table: FoE update properties

To update the firmware, force the slave to enter BOOT state using the EtherCAT® master. Then initiate a FoE download using the file irj45_2port.dat and the given properties for firmware update from the table.

When the transfer is done, enter INIT state. This will trigger the verification and update process of the firmware. After some time (> 60 seconds) the device will be returning to normal operation.

Please take also a look at the Firmware Update Appliction Note for further informations.

Example features

This chapter describes the example application features. For the example a set of available PDOs and mappable objects are provided. This is just for demonstration purposes. A customer specific application can create additional PDOs, mapping entries, mappable and non mappable objects. The required API is
documented in the EtherCAT® stack documentation.

The example slave supports PDO assignment and PDO mapping, thus the provided default configuration can be changed during integration into an EtherCAT® network within the available range.

Mappable Objects

This table shows all mappable objects of the example project.

Index

SubIndex

Name

DataType

Description

Index

SubIndex

Name

DataType

Description

0x200C

0x00

application object

UINT32

example object

0x200D

0x00

application object

UINT32

example object

0x200E

0x00

application object

UINT32

example object

0x200F

0x00

application object

UINT32

example object

0x6200

0x01

Write State 8 Output Lines (SI1)

UINT8

digital output data

0x6200

0x02

Write State 8 Output Lines (SI2)

UINT8

digital output data

0x6411

0x01

Write Analog Output 16 Bit (SI1)

UINT16

analog output data

0x6411

0x02

Write Analog Output 16 Bit (SI2)

UINT16

analog output data

0x6000

0x01

Read State 8 Input Lines (SI1)

UINT8

digital input data

0x6000

0x02

Read State 8 Input Lines (SI2)

UINT8

digital input data

0x6401

0x01

Read Analog Input 16 Bit (SI1)

UINT16

analog input data

0x6401

0x02

Read Analog Input 16 Bit (SI2)

UINT16

analog input data

Table: Example mappable objects

Default PDO mapping

By default all PDOS are active (objects 0x1C12, 0x1C13):

  • TxPDOs: 0x1A00, 0x1A01

  • RxPDOs: 0x1600, 0x1601

By default the following objects are mapped:

  • RxPDO 0x1A00:

    • Object 0x6000:0x01 (digital Inputs 1-8)

  • RxPDO 0x1A01:

    • empty

  • TxPDO 0x1600:

    • Object 6200:0x01 (digital Outputs 1-8)

  • TxPDO 0x1601:

    • empty

Mapping can be changed by the EtherCAT® master (PDO mapping, PDO assignment).

Object functions

The example project implements some functionality. The following table gives an overview.

Index

SubIndex

Object function

Index

SubIndex

Object function

0x200C

0x00

each SDO Upload request (read) will increment the object value

0x200D

0x00

contains number of SYNC0 DC events when in DC mode

0x200E

0x00

contains number of SYNC1 DC events when in DC mode

0x200F

0x00

contains 1 when in DC mode, else 0

0x6200

0x01

pdo output data

0x6200

0x02

pdo output data

0x6411

0x01

pdo output data

0x6411

0x02

pdo output data

0x6000

0x01

mirrors value of 0x6200:0x01 process data

0x6000

0x02

mirrors value of 0x6200:0x02 process data

0x6401

0x01

mirrors value of 0x6411:0x01 process data

0x6401

0x02

mirrors value of 0x6411:0x02 process data

Table: Example object functions

Distributed Clocks

In order to operate the slave in Distibuted Clocks (DC) mode, one of the available DC sync modes must be selected:

Sync Mode

Operation

Sync Mode

Operation

FeeRun/SM-Synchron

Application controller does not get sync information

DC-Synchron

Application controller gets SYNC0 event, device operates in DC mode

DC-Synchron with SYNC0 and SYNC1

Application controller gets both SYNC events, device operates in DC mode

Table: Available sync modes of example application

To detect sync events on the S7G2-SK board, some preparations haveto be made. Please make the following connections on the shield module using a wire bridge:

  • P6_13 (PD6) -> P2_2 (SYNC1)

  • P6_8 (PD5) -> P3_3 (SYNC0)

The application propagates the detected DC events in the objects 0x200D and 0x200E. The minimum cycle time for this example is set to 1 ms.

FoE

FoE read and write access is supported by the device. A buffer of 1840 acts as a local file, which can be read or written. The following properties have to be set:

FoE Property

Value

FoE Property

Value

Filename

test.txt

Password

123456

Table: FoE example settings

EoE

When the slave is operating in an EtherCAT® network with a PLC which supports EoE, following IP based services are availabe:

  • Device Detection Protocol (e.g. for Industrial Communication Explorer):

    • Device Detection

    • Log Access

    • Configuration Variables Access

  • HTTP

    • Sample Website on default port 80

The firmware update of the CC module over HTTP will not work in EtherCAT® mode. Thus if required use the FoE method for firmware update.

The device supports configuration of EoE, however any given MAC address will be ignored. The internal MAC address will be used instead. The IP-Address of the device can either be configured using the Industrial Communication Explorer or configured by the PLC.