EtherCAT Protocol

Description of the EtherCAT protocol implementation in the Typhoon HIL toolchain.

Real-time only: This document is valid only for real-time simulation.

Introduction to EtherCAT protocol

EtherCAT (Ethernet for Control Automation Technology) is an Ethernet-based industrial fieldbus protocol, invented by Beckhoff Automation. The protocol is specifically designed to apply an Ethernet structure for automation applications requiring short data update (cycle) times with low communication jitter and reduced hardware costs.

EtherCAT is a master/slave protocol, which means that there is one master device (implemented completely in the software) and multiple slave devices (implemented in the hardware) connected to a network. Every cycle, the master device sends one standard Ethernet frame which encapsulates multiple EtherCAT datagrams. EtherCAT datagrams address a specific part of the EtherCAT process image (up to 4 GB in size), in which every slave device is assigned one or more addresses. This means that one Ethernet frame sent by a master device contains process data for every slave device in the network. Each slave device reads and writes data from the frame while the frame passes through the device, which is extremely useful for real-time communication. This also eliminates the need for higher level protocol stacks, such as TCP/IP and UDP/IP, because EtherCAT datagrams reach only as high as the second layer (data link) of the ISO/OSI reference model.

Besides this cyclic process data communication, additional acyclic communication profiles have been established, including CanOPEN over EtherCAT (CoE), Ethernet over EtherCAT (EoE) and File Access over EtherCAT (FoE). It is important to note that the Typhoon HIL EtherCAT master does not support any acyclic communication profiles, while the EtherCAT slave supports only CoE-based acyclic communication with certain limitations.

The EtherCAT slave device can be configured by the master device using an ESI configuration file, which is essentialy an XML document containing all the information needed for properly setting up a slave device for communication. EtherCAT Slave Configuration decribes the ESI file template designed for use with Typhoon HIL EtherCAT slave devices.

Note: In order to avoid unexpected errors during configuration and usage of the Typhoon HIL EtherCAT slave device, it is strongly recommended to use the provided ESI file template and follow the instructions below to modify it as needed. Also, the EtherCAT master device supports communication with slave devices whose ESI file corresponds to the given ESI template.

EtherCAT Slave Device hardware

Every EtherCAT compatible Typhoon HIL device is equipped with the Microchip LAN9252 EtherCAT slave hardware. The Microchip LAN9252 comes with three fieldbus memory management units (FMMUs) and four SyncManagers. It contains 4 kB of data process RAM (DPRAM), which is used for storing process data. Two Ethernet ports can be used for interfacing with the master device and another slave device (or two other slave devices).

EtherCAT slave device is compatible with the following Typhoon HIL devices: HIL506 and HIL606.

EtherCAT Slave Device Component

Component Not Supported: This component is not currently supported in TyphoonSim. Adding this component to your model will prevent you from being able to run your model in TyphoonSim. Please disable or remove this component from your model before attempting to run your model in TyphoonSim mode.

The EtherCAT Slave Device component implements EtherCAT slave functionality. It can be configured by importing an ESI file in the component properties. The component then parses the imported configuration file and displays the details of the process data.

The EtherCAT Slave component is shown in Figure 1.

Figure 1. EtherCAT Slave component

The EtherCAT Slave component dialog window includes the following elements:

  • Import ESI file
    • This button is used to import an ESI configuration file from the selected file location.
  • Vendor ID, Vendor name, Product code and Product Name
    • Basic slave information displayed directly below the Choose file widget, as defined in the imported ESI file.
  • Execution rate
    • Defines the execution rate of the EtherCAT Slave component.
  • PDO configuration
    • Displays PDO information for both Transmit Process Data Objects (Tx PDOs) and Receive Process Data Objects (Rx PDOs), as defined in the ESI file.
    • Selecting a PDO item in the TxPDO information or RxPDO information table populates the PDO entry information table with the corresponding entries, including index, subindex, name, bit length, and data type.

The dialog window serves purely as a display, and as such does not allow any PDO modifications. All such modifications should be done in the ESI configuration file.

After clicking the OK button, defined RxPdo and TxPdo entries are translated into corresponding output and input terminals in the EtherCAT Slave component, with entries' names as the names of the terminals. It is strongly recommended to give unique names to the PDO entries, in order to differentiate the terminals of the EtherCAT Slave component.

Note: The update rate of the variables in the model for the EtherCAT Slave component is approximately 2 ms.

EtherCAT Slave Configuration

ESI configuration files are XML documents with a special element hierarchy, which describes the slave's physical properties, as well as the communication protocol details (including the size and the type of process data objects used). Since all Typhoon HIL EtherCAT compatible devices are equiped with a certain kind of EtherCAT slave hardware, and considering that the devices do not support all EtherCAT communication profiles, some restrictions are made on the content of ESI files that configure Typhoon HIL EtherCAT slave devices. The following list describes the ESI file elements and attributes which are mandatory, forbidden, fixed, or optional. Elements and attributes not mentioned in this list are free to be used as-is. ESI file elements are annotated using <> brackets, while the element attributes are annotated with the preceding @ symbol.
<EtherCATInfo> - mandatory
    <InfoReference> - forbidden
    <Vendor> - mandatory
        <Id> - mandatory
        <Name> - mandatory
    <Descriptions>
        <Groups> - mandatory
            <Group> - mandatory
        <Devices> - mandatory
            <Device> - mandatory
                @Invisible - forbidden
                @Physics - fixed - "YY"
                <Type> - mandatory
                <Name> - mandatory
                <GroupType> - mandatory
                <Profile> - optional
                <Fmmu> - fixed - Outputs
                <Fmmu> - fixed - Inputs
                <Sm> - fixed - MBoxOut
                    @ControlByte - mandatory
                    @DefaultSize - mandatory
                    @Enable - fixed - "1"
                    @StartAddress - mandatory
                <Sm> - fixed - MBoxIn
                    @ControlByte - mandatory
                    @DefaultSize - mandatory
                    @Enable - fixed - "1"
                    @StartAddress - mandatory
                <Sm> - fixed - Outputs
                    @ControlByte - mandatory
                    @Enable - fixed - "1"
                    @StartAddress - fixed - in range - 0x1000 - 0x1FFF    
                <Sm> - fixed - Inputs
                    @ControlByte - mandatory
                    @Enable - fixed - "1"
                    @StartAddress - fixed - in range - 0x1000 - 0x1FFF
                <RxPdo> - mandatory (at least one)
                    @Fixed - fixed - "true"
                    @Mandatory - fixed - "true"
                    @Virtual - forbidden
                    @OverwrittenByModule - forbidden
                    @SRA_Parameter - forbidden
                    <Index> - fixed - in range - 0x1600 - 0x17FF
                    <Name> - mandatory
                    <Entry>
                        <Index> - fixed - in range - 0x2000 - 0x5FFF or 0x6000 - 0x9FFF
                        <SubIndex> - fixed - in range - 0x01 - 0xFF
                        <Name> - mandatory
                        <BitLen> - mandatory
                        <DataType> - mandatory
                        <DependOnSlot> - forbidden
                        <DependOnSlotGroup> - forbidden 
                <TxPdo> - mandatory (at least one)
                    @Fixed - fixed - "true"
                    @Mandatory - fixed - "true"
                    @Virtual - forbidden
                    @OverwrittenByModule - forbidden
                    @SRA_Parameter - forbidden
                    <Index> - fixed - in range - 0x1A00 - 0x1BFF
                    <Name> - mandatory
                    <Entry>
                        <Index> - fixed - in range - 0x2000 - 0x5FFF or 0x6000 - 0x9FFF 
                        <SubIndex> - fixed - in range - 0x01 - 0xFF
                        <Name> - mandatory
                        <BitLen> - mandatory
                        <DataType> - mandatory
                        <DependOnSlot> - forbidden
                        <DependOnSlotGroup> - forbidden
                <Mailbox> - optional
                    @DataLinkLayer - fixed - "true"
                    @RealTimeMode - forbidden
                    <AoE> - forbidden
                    <EoE> - forbidden
                    <CoE> - mandatory
                        @CompleteAccess - fixed - "false"
                        @PdoUpload - fixed - "false"  
                        @SdoInfo - fixed - "true"    
                        @PdoAssign - forbidden
                        @PdoConfig - forbidden
                        @EdsFile - forbidden
                        @DS402Channels - forbidden
                        @SegmentedSdo - forbidden
                        @DiagHistory - forbidden
                        @SdoUploadWithMaxLength - forbidden
                        @TimeDistribution - forbidden
                        <Object> - forbidden
                        <InitCmd> - forbidden
                    <FoE> - forbidden
                    <SoE> - forbidden
                    <VoE> - forbidden
                    <VendorSpecific> - forbidden
                <Slots> - forbidden
                <Eeprom> - mandatory
                    <ByteSize> - fixed - 2048
                    <ConfigData> - fixed - first two bytes - 80
        <Modules> - forbidden       

SyncManagers

In order for the Typhoon HIL EtherCAT slave device to work properly, all four SyncManagers must be configured as described previously. MBoxOut and MBoxIn SyncManagers should have non-zero default sizes. None of the SyncManagers' memory regions should overlap. Keep in mind that the memory regions of Outputs and Inputs SyncManagers are triple the size of their assigned PDOs. This is needed in order to keep the memory regions synchronized. Lastly, the total size of the SyncManagers' memory regions should not exceed the total size of DPRAM (4kB).

Process Data Objects

RxPdo and TxPdo elements of the ESI file represent a single Process Data Object which takes part in data exchange between the master and slave devices. Data transmitted from the slave device to the master device is described by TxPdo elements, while RxPdo elements describe data transmitted from the master device to the slave device. Each PDO must be defined by a unique index and a (not necessarily unique) name. RxPdo indexes must belong to the 0x1600 - 0x17FF range, while TxPdo indexes must belog to the 0x1A00 - 0x1BFF range. Since Typhoon HIL EtherCAT slave devices do not support dynamic PDO configuration, PDO elements should have Fixed and Mandatory attributes set to "true". Sm attribute of the PDO element should be set to the index of the corresponding SyncManager (Outputs SyncManager corresponds to RxPdo elements, while Inputs SyncManager corresponds to TxPdo elements).

Each PDO element consists of zero or more Entry elements which describe a single variable partaking in the process data communication. Entries are uniquely defined by an index and a subindex. Data which they carry is described by its bitlength and data type. Data types described by the EtherCAT protocol are listed in Table 1. Note that the Typhoon HIL devices do not support data types longer than 32-bits, which means that all EtherCAT Base Data types longer than this will be truncated.

Table 1. EtherCAT Base Data Types
Name Description Bit Size Range
BOOL Boolean 1
BIT1 1 Bit String 1
BIT2 2 Bit String 2
BIT3 3 Bit String 3
BIT4 4 Bit String 4
BIT5 5 Bit String 5
BIT6 6 Bit String 6
BIT7 7 Bit String 7
BIT8 8 Bit String 8
BITARR8 8 Individual Bits 8
BITARR16 16 Individual Bits 16
BITARR32 32 Individual bits 32
SINT Short Integer 8 -128 to 127
INT Integer 16 -32.768 to 32.767
INT24 24-Bit Integer 24 -223 to 223 - 1
DINT Double Integer 32 -231 to 231 - 1
INT40 40-Bit Integer 40 -239 to 239 - 1
INT48 48-Bit Integer 48 -247 to 247 - 1
INT56 56-Bit Integer 56 -255 to 255 - 1
LINT Long Integer 64 -263 to 263 - 1
USINT Unsigned Short Integer 8 0 to 255
UINT Unsigned Integer 16 0 to 65.535
UINT24 Unsigned 24-Bit Integer 24 0 to 224 - 1
UDINT Unsigned Double Integer 32 0 to 232 - 1
UINT40 Unsigned 40-Bit Integer 40 0 to 240 - 1
UINT48 Unsigned 48-Bit Integer 48 0 to 248 - 1
UINT56 Unsigned 56-Bit Integer 56 0 to 256 - 1
ULINT Unsigned Long Integer 64 0 to 264 - 1
REAL Floating Point 32
LREAL Long Float 64

Due to software limitations, there should be at least one of each RxPdo and TxPdo elements of non-zero bit length in the ESI file in order for the Typhoon HIL EtherCAT slave device to work properly (even if the defined PDOs are not used).

CoE Mailbox communication protocol

CAN application protocol over EtherCAT (CoE) is the most commonly used EtherCAT mailbox application protocol. To ensure compatibility with the Typhoon HIL toolchain, the ESI file must be defined according to the rules outlined in the EtherCAT Slave Configuration. The full CoE Communication Object Dictionary Area is specified in the official protocol documentation, but the objects listed in Table 2 are the ones recognized by the Typhoon HIL EtherCAT Slave application.

Table 2. CoE Communication Object Dictionary Area
Index(hex) Name
1000 Device Type
1018 Identity Object
1600 1st receive PDO Mapping
1601 2nd receive PDO Mapping
17FF 512th receive PDO Mapping
1A00 1st transmit PDO Mapping
1A01 2nd transmit PDO Mapping
... ...
1BFF 512th receive PDO Mapping
1C00 Sync Manager Communication Type
1C12 Sync Manager 2 PDO Assignment
1C13 Sync Manager 3 PDO Assignment
The Identity and Device Type objects are defined in the EtherCAT Slave application based on the section of the ESI file identified through the XML structure path: EtherCATInfo → Descriptions → Devices → Device → Profile → Dictionary → Objects → Object. This section of the ESI file is parsed to only locate the objects with indexes 0x1000 and 0x1018. Their structure must comply with the official protocol documentation, subject to the following conditions:
  • The Device Type Object requires a defined default value for the EtherCAT Slave application. Default values can be specified using either the <DefaultValue> or <DefaultData> elements.
  • The Identity Object must have default values for all of its subitems. The Identity Object is required to contain five subitems, as specified by the protocol.

An example of how they appear in the ESI file is provided below:

<Object>
    <Index>#x1000</Index>
    <Name>Device Type</Name>
    <Type>UDINT</Type>
    <BitSize>32</BitSize>
    <Info>
      <DefaultValue>#x00000000</DefaultValue>
    </Info>
    <Flags>
      <Access>ro</Access>
      <Category>m</Category>
    </Flags>
</Object>
<Object>
    <Index>#x1018</Index>
    <Name>Identity Object</Name>
    <Type>DT1018</Type>
    <BitSize>144</BitSize>
    <Info>
      <SubItem>
        <Name>Max SubIndex</Name>
        <Info>
          <DefaultValue>4</DefaultValue>
        </Info>
      </SubItem>
      <SubItem>
        <Name>Vendor ID</Name>
        <Info>
          <DefaultValue>#x0c7b</DefaultValue>
        </Info>
      </SubItem>
      <SubItem>
        <Name>Product Code</Name>
        <Info>
          <DefaultValue>#x00000100</DefaultValue>
        </Info>
      </SubItem>
      <SubItem>
        <Name>Revision Number</Name>
        <Info>
          <DefaultValue>#x1</DefaultValue>
        </Info>
      </SubItem>
      <SubItem>
        <Name>Serial Number</Name>
        <Info>
          <DefaultValue>#x00000000</DefaultValue>
        </Info>
      </SubItem>
    </Info>
    <Flags>
      <Access>ro</Access>
    </Flags>
</Object>

From the EtherCATInfo → Descriptions → Devices → Device → Profile → Dictionary → Objects → Object section of the ESI file, only Identity and Device Type objects are currently read; all other objects are ignored. The remaining SDOs (Service Data Objects) defined in the Typhoon HIL EtherCAT Slave application are obtained in a different manner, based on information from the PDO mapping, Sync Managers, and Sync Manager PDO assignments, which are also defined in the ESI file, thereby covering the Object Dictionary structure as defined by the protocol.

EEPROM

<ConfigData> subelement of the <Eeprom> element of the ESI file allows for specifying the EEPROM configuration data. Since the Typhoon HIL EtherCAT slave device uses SPI microcontroller interface, the first two bytes of the EEPROM configuration data should be set to 80.

Example of ESI configuration file

The following example shows a process data configuration in which one 32-bit entry of DINT data type is sent from the slave device to the master device, and another entry of the same type is sent in the opposite direction. Adding or removing PDOs and their entries can be done freely, as long as the total size of the PDOs does not exceed the limitations of the DPRAM (described in the SyncManagers paragraph). This example is intended to demonstrate the basic operation of PDO communication.

<?xml version="1.0"?>
<EtherCATInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="EtherCATInfo.xsd" Version="1.6">
  <Vendor>
    <Id>#xC7B</Id>
    <Name>Typhoon HIL Inc</Name>
    <ImageData16x14>424DD6020000000000003600000028000000100000000E0000000100180000000000A0020000C40E0000C40E000000000000000000001306E31306E31306E31003E21104E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30E01E22318E51A0EE40900E10800E10800E10900E10E01E20A00E20700E10D00E21306E31306E31306E31306E31103E21B10E37570EF615AEC5D56EB7470EE7673EF6B66ED3228E7625CEC807BF04841E90D00E21306E31306E31306E30F01E23931E74B44E94038E84F47EA3228E62A1FE53D34E81D10E44941E9736DEE1307E31104E21306E31306E31306E31306E30000E00300E10800E12C21E61408E37069EE0400E10900E10600E10800E11104E21306E31306E31306E31306E30400E1B6B3F65850EB0000DDF6F7FE0100E0E0E0FB0000DE4138E8A4A0F40500E11306E31306E31306E31306E31306E30E01E22115E4E7E6FCB6B3F6E3E3FB0000DDF4F5FD362CE7C0BDF78B86F10000E00000E01003E21306E31306E31306E31306E30C00E20000DFFFFFFFEAEBFDE5E5FCDEDEFBFBFDFEC1BEF70000DD6A64EDE3E4FB1104E21003E21306E31306E31306E30F02E20F03E2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7973EF655EEDF9FAFE0000DE8884F10800E11306E31306E31306E30700E1716BEEFFFFFFFFFFFFFFFFFFFFFFFFC7C6F8E0E0FBFFFFFFBDBAF70000E00800E11306E31306E31306E31306E30D00E23329E6EBEBFCFFFFFFFFFFFFFFFFFFE6E6FCFFFFFFFFFFFF5149EA0900E11306E31306E31306E31306E31306E31306E30A00E11206E2B4B1F6A19CF3756FEEFFFFFFFFFFFF8A85F10000E01205E21306E31306E31306E31306E31306E31306E31306E30F02E20100E00200E00000DF726CEE2A1FE50000E01205E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30800E10D00E21306E31306E31306E31306E31306E31306E3</ImageData16x14>
  </Vendor>
  <Descriptions>
    <Groups>
      <Group>
        <Type>Typhoon HIL EtherCAT Slaves</Type>
        <Name LcId="1033">Typhoon HIL EtherCAT Slaves</Name>
        <ImageData16x14>424DD6020000000000003600000028000000100000000E0000000100180000000000A0020000C40E0000C40E000000000000000000001306E31306E31306E31003E21104E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30E01E22318E51A0EE40900E10800E10800E10900E10E01E20A00E20700E10D00E21306E31306E31306E31306E31103E21B10E37570EF615AEC5D56EB7470EE7673EF6B66ED3228E7625CEC807BF04841E90D00E21306E31306E31306E30F01E23931E74B44E94038E84F47EA3228E62A1FE53D34E81D10E44941E9736DEE1307E31104E21306E31306E31306E31306E30000E00300E10800E12C21E61408E37069EE0400E10900E10600E10800E11104E21306E31306E31306E31306E30400E1B6B3F65850EB0000DDF6F7FE0100E0E0E0FB0000DE4138E8A4A0F40500E11306E31306E31306E31306E31306E30E01E22115E4E7E6FCB6B3F6E3E3FB0000DDF4F5FD362CE7C0BDF78B86F10000E00000E01003E21306E31306E31306E31306E30C00E20000DFFFFFFFEAEBFDE5E5FCDEDEFBFBFDFEC1BEF70000DD6A64EDE3E4FB1104E21003E21306E31306E31306E30F02E20F03E2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7973EF655EEDF9FAFE0000DE8884F10800E11306E31306E31306E30700E1716BEEFFFFFFFFFFFFFFFFFFFFFFFFC7C6F8E0E0FBFFFFFFBDBAF70000E00800E11306E31306E31306E31306E30D00E23329E6EBEBFCFFFFFFFFFFFFFFFFFFE6E6FCFFFFFFFFFFFF5149EA0900E11306E31306E31306E31306E31306E31306E30A00E11206E2B4B1F6A19CF3756FEEFFFFFFFFFFFF8A85F10000E01205E21306E31306E31306E31306E31306E31306E31306E30F02E20100E00200E00000DF726CEE2A1FE50000E01205E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30800E10D00E21306E31306E31306E31306E31306E31306E3</ImageData16x14>
      </Group>
    </Groups>
    <Devices>
      <Device Physics="YY">
        <Type ProductCode="#x00000100" RevisionNo="#x1">Typhoon HIL EtherCAT Slave</Type>
        <Name LcId="1033">Typhoon HIL EtherCAT Slave</Name>
        <GroupType>Typhoon HIL EtherCAT Slaves</GroupType>
        <Fmmu>Outputs</Fmmu>
        <Fmmu>Inputs</Fmmu>
        <Sm ControlByte="#x26" DefaultSize="128" Enable="1" StartAddress="#x1000">MBoxOut</Sm>
        <Sm ControlByte="#x22" DefaultSize="128" Enable="1" StartAddress="#x1080">MBoxIn</Sm>
        <Sm ControlByte="#x24" Enable="1" StartAddress="#x1100">Outputs</Sm>
        <Sm ControlByte="#x20" Enable="1" StartAddress="#x1300">Inputs</Sm>
        <RxPdo Fixed="true" Mandatory="true" Sm="2">
          <Index>#x1600</Index>
          <Name>TestRxVars</Name>
          <Entry>
            <Index>#x7000</Index>
            <SubIndex>#x1</SubIndex>
            <BitLen>32</BitLen>
            <Name>TestRxVar</Name>
            <DataType>DINT</DataType>
          </Entry>
        </RxPdo>
        <TxPdo Fixed="true" Mandatory="true" Sm="3">
          <Index>#x1A00</Index>
          <Name>TestTxVars</Name>
          <Entry>
            <Index>#x6000</Index>
            <SubIndex>#x1</SubIndex>
            <BitLen>32</BitLen>
            <Name>TestTxVar</Name>
            <DataType>DINT</DataType>
          </Entry>
        </TxPdo>
        <Mailbox DataLinkLayer="true">
          <CoE CompleteAccess="false" PdoUpload="false" SdoInfo="true"/>
        </Mailbox>
        <Eeprom>
          <ByteSize>2048</ByteSize>
          <ConfigData>8002000000000000</ConfigData>
          <BootStrap>0010800080108000</BootStrap>
        </Eeprom>
        <ImageData16x14>424DD6020000000000003600000028000000100000000E0000000100180000000000A0020000C40E0000C40E000000000000000000001306E31306E31306E31003E21104E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30E01E22318E51A0EE40900E10800E10800E10900E10E01E20A00E20700E10D00E21306E31306E31306E31306E31103E21B10E37570EF615AEC5D56EB7470EE7673EF6B66ED3228E7625CEC807BF04841E90D00E21306E31306E31306E30F01E23931E74B44E94038E84F47EA3228E62A1FE53D34E81D10E44941E9736DEE1307E31104E21306E31306E31306E31306E30000E00300E10800E12C21E61408E37069EE0400E10900E10600E10800E11104E21306E31306E31306E31306E30400E1B6B3F65850EB0000DDF6F7FE0100E0E0E0FB0000DE4138E8A4A0F40500E11306E31306E31306E31306E31306E30E01E22115E4E7E6FCB6B3F6E3E3FB0000DDF4F5FD362CE7C0BDF78B86F10000E00000E01003E21306E31306E31306E31306E30C00E20000DFFFFFFFEAEBFDE5E5FCDEDEFBFBFDFEC1BEF70000DD6A64EDE3E4FB1104E21003E21306E31306E31306E30F02E20F03E2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7973EF655EEDF9FAFE0000DE8884F10800E11306E31306E31306E30700E1716BEEFFFFFFFFFFFFFFFFFFFFFFFFC7C6F8E0E0FBFFFFFFBDBAF70000E00800E11306E31306E31306E31306E30D00E23329E6EBEBFCFFFFFFFFFFFFFFFFFFE6E6FCFFFFFFFFFFFF5149EA0900E11306E31306E31306E31306E31306E31306E30A00E11206E2B4B1F6A19CF3756FEEFFFFFFFFFFFF8A85F10000E01205E21306E31306E31306E31306E31306E31306E31306E30F02E20100E00200E00000DF726CEE2A1FE50000E01205E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30800E10D00E21306E31306E31306E31306E31306E31306E3</ImageData16x14>
      </Device>
    </Devices>
  </Descriptions>
</EtherCATInfo>

EtherCAT Master Component

Component Ignored: This component is ignored in TyphoonSim. Inputs to this component will be discarded and outputs from the component will be zeroed during TyphoonSim simulation.

The EtherCAT Master component implements EtherCAT master functionality. It's possible to add an arbitrary number of slave devices, where the number of slave devices should match the number of slave devices currently on the network. For each slave device, importing its ESI file is required. The structure of the ESI file must comply with the following:

  • The file must comply with the EtherCAT protocol rules
  • The Fixed attribute of the TxPDO and RxPDO elements is mandatory. The Fixed attribute should have a value of 1 to indicate that the PDO content is not configurable
Note: The Typhoon HIL EtherCAT master is implemented to use only PDO communication. As a result, ESI file elements such as Mailbox will be ignored during parsing.

The EtherCAT Master component is shown in Figure 2.

Figure 2. EtherCAT Master component

The EtherCAT Master component dialog window includes the following elements:

  • Ethernet port
    • Select the Ethernet port on the back of the HIL device that is used by EtherCAT Master application through which data will be exchanged with slave devices.
  • Cycle time
    • Adjust the cycle time within a range from 0.2 ms to 3600 s. The cycle time parameter determines how often, in seconds, the master initiates the sending of a single standard Ethernet frame containing multiple EtherCAT datagrams.
  • Execution rate
    • Execution rate of the EtherCAT Master component.
  • Add or remove a slave device
    • By clicking the plus sign, it's possible to add an arbitrary number of slave devices.
    • Information about each slave device is displayed within its respective tab, where the tab order corresponds to the physical order of slave devices on the network (the first tab signifies that this slave device is the first on the network).
    • Clicking the minus sign removes the currently selected tab (slave device).
  • Slave device tab(s)
    • Import ESI file
      • This button is used to import an ESI configuration file. After the file is imported, the EtherCAT Master parses the ESI file and displays the slave device details, including basic information such as Vendor name, Vendor ID, and Product code, as well as PDO configuration information.
    • Import .bin file
      • This button is used to import an .bin configuration file for reprogramming EtherCAT slave device
      • Importing the slave device binary file is generally not required for normal operation of the EtherCAT Master component and is only necessary when slave device reprogramming is required.
    • Reprogram
      • The Reprogram combo box is used to select when the slave device should be reprogrammed.

It is possible to change name of a slave device by double-clicking on the tab name. Unique names for slave devices are necessary. Their default names are Slave 1, Slave 2, and so on.

After clicking the OK button, parsed RxPdo and TxPdo entries for each slave device are translated into corresponding input and output terminals in the EtherCAT Master component. It is strongly recommended to assign unique names to the PDO entries for each slave device in order to differentiate the terminals of the EtherCAT Master component corresponding to that slave device.

The EtherCAT Master component obtains basic information about the EtherCAT Slave and its configuration by reading from the Slave EEPROM. For models in which both the EtherCAT Master and EtherCAT Slave components are running on HIL, the EEPROM content must be updated whenever the ESI file is changed, especially in the context of changes to data length, data types, and starting addresses. Therefore, a new binary file must be generated after such changes in the ESI file. If the Master component uses a binary file that does not match the ESI file in the model, this may prevent the cyclic process data communication between the EtherCAT Master and Slave from being established.

Important: Currently, Typhoon HIL does not provide a tool for generating a binary EEPROM file from an ESI configuration file. If such functionality is required, please contact support.

Example of ESI configuration file with padding bits

In order to avoid unexpected errors during configuration and usage of the Typhoon HIL EtherCAT master component, it is necessary to add padding bits for each PDO entry that has a bit count different from 8, 16, 32, or 64 bits. This requirement applies to the ESI file of every slave device. An example of an ESI file with padding bits is given below. Padding bits are defined within the <Entry> tag, with <Index> and<SubIndex> values set to 0, while the <BitLen> is set to a value such that the total size of the corresponding PDO entry is 8, 16, 32, or 64 bits.

<?xml version="1.0"?>
<EtherCATInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="EtherCATInfo.xsd" Version="1.6">
  <Vendor>
    <Id>#xC7B</Id>
    <Name>Typhoon HIL Inc</Name>
    <ImageData16x14>424DD6020000000000003600000028000000100000000E0000000100180000000000A0020000C40E0000C40E000000000000000000001306E31306E31306E31003E21104E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30E01E22318E51A0EE40900E10800E10800E10900E10E01E20A00E20700E10D00E21306E31306E31306E31306E31103E21B10E37570EF615AEC5D56EB7470EE7673EF6B66ED3228E7625CEC807BF04841E90D00E21306E31306E31306E30F01E23931E74B44E94038E84F47EA3228E62A1FE53D34E81D10E44941E9736DEE1307E31104E21306E31306E31306E31306E30000E00300E10800E12C21E61408E37069EE0400E10900E10600E10800E11104E21306E31306E31306E31306E30400E1B6B3F65850EB0000DDF6F7FE0100E0E0E0FB0000DE4138E8A4A0F40500E11306E31306E31306E31306E31306E30E01E22115E4E7E6FCB6B3F6E3E3FB0000DDF4F5FD362CE7C0BDF78B86F10000E00000E01003E21306E31306E31306E31306E30C00E20000DFFFFFFFEAEBFDE5E5FCDEDEFBFBFDFEC1BEF70000DD6A64EDE3E4FB1104E21003E21306E31306E31306E30F02E20F03E2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7973EF655EEDF9FAFE0000DE8884F10800E11306E31306E31306E30700E1716BEEFFFFFFFFFFFFFFFFFFFFFFFFC7C6F8E0E0FBFFFFFFBDBAF70000E00800E11306E31306E31306E31306E30D00E23329E6EBEBFCFFFFFFFFFFFFFFFFFFE6E6FCFFFFFFFFFFFF5149EA0900E11306E31306E31306E31306E31306E31306E30A00E11206E2B4B1F6A19CF3756FEEFFFFFFFFFFFF8A85F10000E01205E21306E31306E31306E31306E31306E31306E31306E30F02E20100E00200E00000DF726CEE2A1FE50000E01205E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30800E10D00E21306E31306E31306E31306E31306E31306E3</ImageData16x14>
  </Vendor>
  <Descriptions>
    <Groups>
      <Group>
        <Type>Typhoon HIL EtherCAT Slaves</Type>
        <Name LcId="1033">Typhoon HIL EtherCAT Slaves</Name>
        <ImageData16x14>424DD6020000000000003600000028000000100000000E0000000100180000000000A0020000C40E0000C40E000000000000000000001306E31306E31306E31003E21104E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30E01E22318E51A0EE40900E10800E10800E10900E10E01E20A00E20700E10D00E21306E31306E31306E31306E31103E21B10E37570EF615AEC5D56EB7470EE7673EF6B66ED3228E7625CEC807BF04841E90D00E21306E31306E31306E30F01E23931E74B44E94038E84F47EA3228E62A1FE53D34E81D10E44941E9736DEE1307E31104E21306E31306E31306E31306E30000E00300E10800E12C21E61408E37069EE0400E10900E10600E10800E11104E21306E31306E31306E31306E30400E1B6B3F65850EB0000DDF6F7FE0100E0E0E0FB0000DE4138E8A4A0F40500E11306E31306E31306E31306E31306E30E01E22115E4E7E6FCB6B3F6E3E3FB0000DDF4F5FD362CE7C0BDF78B86F10000E00000E01003E21306E31306E31306E31306E30C00E20000DFFFFFFFEAEBFDE5E5FCDEDEFBFBFDFEC1BEF70000DD6A64EDE3E4FB1104E21003E21306E31306E31306E30F02E20F03E2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7973EF655EEDF9FAFE0000DE8884F10800E11306E31306E31306E30700E1716BEEFFFFFFFFFFFFFFFFFFFFFFFFC7C6F8E0E0FBFFFFFFBDBAF70000E00800E11306E31306E31306E31306E30D00E23329E6EBEBFCFFFFFFFFFFFFFFFFFFE6E6FCFFFFFFFFFFFF5149EA0900E11306E31306E31306E31306E31306E31306E30A00E11206E2B4B1F6A19CF3756FEEFFFFFFFFFFFF8A85F10000E01205E21306E31306E31306E31306E31306E31306E31306E30F02E20100E00200E00000DF726CEE2A1FE50000E01205E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30800E10D00E21306E31306E31306E31306E31306E31306E3</ImageData16x14>
      </Group>
    </Groups>
    <Devices>
      <Device Physics="YY">
        <Type ProductCode="#x00000100" RevisionNo="#x1">Typhoon HIL EtherCAT Slave</Type>
        <Name LcId="1033">Typhoon HIL EtherCAT Slave</Name>
        <GroupType>Typhoon HIL EtherCAT Slaves</GroupType>
        <Fmmu>Outputs</Fmmu>
        <Fmmu>Inputs</Fmmu>
        <Sm ControlByte="#x26" DefaultSize="128" Enable="1" StartAddress="#x1000">MBoxOut</Sm>
        <Sm ControlByte="#x22" DefaultSize="128" Enable="1" StartAddress="#x1080">MBoxIn</Sm>
        <Sm ControlByte="#x24" Enable="1" StartAddress="#x1100">Outputs</Sm>
        <Sm ControlByte="#x20" Enable="1" StartAddress="#x1300">Inputs</Sm>
        <RxPdo Fixed="true" Mandatory="true" Sm="2">
          <Index>#x1600</Index>
          <Name>Signed_int_tx</Name>
          <Entry>
            <Index>#x7000</Index>
            <SubIndex>#x1</SubIndex>
            <BitLen>8</BitLen>
            <Name>Signed_int_tx_1</Name>
            <DataType>SINT</DataType>
          </Entry>
          <Entry>
            <Index>#x7000</Index>
            <SubIndex>#x2</SubIndex>
            <BitLen>24</BitLen>
            <Name>Signed_int_tx_2</Name>
            <DataType>INT24</DataType>
          </Entry>
          <Entry>
            <Index>#x0</Index>
            <SubIndex>#x0</SubIndex>
            <BitLen>8</BitLen>
          </Entry>
          <Entry>
            <Index>#x7000</Index>
            <SubIndex>#x3</SubIndex>
            <BitLen>40</BitLen>
            <Name>Signed_int_tx_3</Name>
            <DataType>INT40</DataType>
          </Entry>
          <Entry>
            <Index>#x0</Index>
            <SubIndex>#x0</SubIndex>
            <BitLen>24</BitLen>
          </Entry>
        </RxPdo>
        <TxPdo Fixed="true" Mandatory="true" Sm="3">
          <Index>#x1A00</Index>
          <Name>Signed_int_rx</Name>
          <Entry>
            <Index>#x6000</Index>
            <SubIndex>#x1</SubIndex>
            <BitLen>56</BitLen>
            <Name>Signed_int_rx_1</Name>
            <DataType>INT56</DataType>
          </Entry>
          <Entry>
            <Index>#x0</Index>
            <SubIndex>#x0</SubIndex>
            <BitLen>8</BitLen>
          </Entry>
        </TxPdo>
        <Mailbox DataLinkLayer="true">
          <CoE CompleteAccess="false" PdoUpload="false" SdoInfo="true"/>
        </Mailbox>
        <Eeprom>
          <ByteSize>2048</ByteSize>
          <ConfigData>8002000000000000</ConfigData>
          <BootStrap>0010800080108000</BootStrap>
        </Eeprom>
        <ImageData16x14>424DD6020000000000003600000028000000100000000E0000000100180000000000A0020000C40E0000C40E000000000000000000001306E31306E31306E31003E21104E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30E01E22318E51A0EE40900E10800E10800E10900E10E01E20A00E20700E10D00E21306E31306E31306E31306E31103E21B10E37570EF615AEC5D56EB7470EE7673EF6B66ED3228E7625CEC807BF04841E90D00E21306E31306E31306E30F01E23931E74B44E94038E84F47EA3228E62A1FE53D34E81D10E44941E9736DEE1307E31104E21306E31306E31306E31306E30000E00300E10800E12C21E61408E37069EE0400E10900E10600E10800E11104E21306E31306E31306E31306E30400E1B6B3F65850EB0000DDF6F7FE0100E0E0E0FB0000DE4138E8A4A0F40500E11306E31306E31306E31306E31306E30E01E22115E4E7E6FCB6B3F6E3E3FB0000DDF4F5FD362CE7C0BDF78B86F10000E00000E01003E21306E31306E31306E31306E30C00E20000DFFFFFFFEAEBFDE5E5FCDEDEFBFBFDFEC1BEF70000DD6A64EDE3E4FB1104E21003E21306E31306E31306E30F02E20F03E2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7973EF655EEDF9FAFE0000DE8884F10800E11306E31306E31306E30700E1716BEEFFFFFFFFFFFFFFFFFFFFFFFFC7C6F8E0E0FBFFFFFFBDBAF70000E00800E11306E31306E31306E31306E30D00E23329E6EBEBFCFFFFFFFFFFFFFFFFFFE6E6FCFFFFFFFFFFFF5149EA0900E11306E31306E31306E31306E31306E31306E30A00E11206E2B4B1F6A19CF3756FEEFFFFFFFFFFFF8A85F10000E01205E21306E31306E31306E31306E31306E31306E31306E30F02E20100E00200E00000DF726CEE2A1FE50000E01205E21306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E31306E30800E10D00E21306E31306E31306E31306E31306E31306E3</ImageData16x14>
      </Device>
    </Devices>
  </Descriptions>
</EtherCATInfo>

In this example of an ESI file, one 8-bit entry of SINT data type is defined, as well as one 24-bit entry of INT24 data type, for which it is necessary to define a padding PDO entry with a bit length set to 8. Additionally, one 40-bit entry of INT40 data type is defined for which it is necessary to define 24 padding bits. These three entries, excluding padding PDO entries, are defined within the RxPDO object, meaning they participate in the transmission of data sent from the master device to the slave. In the opposite direction, one 56-bit entry of INT56 data type is defined for which it is necessary to define a padding PDO entry with a bit length set to 8.

The EtherCAT Master component is compatible with the following Typhoon HIL devices: HIL101, HIL404, HIL506, and HIL606.

Note: The implementations of both components - the EtherCAT Master and the EtherCAT Slave - within the Typhoon HIL toolchain rely on the open-source SOEM (Simple Open Source EtherCAT Master) and SOES (Simple Open Source EtherCAT Slave) libraries.

Virtual HIL support

Virtual HIL currently does not support this protocol. When using a non-real-time environment (e.g. when running the model on a local computer), inputs to this component will be discarded and outputs from this component will be zeroed.