IMDHMIControls LibraryShop main store

Troubleshooting

Why a CODESYS EtherCAT master loses synchronicity

Industrial networks Published 8 min read

Short answer

An intermittent lost synchronicity fault on a CODESYS EtherCAT master is a missed cyclic deadline inside the controller, not a cable fault. In the reported case, a supervisory OPC UA client that opened and closed its channel on every transaction triggered the losses; keeping that channel open stopped them. Doubling the cycle to 10 ms and setting a static address changed nothing.

On this page
  1. What does lost synchronicity mean on an EtherCAT network?
  2. Why does the fault only appear after minutes or hours?
  3. How do I tell a cable fault from a controller timing fault?
  4. Why didn't a longer cycle or a static IP fix it?
  5. How can an OPC UA client disturb a hard real-time fieldbus?
  6. How much timing margin does the EtherCAT cycle leave?
  7. What should I change first to stop the sync losses?
  8. Questions asked

An intermittent lost synchronicity fault on a CODESYS EtherCAT master is a missed cyclic deadline inside the controller, not a broken bus. In the reported case, six axes and a remote I/O node ran on a 5 ms EtherCAT cycle, every task finished inside its period, the master counters stayed clean, and the bus still stopped after minutes or hours. The trigger was a supervisory OPC UA client that opened its channel, transacted and closed it again on every pass; keeping the channel open ended the faults. Doubling the cycle and replacing DHCP with a static address changed nothing, which is what makes the case worth copying: check what else the controller hosts before you touch bus settings.

What does lost synchronicity mean on an EtherCAT network? #

It means the master's cyclic frames stopped arriving inside the timing window the slaves check, so the fieldbus was declared lost; the message reports a missed deadline, and by itself it says nothing about which wire, slave or process is at fault.

EtherCAT is cyclic by construction. The master launches one frame per cycle, the frame travels through every slave while each device reads its inputs and writes its outputs on the fly, and it returns to the master. Under the ETG.1000 specification framework, which IEC 61158 adopts for EtherCAT, slaves guard that rhythm with sync watchdogs, and a device that stops receiving its frames within the agreed window reports a synchronization loss. Real-time EtherCAT master documentation lists jitter, driver problems and interrupts masked too long among the causes of process-data synchronization loss. The message is a deadline report, not a wire report. The log line in the reported case read Filedbus lost synchronicity, and once it appeared the bus stayed down until the master was reinitialized; in reported recoveries a warm reset of the runtime brought communication back.

Why does the fault only appear after minutes or hours? #

Because the trigger is a collision, not a defect: a wrong topology, a damaged connector or a dead slave fails from the first minutes of operation, while a scheduling disturbance only drops the frame when it happens to land inside the launch window.

Intermittence carries information. A wiring or topology fault fails from the first minute and stays failed, while a collision between a recurring load event and a cyclic deadline lands only now and then, which is exactly the minutes-to-hours pattern seen here. The reported setup looked healthy on every usual metric: every task finished inside its period, the master status counters showed nothing, and the only abnormal reading was a jitter figure that looked high without ever being quantified. None of those metrics measures the quantity that decides this fault, which is the gap between the moment the scheduler should release the cyclic task and the moment it actually does. A task can complete in a fraction of its period and still be launched late; average and even maximum execution time look fine while release delay spikes once every few hundred cycles. Measure that gap before you change any setting.

How do I tell a cable fault from a controller timing fault? #

Read the diagnostics at the moment of failure: CRC, frame and watchdog counters on the master and slaves implicate the physical path, while clean counters combined with late frame launches implicate scheduling on the controller. Then correlate timestamps with everything else the controller was doing.

  1. Confirm the configured slave order against the physical chain from the master port outward, and record link status on every device.
  2. After each failure, capture the master's frame counters and every slave's state and error counters before resetting anything.
  3. Log the cyclic task's execution time, its release jitter and any overrun diagnostic over a window long enough to include a failure.
  4. Record everything else the controller hosts, including visualization, logging and each client connection, and correlate that activity with the failure timestamp.
  5. Change one variable per test and run each test longer than the longest previous fault-free interval.

In the reported case the counters were clean and execution stayed inside the period, which moved suspicion from the cable to the launch path. Do not trust a single indicator in either direction: in a comparable case, why a CODESYS EtherCAT master's xError stays false on a cable pull shows the error flag staying false even with the cable pulled, so read flags as hints and counters plus timestamps as evidence.

Why didn't a longer cycle or a static IP fix it? #

Because neither change touched the trigger: in the reported case the fault survived a cycle doubled to 10 ms, and DHCP could never have caused the loss, because EtherCAT's cyclic frames carry no IP addressing and slaves are selected by position on the segment, not by address.

Both changes were tried in the reported case and neither moved the fault. A longer cycle is a genuine remedy, but only for a genuine margin problem: documented first-line responses to this message include raising the EtherCAT task cycle time and the value of the related master timing parameter, and one reported runtime stabilized after returning to a 4 ms task with a 30 percent sync offset. Those are moves for a task that barely fits its period; the reported one was not marginal, with 3 ms of execution well inside its cycle, so widening could not touch launch-delay bursts coming from somewhere else.

A static address on the EtherCAT port is sensible housekeeping on a fixed machine, but it governs only the IP services on that interface, not slave selection. Read the two failed trials as results rather than wasted effort: they exclude the bus configuration and point at the controller's other work.

How can an OPC UA client disturb a hard real-time fieldbus? #

Not through the protocol's content but through its churn: a client that reconnects on every transaction forces session, secure-channel and socket setup into the runtime at a fixed rhythm, and on a soft runtime that burst can delay the cyclic frame launch past its deadline.

In the reported case the client opened its channel, read or wrote variables and closed the channel again every second. Each reconnect means a TCP handshake, a secure channel opened and closed, session activation and discovery work, all landing inside the runtime that must launch a cyclic frame on schedule. EtherCAT does not care that average processor load stays low; it cares that every single launch lands on time.

The reported controller was a Linux single-board machine, the same family of setup as in running CODESYS SoftMotion over EtherCAT on a Raspberry Pi runtime, where the cyclic task shares the operating system with visualization, logging and every client connection. Core pinning and the highest task priority, which the reported setup also had, stop other application tasks from preempting the cyclic one; they do nothing about interrupt handling, kernel network work or memory allocation, and those are exactly the resources a burst of connection setups hits. OPC UA is designed for long-lived sessions with subscriptions, and the same server on a CODESYS soft PLC serves a normal persistent client without trouble, as in connecting Factory I/O to a local CODESYS soft PLC over OPC UA. A client that reconnects per transaction is misusing a session protocol, and on a soft runtime the bill arrives at the fieldbus.

How much timing margin does the EtherCAT cycle leave? #

With the reported numbers, a 3 ms execution inside a 5 ms cycle tolerates at most 5 − 3 = 2 ms of launch delay, and the client's once-per-second reconnect pattern gave the runtime 200 cyclic launches between two bursts.

Worked example, using the reported case's numbers as inputs:

  • Inputs: EtherCAT task period 5 ms; worst task execution 3 ms; client reconnect interval 1 s.
  • Launch budget: 5 − 3 = 2 ms. A start delay beyond that lands the frame after the point the slaves expect; the exact due-point shifts with the master's sync offset setting, so this budget belongs to these reported inputs, not to every bus.
  • Collision rate: 1 s ÷ 5 ms = 200 cyclic launches between two reconnect events.
  • Daily exposure: 24 h × 60 min × 60 s = 86,400 reconnects in a day of continuous running, each one an independent chance for one launch delay past the budget.
  • Read-out: failures spaced minutes to hours apart are exactly what a rare collision against that budget looks like; the average launch stays perfect and the rare one pays.

That arithmetic explains all three observations at once: clean counters, because the wire was never the problem; no effect from a wider cycle, because the task was never long; and a cure from keeping the client connection open, because the recurring burst was the only recurring candidate for a late launch.

What should I change first to stop the sync losses? #

Fix the client lifecycle first when an application reconnects per transaction: the reported fault stopped once the client held one channel open, and it did not come back in the days after. Widen the cycle or retune the sync offset only when jitter stays marginal with a well-behaved client.

  • Dirty slave counters, meaning CRC errors, dropped frames or a slave stuck out of its operational state: repair the physical path, cable, connectors, shield and grounding.
  • Clean counters with release jitter above the margin: hunt the co-resident burst on the controller before touching settings; if no burst exists, widen the margin one change at a time, cycle first, sync offset second.
  • A supervisory application that reconnects per transaction: convert it to one persistent session and channel, then run longer than the longest previous fault-free interval before calling it fixed. This was the reported fix.
  • Bus down after the message appears: expect a master re-initialization; a warm reset of the runtime is the recovery reported for this condition.

Put the axes in a safe state before any of this retiming, because a re-initialized master can drive machine outputs to new states without warning. Work from the client toward the cable, and let counters and timestamps choose the branch rather than the settings menu.

Questions asked

Which software versions were in the reported case?

The reported stack was CODESYS V3.5 SP17 Patch 1 (64-bit), CODESYS EtherCAT 4.1.0.0, CODESYS SoftMotion 4.10.0.0 and runtime build 4.1.0.0 on a Linux single-board controller. Record your own versions the same way before comparing behavior. The mechanism is not tied to one build: any soft runtime shares its scheduler with the supervisory connections it serves, so check client behavior before blaming or upgrading a version.

Why did the isolated core and top task priority not prevent the fault?

A dedicated core and the highest task priority stop other application tasks from preempting the cyclic task, but they do not isolate it from everything. Interrupt handling, kernel networking and memory allocation stay shared with every service on the controller. The reported setup had exactly that isolation and still lost synchronicity, which is what pointed away from task settings and toward the reconnect churn.

What does a well-behaved OPC UA client look like?

It opens one session and one secure channel, keeps them open for the whole run, and follows data through subscriptions or periodic reads inside that session. It reconnects only after a communication fault, with a backoff between attempts. The client in the reported case connected, transacted and disconnected on every pass; moving it to a persistent session removed the trigger entirely.

Does the same trigger apply to PROFINET or EtherNet/IP networks?

The mechanism travels, the symptom changes. A soft controller that also hosts supervisory connections can miss a cyclic deadline when a client floods it with connection setups, whatever fieldbus it runs. On EtherNet/IP or PROFINET the same overload usually shows up as device timeouts and dropped connections rather than a synchronicity message, and the diagnostic order stays the same: counters first, then task timing, then client behavior.

Should I just increase the EtherCAT cycle until the fault disappears?

Treat a wider cycle as a margin fix, not a cure. Raising it is a documented remedy when execution or jitter genuinely crowds the period, and one reported runtime stabilized at a 4 ms task with a 30 percent sync offset. If the fault survives a longer cycle with clean counters, the trigger is a recurring load event, and no cycle width will remove it.

Keep reading

  • Selection guide

    Choosing a ControlLogix path to a Modbus TCP Schneider PLC

    ODVA Volume 7 defines how Modbus devices integrate into CIP; it is not a ControlLogix feature, so no stock 1756 Ethernet module speaks Modbus TCP natively. Choose from four paths: an in-rack or standalone gateway, Modbus TCP written over generic sockets on a 1756-EN2T at firmware 5 with RSLogix 5000 v20 (or a 1756-EWEB), an OPC bridge on a PC, or EtherNet/IP on the Schneider side where the CPU supports it.

    Industrial networks

  • Troubleshooting

    Reaching PLC-5 and SLC 500 data through a ControlLogix DH+ bridge

    Yes. An OPC UA server reaches PLC-5 and SLC 500 processors through a ControlLogix Ethernet-to-DH+ bridge when its Allen-Bradley driver documents routed legacy access. Confirm the driver, inventory the bridge modules, build each connection path to the DH+ node, and prove one read — the 1756-DHRIO carries 32 connections per DH+ channel.

    Industrial networks

  • How-to

    Set up a CODESYS adapter for explicit CIP messaging to Logix

    Register the custom CIP object in the adapter during startup with RegisterCIPObject, point both Logix MSG instructions at the same Class, Instance and Attribute 3 with Get and Set Attribute Single, and keep the exchanged value at or under 468 bytes. A ten-element DINT array is 40 bytes, well inside the limit; verify with the write MSG DN bit and matching readback on both sides.

    Industrial networks

Why a Profibus PA positioner drops out at an H changeover