IMDHMIControls LibraryShop main store

Explainer

CODESYS SoftMotion over EtherCAT on a Raspberry Pi runtime

Drives and motion Published 7 min read

Short answer

Yes: CODESYS Control for Raspberry Pi SL lists the CODESYS EtherCAT master and SoftMotion, so motion over EtherCAT is functionally supported. Its scheduler depends on Linux, so the runtime is not hard real-time as shipped; an RT preempt-patched kernel minimizes jitter. Budget the setpoint age your axis tolerates, measure worst-case jitter under full load, and accept the axis only when the measurement fits the budget.

On this page
  1. What the runtime documents
  2. The data path from planner to drive
  3. Where the timing risk sits
  4. Budget the setpoint age before you commission
  5. Measure the worst case, not the average
  6. Accept, fix, or move
  7. Questions asked

Yes, motion over EtherCAT works on this runtime. CODESYS Control for Raspberry Pi SL lists the CODESYS EtherCAT master and CODESYS SoftMotion among its supported components, so you can plan moves in SoftMotion and ship setpoints to servo drives over EtherCAT. What it does not promise is hard real-time, and that changes the acceptance test: budget the setpoint age your axis tolerates, measure worst-case jitter under full production load, and accept the axis only when the measurement fits the budget. The sections below cover the documented support, the data path, the timing budget with worked arithmetic, the measurement, and the accept, fix or move decision.

What the runtime documents #

Start with the supported-component list, because it decides whether motion is on the table at all. The documentation for CODESYS Control for Raspberry Pi SL names CODESYS EtherCAT Master and CODESYS SoftMotion, alongside EtherNet/IP scanner and adapter, PROFINET master, Modbus TCP and RT master/slave, CANopen, and an OPC UA server in the device description. That is functional support at the runtime level: the components are present, they install into the project, and an application that uses them builds.

The same rule that keeps a Kinetix 5500 off a non-motion Logix controller applies in both directions, as the motion-capable controller requirement explains: motion functions exist only where the runtime lists them, and once they are listed, the remaining risk is not presence but timing.

CODESYS qualifies that risk in the product's own terms: the runtime does not necessarily fulfill hard real-time demands because its scheduling method depends on the operating system, and an operating system configured accordingly — for example with an RT preempt patch — adapts the time behavior and minimizes jitter. Read that as: supported, soft real-time as shipped, improvable at the kernel, and provable only by measurement on your machine.

The data path from planner to drive #

Follow one command through the chain. The SoftMotion planner produces a position or velocity setpoint each motion task cycle. The task hands it to the EtherCAT master, which packs it into the cyclic frame leaving the Ethernet port. Each drive picks up its setpoint in transit and closes its own position, velocity and current loops locally, on its own clock. EtherCAT transports setpoints; it never repairs one the task released late. For a minimal chain to copy from, the runtime's shipped EtherCAT example project shows one fieldbus device under control.

Two couplings decide whether the drive sees fresh commands. The motion task and the cyclic bus exchange need a fixed relationship, so each frame carries the setpoint intended for that cycle — EtherCAT task separation preserves cyclic scheduling when the cyclic task keeps its own slot instead of floating with application work. The mapping between the SoftMotion axis outputs and the drive's process data must also agree in units, scaling and direction, verified from the drive documentation rather than inferred from a green bus.

Bring-up then follows the pattern of any EtherCAT servo: detected identity and order match the configured chain, cyclic data exchange runs, and the drive reports the commanded operating mode. Expect the axis to stay disabled until the drive's ready status settles — the same failure mode as a missing Drive Ready signal on an axis retrofit — and prove direction and scaling at low speed before any real move.

Where the timing risk sits #

The risk is not the wire. EtherCAT slaves service frames in hardware, and a healthy chain shows coherent timing at the ports. The risk sits above the wire: Linux schedules the runtime like any other process, so a logging flush, a visualization poll, an OPC UA session or a disk chore can release the motion task late. That cycle's frame then carries a setpoint older than the task period, and the drive extrapolates from stale data while the network itself reports no fault.

This is why task jitter and PDO timing are different measurements: the fieldbus can be flawless while the application side ages every command. It is also why the average lies. An axis that runs cleanly for an hour and then jumps when a nightly log rotates is judged by the jump — the worst case defines the axis, and the worst case stays hidden until you load the machine the way production will.

Budget the setpoint age before you commission #

Turn the axis tolerance into a number a measurement can be judged against. Three inputs set it: the drive's following-error window is the position error you allow; the fastest setpoint speed is how fast error builds while the drive runs on a late command; the task period is the best-case age of any command. The rule assumes the drive holds or extrapolates its previous setpoint while it waits; check your drive's interpolation behavior once, because a drive that halts on stale setpoints loosens the budget and one that extrapolates keeps it tight. From those inputs:

  • Allowed setpoint age = following-error window ÷ maximum setpoint speed.
  • Jitter budget = allowed setpoint age - task period.
  • Accept the axis when worst-case measured jitter under production load is at or under the jitter budget.

Worked example: one axis, one budget #

Illustrative inputs for this axis and this drive parameter — not universal cutoffs: cruise speed 300 mm/s, following-error window set to 1.0 mm, bus task period 2.0 ms.

  • Allowed setpoint age: 1.0 mm ÷ 300 mm/s = 0.00333 s = 3.33 ms.
  • Jitter budget: 3.33 ms - 2.0 ms = 1.33 ms.

Measured worst-case jitter under full workload comes in at 0.9 ms. Worst-case command age is then 2.0 + 0.9 = 2.9 ms against the 3.33 ms allowed, so the axis is accepted: 0.9 ms ≤ 1.33 ms. Retune the same axis to a 0.4 mm window at the same speed and the arithmetic ends it: 0.4 mm ÷ 300 mm/s = 1.33 ms allowed age, and 1.33 - 2.0 = -0.67 ms of budget — the task period alone already exceeds the allowed age, so no measurement can pass; the task must get faster, the axis slower, or the drive's window wider only if the machine tolerance truly allows it. At 150 mm/s with that 0.4 mm window the budget is 2.67 - 2.0 = 0.67 ms: achievable, but only if the re-measured worst case lands under it.

Measure the worst case, not the average #

Run the measurement the way the axis will live:

  • Record motion-task execution time and jitter with the machine idle, using the runtime's task monitoring and a trace of commanded versus actual position.
  • Repeat with the full expected workload running: visualization clients, OPC UA and Modbus traffic, logging, and the application's own background work.
  • Trace commanded and actual position through representative acceleration, constant velocity and deceleration, and note the worst following error the drive itself reports.
  • Judge by the worst case at production load — one late cycle that drives the error to the window edge defines the axis no matter how clean the average was.

Bring the moves in with the drive's stop path proven and the enable under your control, first at low speed with direction and scaling verified; a following-error trip at this stage is the protection doing its job, not a tuning artifact to widen.

If the measured worst case exceeds the budget, three fixes exist, in this order: configure the OS for real time (the RT preempt patch), remove or pin competing load away from the runtime, then derate the axis — lower speed, or a wider window backed by a real machine tolerance — re-measuring after every change, because a patched kernel changes the whole distribution and not just the mean.

Accept, fix, or move #

The measurement picks one of three outcomes:

  • Accept: worst-case jitter at or under budget with the production workload running, drive in the configured mode, command and feedback updating coherently, and no identity, topology or mapping diagnostics.
  • Fix: budget exceeded — apply the RT preempt kernel, tighten load discipline, derate, and re-measure.
  • Move: the application needs a window the platform cannot fill — coordinated camming, registered flying shears, tight windows at speed on a machine whose timing must be documented. Put that axis on a controller with guaranteed motion timing.

If you find you need only direct cyclic setpoint control without SoftMotion's planner, an EtherCAT servo setup on Raspberry Pi that skips SoftMotion documents that alternative route on the same hardware.

One last guard before signing the acceptance sheet: a quiet bus is a communication check, not a timing check, and even master diagnostics can under-report — the CODESYS EtherCAT master can hold its error flag false through a cable pull — which is exactly why the axis decision rests on the jitter measurement and the trace, not on any indicator.

Questions asked

Does the runtime keep running without a license?

No. CODESYS Control for Raspberry Pi SL is a licensed runtime; without a license it runs as a demo and stops after two hours of continuous operation, and restarting the service only starts another two-hour window. For a machine or test stand that has to run all day, license the runtime before commissioning so the axis is not dying mid-test.

How much jitter is too much for an axis?

The limit comes from the axis, not from a table. Divide the allowed position error by the fastest setpoint speed to get the allowed setpoint age, subtract the task period, and that remainder is your jitter budget. A 300 mm/s axis with a 1 mm following-error window and a 2 ms task gives a 1.33 ms budget; a 0.4 mm window at the same speed leaves nothing and needs a faster task, a slower axis, or a different controller.

Which servo drives work with SoftMotion over EtherCAT?

A drive qualifies when its manufacturer supplies an EtherCAT device description and the drive offers the cyclic synchronous mode SoftMotion commands — position, velocity or torque updated every bus cycle. The runtime's EtherCAT master support alone does not make an arbitrary servo compatible; check the drive's operating-mode list and supplied device description against your SoftMotion version before selecting hardware for the axis.

Should the runtime run as root for better timing?

No. CODESYS documents running its Linux-based SL runtimes under specific user rights rather than generic root access. Root privileges do not change how the scheduler treats the motion task, so they buy no timing, and they widen what a fault in the runtime can touch. The timing gains come from the kernel configuration, especially an RT preempt patch, and from cutting competing load.

Keep reading

  • Troubleshooting

    Troubleshooting S7-1200 PROFINET servo motion control issues

    Fix an S7-1200 PROFINET servo project in order: compile the motion calls in FB1 first, set drive and TIA Portal to the same telegram — Telegram 3 on this pairing — then prove one axis holds enable and velocity through repeated scans. A first-generation CPU 1214C executes independent single-axis motion only; the flying shear's deterministic master-slave cut belongs in the drives or in a motion-class controller, and no telegram adds it.

    Drives and motion

  • Troubleshooting

    Troubleshooting missing Drive Ready on a V60 axis retrofit

    S-rUn on the drive proves the enable reached it; it proves nothing about the return path. Hold the MC_Power enable TRUE for the whole test, then trace the drive-ready contact, its 24 V sense wiring, the PLC input channel and the tag mapping in that order. Local jog proves the motor and power stage, not the PLC interface.

    Drives and motion

  • Troubleshooting

    Why a Kinetix 5500 needs a motion-capable Logix controller

    A Kinetix 5500 servo drive used as a Logix integrated motion axis requires a motion-capable CompactLogix controller such as the 5069-L306ERM. A non-motion 5069-L306ER cannot add the drive to the module tree and is reported to read only some drive parameters over explicit messaging. Confirm the controller catalog number and the required axis count before troubleshooting anything else.

    Drives and motion