OPC UA Server

The EtherCAT Master includes an embedded OPC UA Server running on port 4840 (default). It exposes the EtherCAT process image, master/slave status, and administrative commands.

Information Model

The server exposes the following nodes under the Objects folder:

Master

This object represents the EtherCAT Master itself.

  • State (Variable, Read-Only): Current state of the master (INIT, PREOP, SAFEOP, OP).

  • requestState (Method): Request a state transition for the master.

    • Arguments: targetState (UInt32)

Slaves

Contains a list of all configured EtherCAT slaves. Each slave is represented as an object with:

  • State (Variable, Read-Only): Current state of the slave.

  • VendorId, ProductCode, SerialNumber, SlaveId (Properties): Identity information.

ProcessImage

Access to the cyclic process data (PDOs).

  • Inputs: Folder containing all input variables read from slaves.

  • Outputs: Folder containing all output variables written to slaves.

  • PackedImage (Variable, Read-Only, ByteString): All variables of Inputs and Outputs, including the read-only (echoed) outputs, packed into one little-endian byte string without padding, read consistently from one EtherCAT cycle. Each variable is packed exactly like its node. In dummy mode the image packs the current node values. A read with an IndexRange returns only that byte range, e.g. the slot of one variable.

    • Layout (Property): JSON array with one {"name", "direction", "type", "elementSize", "isArray", "count", "offset"} object per variable, in packing order; direction is input or output, type is the OPC UA DataType name (SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float or Double), isArray tells whether the variable’s node holds an array of count elements (possibly just one) or a scalar (count is 1).

Variables are organized by their names as defined in the ENI file or configuration.

In dummy mode (dummy_opcua_server), where there is no bus, every variable starts with a zero value of its type until a client writes it.

System

System-level information and control.

  • SystemInfo (Variable): Struct containing current state and error information.

  • Version (Property): Application version string.

  • RunsInDummyMode (Variable): True if running without real hardware (‘dummy mode’).

  • Restart (Method): Restart the EtherCAT master in case of an error.

  • ContinueWithError (Method): Acknowledge error and try to recover without restart.

  • Events: The server emits events for log messages (Info, Warning, Error).

CoE (CanOpen over EtherCAT)

Methods for acyclic communication (SDO).

  • StartSdoWrite (Method): Start an SDO download.

    • Arguments: slaveIndex, index, subIndex, data (ByteString), timeoutMs.

    • Returns: requestId (UInt64).

  • PollSdoWrite (Method): Poll a started SDO download.

    • Arguments: requestId.

    • Returns: done (Boolean), success (Boolean), abortCode (UInt32).

  • StartSdoRead (Method): Start an SDO upload.

    • Arguments: slaveIndex, index, subIndex, size, timeoutMs.

    • Returns: requestId (UInt64).

  • PollSdoRead (Method): Poll a started SDO upload.

    • Arguments: requestId.

    • Returns: done (Boolean), success (Boolean), data (ByteString), abortCode (UInt32).

Note: the data byte strings are in little-endian byte order.