I want to find...

Search

Shares

Table of Content

EtherCAT Master Benchmark

EtherCAT Master Software Performance

When using an EtherCAT network for Fieldbus, good performance is a decisive factor, primarily correlating to a short cycle time (around 1kHz or faster). Since the performance of an EtherCAT Network can be attributed to the EtherCAT Master, its software should be able to support shorter cycle times, a large amount of cyclic process data, as well as handle many EtherCAT devices.

EtherCAT Master Software Requires:

  • High-performance and real-time capable Ethernet drivers (link layer)
  • Cyclic processing component without dependency on OS
  • Support operation without interruptions (have no internal tasks)
  • Support time slicing for process in CPU tasks

An EtherCAT master software must manage and provide parameter settings to reserve sufficient computing power for the actual application and the specified timing on the bus to reduce this peak load.


Key Influencing Variables of EtherCAT Network

Based on the application differences, the following factors are some of the critical areas impacted in an EtherCAT Network:

  • Slave Device Numbers
  • Slave Device Types
  • Cyclic Process Data Size
  • Cycle time
  • EtherCAT master features or capabilities (Distributed Clocks, Cable Redundancy, etc.)
  • Necessary computing time

As we will demonstrate, QEC’s software, the 86Duino IDE, takes all the variables into consideration and manages numerous systems using only 10-20% of the available CPU time.


Measurements

To compute the time consumption of all process paths on the EtherCAT master software, 86Duino IDE, we carried out performance measurements on QEC-M systems. To confirm their Real-time performance was measured correctly and precisely, different cycle time options were tested.

The most reliable values are obtained with a live measurement on real hardware with the actual EtherCAT network configuration. These measurements can be carried out using the 86Duino IDE EthCAT Library example without additional actions or equipment. Within these demo applications, the execution times (minimum, maximum, and average) of the individual master job functions and the cycle time are calculated and saved to the log file (or printed to the console).


Measurement Functions in the Example

In the 86Duino IDE, the EtherCAT network cyclic part is highly integrated and consisted of certain functions with specific tasks that will not interact with others due to their strict division. Based on this feature, we can measure the time consumption of these master frames and further ensure the accuracy of the cycle process.

The tasks include:

ecatLib_tasks

The received data (inputs) in the previous EtherCAT frame is first updated in the “Process Inputs” task. The “User Application” task takes its newly received data, calculates the data (outputs), and sends it out to the network by calling the “Write Outputs” task.

The EtherCAT frame can pass the network through Direct Memory Access (DMA). This means the data can be transported without loading the CPU, as well as be received when returning to the master without interruption automatically or sent out when using a physical network.

In the “State Management and Acyclic Send (SMAS)” task, the master state machine and each slave state machine are executed. All slave device states are transferred from INIT to OPERATIONAL during the initial start-up process. The acyclic mailbox communications require another frame with slave-specific commands for reading and writing to the slave. Moreover, to handle these acyclic mailbox communications like CoE, the state machines are needed in regular operation.

ecatLib_tasksCycle

Example

The measurement results are printed to the serial terminal in the setup() function.

[benchmark.ino]

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

#define WAIT_TIME_MS (10000)

void setup()
{
    EthercatPerfMeasurement perf;
    unsigned long pretime;
    unsigned long sdoValue, sdoCount = 0;

    Serial.begin(115200);

    master.configPerfMeasurement(true);
    master.begin();
    slave.attach(0, master);
    master.start(1000000);

    pretime = millis();
    while (millis() - pretime < WAIT_TIME_MS) {
        if (slave.sdoUpload(0x1000, 0x00, &sdoValue, sizeof(sdoValue)) > 0)
            sdoCount++;
    }

    master.getPerfMeasurement(&perf);
    Serial.print("[C] Cycle Time (min/avg/max) [usec]: ");
    Serial.print(perf.CycleTime.MinimumNs / 1000.0);
    Serial.print(" / ");
    Serial.print(perf.CycleTime.AverageNs / 1000.0);
    Serial.print(" / ");
    Serial.println(perf.CycleTime.MaximumNs / 1000.0);
    Serial.print("[P] Process Inputs (min/avg/max) [usec]: ");
    Serial.print(perf.ReceiveCyclicFrame.MinimumNs / 1000.0);
    Serial.print(" / ");
    Serial.print(perf.ReceiveCyclicFrame.AverageNs / 1000.0);
    Serial.print(" / ");
    Serial.println(perf.ReceiveCyclicFrame.MaximumNs / 1000.0);
    Serial.print("[S] Write Outputs (min/avg/max) [usec]: ");
    Serial.print(perf.SendCyclicFrame.MinimumNs / 1000.0);
    Serial.print(" / ");
    Serial.print(perf.SendCyclicFrame.AverageNs / 1000.0);
    Serial.print(" / ");
    Serial.println(perf.SendCyclicFrame.MaximumNs / 1000.0);
    Serial.print("[SMAS] State Management and Acyclic Send  (min/avg/max) [usec]: ");
    Serial.print(perf.ProcessAcyclicFrame.MinimumNs / 1000.0);
    Serial.print(" / ");
    Serial.print(perf.ProcessAcyclicFrame.AverageNs / 1000.0);
    Serial.print(" / ");
    Serial.println(perf.ProcessAcyclicFrame.MaximumNs / 1000.0);
    Serial.print("The throughput of SDO commands. [SDO/sec]: ");
    Serial.println((double)(sdoCount * 1000) / WAIT_TIME_MS);

    master.stop();
    master.end();
}

void loop() {}

Measurement Results

The following results were performed with 5 different devices of QEC Digital Slave modules with different cycle times, 125, 250, 500, and 1000 µsec. The SDO commands were processed in the SMAS task and were also measured by the maximum throughput in cycle time.

ecatLib_measurementStandard1
ecatLib_measurementStandard2

with SDO commands:

ecatLib_measurementSDO1
ecatLib_measurementSDO2

Video


Stay tuned for more projects on QEC!

Feel free to comment if you have any doubts/queries!

Leave a Comment

Scroll to Top