Overview
On a SIMATIC S7-1500 acting as a PROFINET IO controller, the application program frequently needs to confirm that the PROFINET IO connection (the AR – Application Relationship – to each configured IO device) is established, exchanging cyclic data, and free of diagnostic alarms before it performs write actions, recipe loads, or motion enable. The PLC exposes this information through three layers:
-
System state bits and standard status words in the process image (e.g.
%IW..status of the IO device). -
Diagnostic instructions provided by the S7-1500 firmware:
DeviceStatesandGetStationInfo. - Application-level life-bit handshaking implemented between the S7-1500 and the third-party PROFINET device over a freely usable slot.
This reference documents all three mechanisms in LAD/FBD, the relevant data types, return values, and the diagnostic LED meaning (RN/NS, ER/MS, MT/IO) on PROFINET stations, with practical examples for both Siemens and third-party IO devices (Universal Robots, Delta Motion, and similar).
Prerequisites
- S7-1500 CPU with PROFINET interface (any firmware from V2.0 onward;
DeviceStatesavailable from V1.8,GetStationInfofrom V2.0). - TIA Portal V14 SP1 or later (V16+ recommended for the latest diagnostic block versions).
- PROFINET IO device with a GSD file imported into the TIA Portal hardware catalog.
- The device must be assigned to a PROFINET IO system on the S7-1500 interface (e.g.
PN-IO X1/PN-IO X2). - For life-bit: at least 1 bit of input and 1 bit of output freely available in the IO device slot configuration.
PROFINET IO Architecture: What "Connection State" Actually Means
PROFINET IO is built on a real-time channel (RT or IRT) and an Application Relationship (AR) between the IO controller and each IO device. The connection state the application code sees is the AR state, and the device state. From the controller's point of view, an IO device moves through the following high-level states, which map to the values returned by DeviceStates and to the iOCR/iAR status reported in GetStationInfo:
| State | Meaning on the AR | What the PLC process image shows |
|---|---|---|
| Not connected / Not configured | IO device not in project, or AR not established (DCP discovery failed, name mismatch, etc.) | Inputs read 0 / outputs disabled; status word reports "not available" |
| Connected, no data exchange | AR established (CFP open) but provider/consumer CRs not active | Status bit = "connected, no IO data" |
| Connected, data exchange OK | All CRs in OPERATION, watchdog running | Status bit = "in data exchange" – this is the green state to gate writes on |
| Connected, station problem / diagnosis | AR still alive, but channel or module-level diagnostic present | Status bit = "station problem" – read GetStationInfo to identify the slot/channel |
| Disconnected / Failing | AR aborted or watchdog expired; PN-IO LED red on controller |
Inputs read 0; status bit = "device failed" |
The S7-1500 firmware provides dedicated instructions in the Diagnostics folder of the Instructions task card to read this state synchronously from the user program.
Method 1: Use DeviceStates (Recommended First Step)
DeviceStates returns the run/communicate/fault status of every PROFINET IO system, every PROFINET IO device, or every submodule of a given IO device. It is the simplest, fastest, and most idiomatic way to check connection state in LAD.
Block interface
| Parameter | Declaration | Type | Description |
|---|---|---|---|
MODE |
Input | INT | 1 = device state of all IO devices of the system; 2 = state of all submodules of one IO device; 3 = state of all IO systems |
LADDR |
Input | HW_IO (WORD) | Hardware identifier of the IO system, the IO device, or the head module (read from the device properties / system constants) |
RET_VAL |
Output | INT | Function return value (0 = OK, see error table below) |
STATE |
Output | ARRAY[*] of BOOL | State bits per device/submodule/system. Bit = 1 means the state applies. |
LAD example: read every PROFINET device on PN-IO X1
┌──────────── DeviceStates ────────────┐
│ MODE := 1 │ // 1 = per device
│ LADDR := "PN-IO_X1" │ // system constant from HW config
│ STATE := "dbDeviceState".state │ // ARRAY[0..127] of BOOL
│ RET_VAL => "dbDiag".retVal │
└──────────────────────────────────────┘
Meaning of the bits in STATE (MODE = 1)
| Bit offset | Name | Meaning |
|---|---|---|
| 0 | Device OK / in data exchange | The IO device is in cyclic data exchange with the controller. |
| 1 | Device failed | AR is not established or has failed (cable, name, watchdog). |
| 2 | Device has a diagnosis | AR is alive, but at least one channel/module carries a diagnostic alarm. |
| 3 | Device not available / not configured | Configured but not reachable, or not present in the project. |
| 4 | Device in data exchange but maintenance required | Maintenance demanded, AR still healthy. |
| 5 | Device is in commissioning / substitute | Substitute value mode active. |
| 6 to 31 | Reserved | — |
The bit indices map directly to the device number in the PROFINET IO system: device 0 → bit 0, device 1 → bit 1, etc. Use STATE[i] in LAD to gate downstream actions.
Typical RET_VAL errors for DeviceStates
| RET_VAL (hex) | Meaning | Remedy |
|---|---|---|
| 0000 | No error, state has been read | — |
| 80A1 | The specified hardware identifier does not exist or is not an IO system / device | Check the HW identifier of the system constant. |
| 80A2 | MODE is invalid | Use only 1, 2, or 3. |
| 80A3 | The array at STATE is too small | Provide an array of at least 128 BOOLs. |
| 80C3 | Internal resource bottleneck (firmware V2.0 and earlier) | Retry on the next OB1 cycle. |
LAD snippet: gate a write on "device 3 in data exchange"
"dbDeviceState".state[3] "dbLogic".bDevice3OK "dbLogic".bStartSequence
──────( )───────────────────( )──────────────────────────( )─────(S)
│
│ (one-shot enable)
Method 2: Use GetStationInfo for Detailed Diagnostics
When DeviceStates reports "diagnosis" or "maintenance required", you need to know which slot and channel is affected. GetStationInfo returns a structured PNIO_ALARM_DATA-style record and the slot / submodule status of one IO device.
Block interface (S7-1500 firmware V2.0+)
| Parameter | Declaration | Type | Description |
|---|---|---|---|
REQ |
Input | BOOL | Rising edge starts the read; the call may take several OB1 cycles. |
LADDR |
Input | HW_IO (WORD) | Hardware identifier of the head module of the IO device. |
MODE |
Input | INT | 1 = station info (slot status); 2 = module info; 4 = submodule info |
DONE |
Output | BOOL | Set when the read completed successfully. |
BUSY |
Output | BOOL | Set while the asynchronous read is in progress. |
ERROR |
Output | BOOL | Set if the read failed; see STATUS. |
STATUS |
Output | INT / DINT | Error / status code. |
INFO |
Output | VARIANT / STRUCT | Result structure – see below. |
The INFO output is a PLC data type (UDT) of family PNIO_… (e.g. PNIO_SLOT_INFO for MODE=1). Each entry includes a SlotNumber, a ChannelNumber, a Properties bit field, and a SlotErrorCode. The Properties bits contain flags such as:
- Bit 0: Module/Submodule is OK
- Bit 1: Module/Submodule has a diagnosis
- Bit 2: Module/Submodule has a problem (not reachable)
- Bit 3: Submodule is in maintenance state
- Bit 4: Submodule does not match the configuration
LAD example: read the slot information on a rising edge
bReqGetInfo "dbStInfo".busy "dbStInfo".done "dbStInfo".err
─────( )──────( )────(REQ)──────────────────(DONE)──────────(ERR)─── GetStationInfo
│ LADDR := "ThirdParty_Head" │
│ MODE := 1 │
│ INFO := "dbStInfo".slotInfo │
└──────────────────────────────────────┘
GetStationInfo may need multiple OB1 cycles. Drive it from a rising edge and evaluate BUSY, DONE, and ERROR rather than blocking on a single call. The S7-1500 also exposes the standard RD_SINFO, GetName (PROFINET device name), and GetDiag (legacy diagnostic buffer) for related tasks.Method 3: Application-Level Life-Bit Handshake
When the third-party PROFINET device has no GSD-level status word – or when the application wants a stronger guarantee than the AR is alive (e.g. "the device's application program is running") – implement a free cycle in the IO data:
- Reserve one input bit and one output bit in the slot configuration (e.g. slot 0 subslot 1, just a 1-bit module on each side).
- The PLC toggles
"dbLife".bOutevery 50 ms (use a 50 ms cyclic interrupt OB or a clock memory bit). - The third-party device mirrors the bit on its input back to the controller as
bIn. - The PLC confirms a connection is "live" when
bIn == bOut(t-D)for at least one full period.
LAD snippet
clk50ms "dbLife".bOut
───────( )────────────────────────────────( )
"dbLife".bOut "dbLife".bIn "dbLife".bConnOK
─────( )───────(==)──────────────────────────────────( S )
"dbLife".bConnOK (one-shot clear on next cycle)
──────────────────────────────────────────────────( R )
This method is independent of the PROFINET stack and detects situations where the AR is alive but the device's own application is hung, and it works with any vendor, including Universal Robots, third-party drives, vision systems, and Delta Motion controllers that expose a PROFINET IO channel.
PROFINET Status on the Third-Party Device Side
While the S7-1500 reports the AR state, the third-party device sees the same connection through its own PROFINET stack. A typical example is the Universal Robots UR3e / UR5e / UR10e / UR16e / UR20 / UR30, which exposes the PROFINET slot/channel state through URScript variables and through the Real-Time Data interface:
-
rtde_input.bit_registers.X– reflects the input word configured on slot 1, including any bit your PLC drives. - Diagnostic alarms from the UR's PROFINET stack surface in the robot's event log; from the PLC side, they appear as standard PROFINET channel diagnostics in
GetStationInfo.
For motion controllers such as the Delta Motion RMC series, a PROFINET controller state register is exposed to the user program. The Delta Motion RMC maintains a DINT register that holds the PROFINET controller state with the documented values 0 = Unknown, 1 = Run, and 2 = Program – mirroring the S7-1500's RUN / STOP transition. Treat this register as an additional application-level life bit in the application code of the controller, not as a substitute for the AR state inside the S7-1500.
Status and Error LEDs on PROFINET Stations
The physical link and the AR state are also visible on the LEDs of the PROFINET ports. The conventions for the standard Siemens nomenclature (used on ET 200, SCALANCE, and most third-party PROFINET stations) are:
| LED | Color | State | Meaning |
|---|---|---|---|
| RN / NS (Port LED) | — | off | No link / no connection |
| RN / NS | green | steady on | Connection established (LLDP), no data exchange yet |
| RN / NS | green | flashing | Connection with IO controller in cyclic data exchange (PROFINET normal operation) |
| ER / MS | red | flashing | Station fault – AR lost, watchdog, or name mismatch |
| ER / MS | red | steady on | Bus fault / no configuration / no partner |
| MT / IO | yellow | steady on | Maintenance required (e.g. channel diagnostic, mismatch) |
| MT / IO | yellow | flashing | Maintenance demanded |
The full table for the IM 157-1 MF (6ES7157-1MA00-0AB0) head module of the ET 200AL system applies to most distributed I/O with a PROFINET interface. For S7-1500 CPUs the LED PN-IO is on the PROFINET port; for the CPU 1515-2 PN, the X1 and X2 ports have their own RN / ER / MT LEDs.
Mapping of Common PROFINET Alarms to S7-1500 OB82 / OB83 / OB86 / OB122
The S7-1500 reports AR and module events through standard organization blocks. Map them to a unified buffer and to the HMI alarm view:
| PROFINET event | Triggering OB | Startup OB | Information source |
|---|---|---|---|
| Diagnosis of a module / channel (e.g. wire break on AI) | OB 82 | — | OB82_MDL_ID, GetStationInfo MODE 2/4 |
| Module inserted / removed (or submodule in slot) | OB 83 | — | OB83_MDL_ID, slot number, submodule identifier |
| IO device / station failure | OB 86 | — | OB86_MDL_ID, OB86_FLT_ID, OB86_IO_FLAG |
| IO access error (process image update failed) | OB 122 | — | OB122_MDL_ID, OB122_IO_FLAG |
| PROFINET system power-up / station restart | OB 100 | OB 100 (warm restart) | Startup information |
| PROFINET system inserted at runtime | OB 83 / 86 | OB 100 | Configuration change |
Use RALRM (read alarm) inside OB 82 / 83 / 86 to pull the structured PROFINET channel diagnostic and decode the channel properties / error type / error value. The decoded information is what populates the HMI diagnostic view and what to log if a recipe is interrupted.
Step-by-Step: Building a "PN-OK" Bit in LAD
- Open the S7-1500 device configuration in TIA Portal and confirm that the third-party device is in the same PROFINET IO system as the CPU's PROFINET interface. Note the system constant for the IO system (default name
PN-IO_X1). - Add a global DB
dbDiagwith:retVal : INT;,state : ARRAY[0..127] OF BOOL;,bPN_OK : BOOL;, and a clock memory byte if not already enabled. - Insert a DeviceStates instruction (Instructions > Diagnostics) in OB 1. Wire
MODE = 1,LADDR = "PN-IO_X1",STATE = dbDiag.state,RET_VAL => dbDiag.retVal. - Build a small OR/AND network that sets
dbDiag.bPN_OK= TRUE when all relevant bits indbDiag.stateare FALSE for "device failed" and FALSE for "diagnosis" and the "OK" bit is TRUE. - Use
dbDiag.bPN_OKas an interlock in front of any write that must not be sent while the AR is down. For belt-and-braces safety, AND it with the OB 86 status flag (slot present) and with the application-level life bit from Method 3. - Optional: in OB 86 (station failure), drive a one-shot pulse that triggers
GetStationInfoto capture the slot that dropped out, and store the offending slot in a retention DB for the maintenance engineer.
Verification Procedure
- Download the hardware configuration and the program to the S7-1500. Go online in TIA Portal.
- Open the device view of the third-party station and confirm the online state is green (cyclic data exchange). The PROFINET diagnostics entry in the inspector must show "OK" and no alarms.
- In the watch table, force
dbDiag.bPN_OK = 1only after a successful connect. Observe that downstream writes are enabled. - Disconnect the PROFINET cable of the third-party device. Within one to three update cycles (<= 30 ms at a 1 ms send clock),
dbDiag.state[<devNo>]bit 1 (device failed) must transition to TRUE anddbDiag.bPN_OKmust go FALSE. OB 86 must be called exactly once withOB86_FLT_ID = 1(station failure) on the rising edge, and again withOB86_FLT_ID = 0on the falling edge when the cable is reconnected. - Reconnect. Confirm OB 86 is called for the recovery, the "OK" bit in
statereturns, and the life-bit handshaking in Method 3 resumes within one period of the 50 ms toggle. - Force a slot-level fault (e.g. pull a sub-module of an ET 200 station) and verify OB 82 is called and
GetStationInforeturns the affected slot/channel.
Troubleshooting Matrix
| Symptom | Likely cause | Where to look | Fix |
|---|---|---|---|
DeviceStates RET_VAL = 80A1 |
Wrong LADDR | Device configuration > System constants | Use the IO-system constant (e.g. PN-IO_X1) for MODE 1/3 and the head-module constant for MODE 2. |
| State bit 3 always TRUE (device not available) | DCP name mismatch | Online > PROFINET device > Name assignment | Assign the configured PROFINET name to the device via Topology Editor or via the device's web interface. |
| State bit 1 (failed) toggles but bit 0 (OK) never sets | Watchdog or send-clock issue | Device properties > PROFINET interface > Send clock | Match the send clock on the device's GSD, and check for cable length and EMC. |
| State bit 2 (diagnosis) sets once, no OB 82 | OB 82 not loaded / not generated | Program blocks > OB 82 | Add OB 82 (Diagnostics Interrupt) and re-download. |
| OB 86 calls constantly, no LED red on the third-party device | Transient AR drop, switch port blocked | SCALANCE WBM or managed switch | Disable PROFINET priority tag blocking (DCP, LLDP) on intermediate switches; allow all MACs with PROFINET priority. |
| Life-bit from third-party device never toggles | Slot 0 subslot 1 not configured both ways | Device configuration of the GSD | Add 1-bit input and 1-bit output modules; the third-party firmware must copy the input bit to the output bit. |
GetStationInfo returns 0 entries after station recovery |
Call issued before data has been refilled | Inspect BUSY / DONE sequence |
Trigger on OB 86 recovery and wait for DONE before reading INFO. |
Programming Notes and Engineering Best Practices
- Call
DeviceStatesonly once per OB 1 cycle. The instruction is non-blocking and does not need an enable edge; calling it every cycle simply refreshes the state array. - For high-reliability applications, combine the AR state from
DeviceStateswith the slot-level slot 0 subslot 1 status fromGetStationInfo. Both can disagree briefly during an AR recovery: AR is back up but the channel diagnostics of the previous fault are still queued. - Use a PN-OK interlock rather than a PN-FAIL one. The default of a power-on state (FALSE on the "OK" bit) is the safe state – writes remain disabled until a confirmed "OK" is observed for at least one full cycle.
- Capture the last known good configuration in a retentive DB. If the AR is dropped due to a GSD change, the application can refuse to start until engineering confirms the change.
- Reserve PROFINET device names statically when the network is small. For larger installations, use a PROFINET naming tool or the device's web server to assign names on commissioning.
- Do not place the life-bit toggle in OB 1 with a one-second cycle; the controller's watchdog may already have failed the device before the next toggle. Use a 10–50 ms cycle from a cyclic interrupt OB (OB 30 to OB 38) or a clock memory bit.
Cross-Platform Notes
- On the S7-1200 (CPU 1211C through 1217C and 1214FC through 1215FC),
DeviceStatesandGetStationInfoare also available from firmware V4.2 onward. The block interface and the meaning of the state bits are identical to the S7-1500, with the same MODE values. - For an S7-300 / S7-400 PROFINET IO controller (e.g. CPU 315-2 PN/DP, CPU 416-3 PN/DP), use the older SFC 51 "SZL" reads (SZL ID W#16#0F31 / 0x0F32 / 0x0F33 / 0x0F34 / 0x0F39 / 0x0F3A) to obtain the same information. The numeric layout is identical: bit 0 = device OK, bit 1 = device failed, bit 2 = diagnosis, bit 3 = not available.
- For ET 200SP / ET 200AL / ET 200MP head modules the head module's HW identifier is what you pass to
GetStationInfoMODE 1; the IO system's HW identifier is what you pass toDeviceStatesMODE 1/3.
FAQ
What is the simplest way to check PROFINET connection state on a Siemens S7-1500 in LAD?
Use the DeviceStates instruction (Instructions > Diagnostics) with MODE = 1 and the IO-system hardware identifier (e.g. PN-IO_X1). When bit 0 of the returned STATE array is TRUE for a given device, the AR is established and in cyclic data exchange.
How do I read which slot or channel is faulty in a PROFINET IO device?
Call GetStationInfo with MODE = 1 on the head module's hardware identifier. The INFO output is a PNIO_… UDT containing the slot number, channel number, properties bit field, and slot error code for every slot of the device.
Can I detect a "PROFINET connection OK" signal with a third-party device that has no status word?
Yes. Reserve a 1-bit input and a 1-bit output in the slot configuration and implement a life-bit handshake: the PLC toggles the output every 50 ms, the device mirrors the bit on its input, and the PLC confirms the connection when the input follows the output for one full period.
What does the PROFINET LED on a Siemens distributed I/O mean during normal operation?
On Siemens distributed I/O (e.g. ET 200AL IM 157-1 MF, 6ES7157-1MA00-0AB0), a steadily green RN/NS LED means the PROFINET connection is established, a flashing green RN/NS LED means the station is in cyclic data exchange, a red ER/MS LED means a station fault, and a yellow MT/IO LED means maintenance required or demanded.
How does the third-party controller report the S7-1500's PROFINET controller state?
Many motion and robot controllers (e.g. Delta Motion RMC, Universal Robots UR-series) expose a controller state register – typically a DINT with values 0 = Unknown, 1 = Run, and 2 = Program – that mirrors the S7-1500's RUN/STOP transition. Use this as an application-level life bit in addition to the PLC's DeviceStates check.