How-to
CODESYS PROFINET task priorities on a ctrlX CORE
Short answer
Set Profinet_IOTask to priority 30 and Profinet_CommunicationTask to priority 38, lower number first, then bind the PROFINET Ethernet port with the Browse dialog. The stack's default priorities fall outside the ctrlX CORE runtime's accepted range, and some release combinations block PROFINET entirely until the vendor fix is installed.
On this page
A PROFINET Device or Controller under a ctrlX CORE runs only when its two generated tasks sit at priorities the ctrlX CORE runtime accepts: set Profinet_IOTask to 30 and Profinet_CommunicationTask to 38, then bind the Ethernet port through the Browse dialog. The priorities the stack creates by default do not fit the ctrlX CORE scheduling scheme, and on some release combinations the PROFINET functionality was blocked pending a vendor fix, so check the release status before you tune anything.
For the license and package installation side of this setup, the steps live in the article on how to install and run CODESYS fieldbus add-ons in ctrlX; this article picks up at the task configuration. If your device never appears on the wire with an XF10 attached, the fault pattern is covered in the article on a ctrlX CORE PROFINET device not found with XF10 connected.
What a broken task configuration looks like #
The symptoms are consistent: the PROFINET node never reports running, I/O values stay at their defaults, and in CODESYS the task editor flags the generated priorities as outside the allowed range. Work through the layers in order, because each has a different fix:
- Packages cannot be installed or the device node cannot be added: a licensing or installation problem, not a project fault.
- Two new tasks reject their default priorities: the ctrlX CORE scheduling conflict, fixed by the values below.
- No interface selectable on the Ethernet device: the port was never bound while connected to the target.
- Everything configured and the device still idle: check whether your ctrlX CORE firmware and package releases predate the vendor fix that enables PROFINET Device/Controller use.
These are binding and scheduling faults in the CODESYS project. No tag or mapping change compensates for a stack whose tasks never run.
Setting the task priorities and binding the port #
- Obtain the CODESYS license that covers PROFINET and install the Ethernet and Profinet packages on the ctrlX CORE. Without the license the packages are not usable.
- Confirm your ctrlX CORE firmware and package releases carry the vendor fix enabling PROFINET Device/Controller use. On a release without it, stop here and update first.
- Add the Ethernet device under the ctrlX CORE PLC in the device tree.
- Add the PROFINET Device (IO device role) or PROFINET Controller (IO controller role) under the Ethernet device. CODESYS creates Profinet_IOTask and Profinet_CommunicationTask automatically.
- Open the task configuration and set Profinet_IOTask to priority 30 and Profinet_CommunicationTask to priority 38.
- While the project is connected to the ctrlX CORE, open the Ethernet device's interface selection and use the Browse dialog. It lists the interfaces available on that controller; select the one wired to the PROFINET network.
- Complete the station name, IP address, module configuration and I/O mapping, then download.
Keep your application logic in its own task and do not insert application tasks between or above the two stack tasks without a reason: starving the IO task delays cyclic data and can drop the connection. The Browse binding is tied to the target, so re-select the interface after moving a project to another ctrlX CORE.
Worked example: priorities for one controller and two application tasks #
Inputs: a ctrlX CORE project with one PROFINET Controller and two of your own cyclic tasks. The guidance published for this stack names 30 for Profinet_IOTask and 38 for Profinet_CommunicationTask as example values inside the ctrlX CORE range.
Rule: in CODESYS a lower priority number runs first, so the cyclic IO task must carry the lower number of the two stack tasks, and your application tasks must sit below both so they cannot delay the cyclic exchange.
Arithmetic: with the stack tasks at 30 and 38, your application tasks must have numbers greater than 38. Set the first application task to 40 and the second to 41. The scheduler then orders execution 30, 38, 40, 41: the cyclic I/O exchange runs first, stack communication second, your logic last.
Result: both stack tasks are inside the ctrlX CORE's accepted range, the IO task pre-empts the communication task, and no application task pre-empts either.
Decision: if your project has more than two application tasks, place every one of them above 38; if a task must sit above 30, move its logic so it cannot block the IO task, or it will drop the PROFINET connection under load.
Verification #
- Go online and open the task configuration monitor. Both stack tasks must show cycle activity with no exceeded-cycle or watchdog flags.
- The PROFINET node and its Ethernet device in the device tree must both report a running state.
- Run PROFINET discovery from another device on the same network and confirm the ctrlX CORE station name and IP appear.
- Toggle a mapped I/O value at the partner device and confirm the variable changes in the online view within one IO task cycle.
- Pull and reseat the PROFINET cable: the connection must drop and re-establish without a controller restart.
If the device still does not come up after these checks, the likely cause sits on the network side rather than in the project, and the receive-packet failure pattern in the article on PROFINET devices lost but still pingable in CODESYS V3 matches it closely.
Questions asked
Do the two PROFINET tasks need a program call in the second task?
No. Both tasks belong to the device-tree nodes that created them, and you should not rewire them to application code. Your program logic belongs in its own task at a priority below the two stack tasks. After download, confirm in the online task monitor that both stack tasks show cycle activity.
Why are 30 and 38 the recommended priorities?
The guidance published for the CODESYS PROFINET stack on ctrlX CORE names 30 for Profinet_IOTask and 38 for Profinet_CommunicationTask because the stack's default priorities do not fit the ctrlX CORE scheduling scheme. In CODESYS a lower number is a higher priority, so the cyclic IO task pre-empts the communication task.
How do I pick the Ethernet port for PROFINET on a ctrlX CORE?
Connect the project to the controller, open the Ethernet device's interface selection and use the Browse dialog. The dialog lists the interfaces available on that ctrlX CORE. Choose the one wired to the PROFINET network and avoid the port that carries your engineering access.
What if the PROFINET device still will not start after correct priorities and port binding?
Check the release status of the ctrlX CORE firmware and the installed CODESYS packages. There was a period when the PROFINET Device/Controller could not be used on the ctrlX CORE at all, pending a vendor fix. On a release without that fix, no task or port tuning brings the stack up; update before debugging further.