This tutorial outlines the steps necessary to configure and utilize the CODESYS PLC EtherCAT SoftMotion add-on with a device running ctrlX OS. SoftMotion is an add-on for SoftPLC systems that extends the functional scope from a purely logical controller to a motion controller.
1. Connecting necessary peripherals
Begin by connecting the necessary peripherals. These may include I/Os connected to an EtherCAT-compatible bus coupler or an EtherCAT-capable drive, such as the ctrlX Drive.
For example, a common configuration involves connecting the I/Os to the bus coupler using the built-in contacts, along with an additional ctrlX DRIVE connected to the bus coupler (shown below). Additionally, the I/O outputs can be linked to the inputs for signal verification, as detailed later in Step 5.2. This example will serve as the basis for the rest of the tutorial.
2. Assigning Required Licenses
Assign the necessary licenses to your ctrlX OS device. For this tutorial, you will need the following licenses:
ctrlX OS License - CODESYS - EtherCAT Master (add-on).
ctrlX OS License - CODESYS - SoftMotion 4 Axes.
ctrlX OS License - PLC Performance (02VRS+ / add-on) (or any other variant to run PLC applications).
3. Installing Required PLC Add-ons
Next, download the following add-ons from the Collaboration Room at Start > ctrlX AUTOMATION > ctrlX Store > CODESYS - PLC-Addons
:
CODESYS - EtherCAT.
CODESYS - SoftMotion.
Install them using the PLC-Add-on Installer within ctrlX PLC Engineering. Do note that you will have to enable temporary admin rights for this step.
Open
Tools→ Add-on installer
and run it in administrator mode.Close the PLC engineering app once the Add-on installer window is open.
Once you have installed the required add-on, restart the PLC engineering app.Â
4. Installing the Correct Slave Device Type
EtherCAT has a master-slave topology where the ctrlX OS device will be the master and the other I/O or drives will be the slaves. In this case, the ctrlX OS device is connected to a XB-EC-12
bus coupler with two I/O's coupled, and a single axis compact ctrlX DRIVE XCS-2.
Install the required device description files (Gerätebeschreibungsdatei in German) from the device repository within ctrlX PLC Engineering. This is done so that PLC engineering has access to the capabilities and configurations of the slave devices.
These device descriptors are in the form of .xml
files, and can be downloaded as a .zip
file containing all the set of descriptors needed for a device, or a family of devices. For reference, the links for the setup mentioned in this tutorial can be found here:
Device description files for ctrlX DRIVE:Â Collaboration rooms-AXS-V-05RS-Bosch_Rexroth_AG_crtlX_DRIVE_EtherCAT_SoEÂ
Device description files for ctrlX I/O and bus couplers: Collaboration rooms-ctrlX_IO_ESI-Files_1.22.1
In general, however, the appropriate slave device description files can be found within the Collaboration Room or using the Bosch Rexroth search (by searching for ctrlX DRIVE
or XB-EC-12
).
To install the device descriptors, open
Tools → Device Repository
and clickInstall
. Choose one or more.xml
files and clickInstall
again. Â
5. Configuring Devices in PLC Engineering
Create a new project in ctrlX PLC Engineering for your ctrlX OS device. It is recommended to start PLC Engineering using the WebUI of ctrlX OS so that the correct device type is automatically pre-configured.
Next, in the new project, right-click on the type/name of your device and click on Add device
. Add the EtherCAT Master SoftMotion
device from the list. This new device should allow all slave devices to be scanned and added automatically.
Following this, navigate to the EtherCAT_Task
and set task priority to 20 or any other valid value (it will complain if the value is invalid).
5.1 Scanning for Devices
In ctrlX PLC Engineering, navigate to the newly added EtherCAT master device.
Select the appropriate network interface based on its source MAC address (
eth1
,eth2
, etc..). The chosen network interface should correspond to the one to which the slaves are connected (the bus coupler in this case).Right-click and select
Scan for Devices
. You may be required to login to your ctrlX OS device with the username and password for this step.Once scanning is complete, the list of slaves on the EtherCAT bus will show up.
In the dialog box, copy all newly discovered devices to your project.
The entire process can be summarized as follows:
5.2 EtherCAT I/O Mapping
Assign EtherCAT I/O variables to PLC variables in the
EtherCAT I/O Mapping
tab (tutorial).Log-in to the device. Once you login, the new configuration and the PLC program will be downloaded to your ctrlX OS device. The EtherCAT communication will also be active and is indicated by the green recycle icons to the left side of the device:
Active EtherCAT communication shown in green Set the mapped output variables in the
EtherCAT I/O Mapping
tab toTRUE
, or useForce Write
for direct control:Change the values of mapped output variables To verify that an output is functioning correctly, the output of one I/O channel can be physically wired to the input of another channel within the I/O module. By doing this loopback wiring, one can monitor the corresponding input variable in PLC Engineering to confirm the signal is being transmitted and received correctly:
To make sure that I/O variables are consistently updated, even if they are not referenced in the PLC program, enable the
Always update variables
option inPLC Settings
.
5.3 Enabling SoftMotion for the Drive:
Right-click on the ctrlX OS device within ctrlX PLC Engineering and select
Enable SoftMotion
. This activates the SoftMotion functionality in your PLC project, allowing motion control commands (velocity, position, or torque control) to be handled directly within the PLC task cycle.Right-click the ctrl Drive device and select
Add SoftMotion SoE Axis
. This creates a new axis object linked to the Drive via SoE (Servo over EtherCAT) communication. The axis object acts as an interface between the PLC’s motion control function blocks (e.g., MC_Power, MC_MoveVelocity, MC_MoveAbsolute) and the physical drive hardware.Similar to the EtherCAT I/O variables in step 5.2, map ctrlX DRIVE variables and take control of the physical drive hardware. This step makes the drive’s control and feedback signals accessible in the PLC logic. Once mapped, you can use standard motion control function blocks to command and monitor the drive (enable the axis, move it to a defined position, or control its speed).
Important Considerations
Ensure compatibility between the ctrlX PLC Engineering version, EtherCAT slave devices, and SoftMotion libraries.
Consult the ctrlX OS documentation and device datasheets for detailed information on specific configuration parameters.
Properly configure task cycle times and priorities to ensure reliable real-time performance.