Troubleshooting
Fix a Raspberry Pi PROFINET device not reachable in TIA Portal
Short answer
Discovery in TIA Portal's name-assignment dialog proves only that the Pi's link is visible. Reachability arrives when the CODESYS runtime lets the S7-1200 write the adapter address: set Adapter.0.EnableSetIpAndMask=1 under [SysSocket] in /etc/CODESYSControl_User.cfg, restart the runtime, and retry name assignment on a current runtime.
On this page
- Why does TIA Portal see the Raspberry Pi but call it unreachable?
- What do I check first, the runtime version or the log?
- How do I let the S7-1200 write the IP address to the Pi?
- Does the adapter name in the config file have to match the interface?
- How do I generate the GSD file for TIA Portal?
- What order do I retest in, and what proves the fix?
- What if the Pi is still unreachable after all that?
- Questions asked
Discovery and reachability are different tests. When the Raspberry Pi appears in TIA Portal's PROFINET name-assignment dialog while the S7-1200 reports it as not reachable, the cause on a CODESYS runtime is usually the address write, not the cabling: by default the runtime does not let the Siemens controller set the adapter's IP address and mask. The fix is two entries in /etc/CODESYSControl_User.cfg — [SysSocket] with Adapter.0.Name="eth0" and Adapter.0.EnableSetIpAndMask=1 — followed by a runtime restart, on a runtime version that is current. The sections below run the checks in fault-isolating order: log, version, config, retest.
Why does TIA Portal see the Raspberry Pi but call it unreachable? #
Because the two messages come from different protocol layers: the discovery list proves the Pi answers on the link, while the unreachable flag means the controller cannot complete PROFINET device name and address assignment with it.
The name-assignment dialog builds its list from discovery responses, which need only a working Ethernet link and a PROFINET-capable stack on the Pi. Assignment is a write operation: TIA Portal sends the device name and address configuration, and the S7-1200 then establishes the connection configured in the project. A device that appears in the list but fails the write has passed the link test and failed the configuration test, which points at the CODESYS runtime's handling of controller-driven address changes rather than at the cable or the GSD file.
In the reported case, reverting the configured name to its default changed nothing — expected, because the name field was not the blocked step. When CODESYS sits on the scanning side instead of the device side, CODESYS PROFINET device ID read errors in scans are the mirror-image symptom, with causes of their own.
What do I check first, the runtime version or the log? #
Record both before touching the configuration: the installed CODESYS development system and runtime versions, and the CODESYS PLC log entries from the failed attempts, because the log names the failing component and the version decides whether known behavior applies.
The runtime's PLC log records adapter and PROFINET events at startup and at each failed assignment attempt, and its lines tell you which component refused the operation. Another CODESYS-based controller, a ctrlX CORE running a CODESYS PROFINET device, logged the diagnosis "IP-Change not enabled on specified interface. Enable update of IP-address in *.cfg file" when this path was blocked; the exact wording on the Pi need not match, but a refusal of an address change is what to look for.
The version matters because the reported Pi case cleared after a runtime update, with several changes made in the same session, so the old runtime remains a probable cause rather than a proven one. Decision: record both versions, capture the log lines from one failed attempt, and update an outdated runtime before editing any configuration.
How do I let the S7-1200 write the IP address to the Pi? #
Add two entries to /etc/CODESYSControl_User.cfg so the runtime accepts the controller's write of address and mask: under [SysSocket], set Adapter.0.Name="eth0" and Adapter.0.EnableSetIpAndMask=1, then restart the runtime for them to take effect.
The CODESYS runtime configuration documents this path: the PROFINET stacks reach the network through a dedicated runtime interface to the adapter, and by default an external PROFINET controller is not allowed to change that adapter's IP parameters — the enable flag opens exactly that write. On the Raspberry Pi case behind this article, the working entries in /etc/CODESYSControl_User.cfg were:
[SysSocket]
Adapter.0.Name="eth0"
Adapter.0.EnableSetIpAndMask=1
Save the file and restart the runtime; the entries are read at startup, not live. Importing the GSD file into TIA Portal only gives the controller a description of the device — it does not open this write path, which is why a correct GSD and a failed assignment can coexist. Decision: this setting is required whenever the address is to come from the TIA Portal project rather than from the Pi's own configuration.
Does the adapter name in the config file have to match the interface? #
Yes — Adapter.0.Name must name the interface the PROFINET stack actually uses, so verify it against the Pi's own interface list before trusting a copied "eth0" value; on other controllers the same entry appears as "br1" or "ethX2" in their runtime config.
Documented examples from other CODESYS targets show the same entry under different names — Adapter.0.Name="br1" in one /etc/CODESYSControl.cfg discussion and "ethX2" on a WAGO PFC200 — which is the point: the file name and the interface name both belong to the specific target. Verify the Pi's actual interface name from the system itself.
A mismatch either opens the write path on the wrong adapter or leaves the stack bound to nothing, and both look identical from TIA Portal: discovered, unreachable. Decision: read the interface name from the device, never inherit it from an example.
How do I generate the GSD file for TIA Portal? #
Export the GSDML from the CODESYS development system's Tools menu and import it into TIA Portal's hardware catalog before the controller can even describe the Pi; a stale GSD that predates your project changes will describe a device that no longer matches.
The S7-1200 learns the Pi's module configuration only from the imported description, so regenerate and re-import the file after any change to the device's configured modules. In the reported case the GSD was generated and imported and the fault was still reachability, so the description file was not the blocker — a GSD problem hides the device from the project tree, an assignment problem shows the device and refuses the write.
Building the CODESYS side is its own task; editing a CODESYS Raspberry Pi PROFINET controller project covers that work when the Pi is the controller rather than the device. Decision: treat GSD faults and assignment faults as separate families, and fix the one your symptom actually shows.
What order do I retest in, and what proves the fix? #
Retest in this order — log, version, config, name assignment, reachability — and count the fix proven only when the name-assignment dialog completes without an error and the S7-1200 shows the device as reachable with cyclic data flowing.
- Record the CODESYS development system and runtime versions, and capture the PLC log lines from one failed assignment attempt.
- Update an outdated runtime, restart it, and run exactly one retest.
- Confirm the interface name on the Pi matches Adapter.0.Name.
- Add the [SysSocket] entries and restart the runtime.
- Retry PROFINET name assignment in TIA Portal and require it to complete — appearing in the dialog's list is not success.
- Re-check reachability from the S7-1200; if several changes landed together, back one out at a time until the single effective change is known.
Do all of this with the machine stopped: a device that loses its PROFINET connection mid-cycle takes its I/O data with it, and the controller reacts to the loss.
Worked example, with illustrative addresses. Suppose the TIA Portal project names the device and sets 192.168.0.30 with mask 255.255.255.0, while the S7-1200 interface sits at 192.168.0.1. Subnet test, device side: 192.168.0.30 AND 255.255.255.0 = 192.168.0.0. Controller side: 192.168.0.1 AND 255.255.255.0 = 192.168.0.0. Both hosts land on 192.168.0.0, so once the runtime accepts the write, nothing in the addressing blocks reachability. Now change only the project address to 192.168.1.30: 192.168.1.30 AND 255.255.255.0 = 192.168.1.0, which no longer equals the controller's 192.168.0.0. Assignment completes and the device still reads unreachable — that is a project addressing fault, not a runtime fault.
What if the Pi is still unreachable after all that? #
Then the remaining fault classes are addressing, duplicate names, and version-specific runtime behavior: run the subnet arithmetic above on the actual project values, confirm no other device answers to the same PROFINET name on the segment, and retest with one variable changed at a time.
If the name now assigns and the fault has moved to the cyclic connection — connect-parameter mismatches, I/O addressing — that is a different fault family from this one, and PROFINET connect errors between a controller and an S7-1200 covers it. Decision: a device that assigns its name but never exchanges cyclic data has left the reachability problem behind, and the investigation should move with it.
Questions asked
Does Adapter.0.EnableSetIpAndMask=1 override an address set in the Pi's operating system?
It allows the PROFINET controller to write address and subnet mask to the adapter named by Adapter.0.Name. Once assignment completes, the address in the TIA Portal project is what the interface carries for PROFINET traffic, and the runtime accepts later rewrites too. The entries apply only after a runtime restart.
Why does the config file name differ between controllers?
The Raspberry Pi runtime in this case reads /etc/CODESYSControl_User.cfg, while documented examples on other CODESYS targets put the same [SysSocket] entries in /etc/CODESYSControl.cfg, with interface names such as br1 or ethX2. The file name belongs to the specific runtime; confirm which one your installation reads before editing, then restart it.
Is an outdated runtime a confirmed cause of this fault?
No. The reported Raspberry Pi case cleared after a runtime update, but several changes were made in the same session, so the version was never isolated as the single cause. Treat the version check as a first diagnostic step and a reason to update, not as a guaranteed fix on its own.
Can I test reachability before assigning the name?
Ping the interface's current address from the engineering station to prove an IP-level path, but that is not a PROFINET test: name assignment is what writes the device name and address the S7-1200 will use. A successful ping with a failed assignment still points at the runtime address-write path.