S7-400H ET200M Module Failure Detection via OB82, OB86, SFB54

David Krause16 min read
HMI ProgrammingSiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

In a SIMATIC S7-400H fault-tolerant system with PROFIBUS DP slaves (typically ET200M stations), the most common engineering question is how to identify which specific module in which DP station has failed, so that the user program can react selectively—for example stopping the CPU when a safety-relevant module fails while continuing operation if a non-critical module drops out. The standard organization blocks that fire on distributed I/O faults are OB82 (diagnostic interrupt), OB83 (insert/remove module interrupt), OB85 (priority-class error), and OB86 (rack or station failure). Each OB reports a different granularity of fault, and on a PROFIBUS DP slave the OB86 event by itself does not contain the failed slot number—it reports only that the slave (DP station) has failed or returned. To pinpoint the slot inside the station, the recommended approach is to combine OB86 with SFB54 RALRM (read interrupt status / additional interrupt information), which decodes the slot-level diagnostic frame delivered by the DP slave.

This reference documents the engineering pattern that resolves this question for S7-400H on STEP 7 V5.x and TIA Portal: how to enable diagnostic interrupts on ET200M modules, how to capture rack/station failure events in OB86, how to invoke SFB54 RALRM in the OB context to extract the DP station number and slot, and how to convert that information into a selective stop-or-continue decision in the user program.

Fault-tolerant caveat: In an S7-400H, the active CPU continues running on the partner CPU even if a single DP slave is lost, but the application-side decision (continue, ramp down, switch master) still needs to know which slot failed. The patterns below apply equally to a single CPU S7-400 and to either CPU of an H-system.

Prerequisites

  • SIMATIC S7-400 (or S7-400H) CPU, firmware V4 or higher recommended. OB82/OB83/OB86 are supported on every S7-400 CPU from the classic 414/416 family through the 41xH series. See the Siemens Industry Online Support entry SIMATIC S7-400H Fault-Tolerant Systems for the per-CPU OB support matrix.
  • STEP 7 V5.5 SP4 / SP5 or TIA Portal V13 or higher (V16/V17 recommended for current H-CPU firmware).
  • ET200M stations with IM 153-x (153-1, 153-2, 153-2BA00) interface modules. Diagnostic-capable signal modules (SM) must be installed: 6ES7 321 / 322 / 331 / 332 / 334 / 335 family analog and digital modules marked with "D" (diagnostic) capability, e.g. 6ES7 321-7RD00-0AB0, 6ES7 322-1BH01-0AA0, 6ES7 331-7KF02-0AB0.
  • PROFIBUS DP master system configured with the slave GSD file SIEM8010.GSD (ET200M) loaded in HW Config / device configuration.
  • STEP 7 / TIA Portal library block SFB54 RALRM (part of standard IEC library / system functions; available in every STEP 7 install without additional license).

Why OB86 Alone Is Not Enough for ET200M Slot Identification

OB86 fires when the CPU detects the loss (or restoration) of a rack in the central configuration, or of a DP station / PROFINET device in the distributed configuration. Per the official TIA Portal documentation Rack or Station Failure OB, the OB is called when the CPU detects failure or communication loss of a distributed rack or station. The OB start information gives the affected logical base address and the event type (failure / return / not available), but the data does not include the slot number of a single faulty module inside the slave.

If a single SM in slot 4 of an ET200M station reports a channel fault or module fault, OB86 may not fire at all—only OB82 fires, because the station itself is still reachable on PROFIBUS DP. If the entire IM153 loses power or bus, then OB86 fires but no slot-level information is available. To handle both the station-level and the module-level cases, you must enable diagnostic interrupts on the modules and use SFB54 RALRM inside OB82 and/or OB86.

Organization Block Selection Matrix

OB Trigger condition Granularity Provides slot? Recommended use
OB82 Diagnostic interrupt from a module (channel fault, module fault, wire break, etc.) Single module / channel Yes—via SFB54 RALRM TINFO slot field Detect which SM in which station generated the diagnostic
OB83 Insert/remove module interrupt (central rack only for S7-400 classic; PROFIBUS DP slot-0 plug/pull on IM153 from firmware V3 onward) Single slot Yes (central racks directly; DP via SFB54) Detect hot-swap events
OB85 Priority-class execution error (e.g. I/O access to a missing module without OB122) Process image update fault No slot, only base address Often disabled by adding OB85; not the primary diagnostic source
OB86 Rack / station failure or return (DP slave lost, central rack lost) Whole station or rack No slot—only DP station number / logical base address Detect station loss; combine with SFB54 RALRM if more detail needed
OB122 I/O access error when directly accessing a missing I/O Single access instruction Yes—OB122_MEM_ADDR gives the byte-level address Programming-time error trap; not suitable as runtime fault source
Field rule: Treat OB122 as a development-time safety net only. In production, every direct I/O access (L PIB / T PQW etc.) must be guarded by status checks first; relying on OB122 to catch missing modules means the CPU is constantly servicing access-error exceptions.

Enabling Diagnostic Interrupts on ET200M Modules

For OB82 to fire from an ET200M station, the diagnostic-capable SM must have the diagnostic interrupt enabled in the project, and the IM153 must support interrupt forwarding. Procedure in STEP 7 V5.x HW Config:

  1. Open the ET200M station, double-click the SM (e.g. AI8 6ES7 331-7KF02).
  2. In the dialog Properties – Diagnostics, check "Diagnostic Interrupt".
  3. Repeat for every diagnostic-capable SM that must report faults.
  4. Save & compile, then download the HW Config to the CPU.

In TIA Portal: Devices & Networks → ET200M → select SM → Properties → Diagnostics → "Enable diagnostic interrupt". Without this check, the module will set diagnostic bits but will not raise an interrupt to the CPU, so OB82 will not be called.

SFB54 RALRM Diagnostic Data Layout

SFB54 RALRM ("read additional interrupt information") takes the OB start event as the trigger and fills two output structures:

  • TINFO (Task Information) – 32 bytes. Identifies the source of the interrupt: OB header, the local or remote address, the PROFIBUS station number, the slot inside the station, and the IO flag (centrally inserted vs distributed).
  • AINFO (Additional Information) – variable length (up to the diagnostics frame size). Contains the raw channel-diagnostic record set, identical to what is normally shown in the module's online diagnostics view.

For PROFIBUS DP station-loss events passed to SFB54 RALRM from inside OB86, the relevant TINFO fields are:

TINFO byte(s) Meaning
0–7 Standard OB start info (event class, OB number, priority, etc.)
8–9 IO flag: 0 = central, 1 = distributed (PROFIBUS DP) or PROFINET IO
10–11 Logical base address of the module (if central) or of slot 0 of the station
12–13 PROFIBUS station number / PROFINET device ID
14–15 Slot number inside the station
16–17 Subslot (PROFINET only; 0 on PROFIBUS DP)
18–19 Channel number for channel diagnostics
20–25 Additional channel / manufacturer-specific diagnostic identifier
26–31 Reserved / varies by module
Byte offsets vary by firmware. The exact TINFO layout is documented in the STEP 7 online help under SFB54 – RALRM – output parameter TINFO. The slot is at byte offset 14 for PROFIBUS DP interrupts in the standard S7-400 firmware. Always cross-check against the CPU's System and Standard Functions reference manual before extracting these bytes in production code.

For an OB82 event coming from an ET200M SM, SFB54 RALRM returns the slot in TINFO bytes 14–15 and the channel in bytes 18–19. For an OB86 station-loss event, SFB54 RALRM returns the station number but the slot field typically contains 0, because the entire station—not a single module—is the failed object.

OB86 Programming Pattern

Below is a representative SCL implementation that runs inside OB86, reads the station-loss information, and invokes SFB54 RALRM to extract the station number and slot. The function compares the (station, slot) tuple against a configurable "critical" list and triggers a CPU stop via SFC46 "STP" if a match is found.

// OB86 sample – written for STEP 7 V5.x SCL
// Station-loss / return event handling
// Inputs from OB86 start info (local variables, declared by OB template)

VAR_TEMP
    tinfo      : ARRAY[0..31] OF BYTE;   // SFB54 TINFO buffer
    ainfo      : ARRAY[0..259] OF BYTE;  // SFB54 AINFO buffer
    ainfo_len  : INT;
    ret_val    : INT;
    station_no : INT;   // DP station (PROFIBUS address)
    slot_no    : INT;   // Slot inside ET200M
    is_loss    : BOOL;  // TRUE on coming event, FALSE on going event
END_VAR

BEGIN
    // OB86 EV_CLASS byte is OB86_LOCAL_INPUTS.Byte0
    // For coming events the high nibble is 0x39 (rack failure)
    // For going events the high nibble is 0x38
    is_loss := (OB86_EV_CLASS AND 16#0F) = 16#08;

    // Call SFB54 RALRM to decode the interrupt
    ret_val := RALRM(
        OB_NUM      := 86,                 // current OB
        MODE        := 1,                  // 1 = read all, do not acknowledge
        F_ID        := OB86_F_ID,          // master / IO system ID
        TINFO       := tinfo,
        AINFO       := ainfo,
        AINFO_LEN   := ainfo_len
    );

    IF ret_val = 0 THEN
        // TINFO bytes 12..13: PROFIBUS station number
        station_no := WORD_TO_INT(BYTE_TO_WORD(tinfo[13]) * 256
                                  + BYTE_TO_WORD(tinfo[12]));

        // TINFO bytes 14..15: slot number
        slot_no    := WORD_TO_INT(BYTE_TO_WORD(tinfo[15]) * 256
                                  + BYTE_TO_WORD(tinfo[14]));

        // Decision: stop the CPU only on selected (station, slot) tuples
        IF is_loss AND CriticalModuleLookup(station_no, slot_no) THEN
            SFC46(STOP := TRUE);   // CPU STOP, will require manual restart
        END_IF;
    END_IF;
END_ORGANIZATION_BLOCK

Place the matching logic in an FC or DB so that operators can edit the critical list without recompiling the OB. A typical DB layout:

DATA_BLOCK "CriticalModules"
  STRUCT
    Count : INT := 3;   // number of entries below
    Entry : ARRAY[1..16] OF STRUCT
        Station : INT;
        Slot    : INT;
    END_STRUCT;
END_DATA_BLOCK

// Example entries for the 8-station topology:
//   Station 6, Slot 5  -> safety-critical AI module
//   Station 2, Slot 8  -> redundant DI module (do NOT stop)
//   Station 6, Slot 4  -> power monitor DI (do NOT stop)

OB82 Programming Pattern

For SM-level diagnostic interrupts (channel wire break, over-range, module failure), OB82 is the entry point. The same SFB54 RALRM decode extracts the (station, slot) tuple and the channel number from AINFO bytes 6–7 (channel-diagnostic block per PROFIBUS DP standard).

// OB82 sample – SM diagnostic interrupt
VAR_TEMP
    tinfo       : ARRAY[0..31] OF BYTE;
    ainfo       : ARRAY[0..259] OF BYTE;
    ainfo_len   : INT;
    ret_val     : INT;
    station_no  : INT;
    slot_no     : INT;
    channel_no  : INT;
    is_coming   : BOOL;
END_VAR

BEGIN
    is_coming := (OB82_EV_CLASS AND 16#0F) = 16#07;  // coming event

    ret_val := RALRM(
        OB_NUM    := 82,
        MODE      := 1,
        F_ID      := OB82_F_ID,
        TINFO     := tinfo,
        AINFO     := ainfo,
        AINFO_LEN := ainfo_len
    );

    IF ret_val = 0 THEN
        station_no := WORD_TO_INT(BYTE_TO_WORD(tinfo[13]) * 256
                                  + BYTE_TO_WORD(tinfo[12]));
        slot_no    := WORD_TO_INT(BYTE_TO_WORD(tinfo[15]) * 256
                                  + BYTE_TO_WORD(tinfo[14]));
        // AINFO bytes 6..7 contain channel number for channel diagnostics
        IF ainfo_len > 7 THEN
            channel_no := WORD_TO_INT(BYTE_TO_WORD(ainfo[7]) * 256
                                      + BYTE_TO_WORD(ainfo[6]));
        END_IF;

        // Log to a diagnostic DB and optionally trip SFC46 STOP
        LogDiagEvent(station_no, slot_no, channel_no, is_coming);
        IF is_coming AND CriticalModuleLookup(station_no, slot_no) THEN
            SFC46(STOP := TRUE);
        END_IF;
    END_IF;
END_ORGANIZATION_BLOCK

Reading Module Slot from Rack/Slot Number

For ET200M, slot numbering follows the physical order: slot 1 = IM 153 (always present), slot 2 = first SM, slot 3 = next SM, up to slot 12 for a fully populated ET200M station. The slot number from TINFO bytes 14–15 therefore directly maps to the configured module in HW Config. To translate the slot into a symbolic name for HMI logging, build an array indexed by station number where each element contains the list of configured slot module names.

// Translate (station, slot) into a human-readable module tag for HMI
// Module names stored in DB "ModuleList".Station[station].Slot[slot]
FUNCTION "ResolveModuleName" : STRING
VAR_INPUT
    station : INT;
    slot    : INT;
END_VAR
BEGIN
    IF station > 0 AND station <= 8
       AND slot    > 0 AND slot    <= 12 THEN
        ResolveModuleName := "ModuleList".Station[station].Slot[slot].Name;
    ELSE
        ResolveModuleName := 'UNKNOWN';
    END_IF;
END_FUNCTION

OB122 Memory Address Decoding for Analog Modules

OB122 fires when a direct I/O access (L PIB, T PQW, etc.) targets an address that the CPU cannot currently reach (module missing, sub-module faulty, address not configured). OB122's local variable OB122_MEM_ADDR returns the byte address that triggered the fault. For an analog module occupying input bytes 512–527, an instruction L PIW 514 will populate OB122_MEM_ADDR with the byte address 514 (low byte of the word, not the word address). Important behavior:

  • OB122 is called once per failing direct-access instruction, on every scan that the instruction executes. There is no built-in debouncing.
  • If a process image is used (default) and the module is missing, the CPU does not call OB122 because the PI is updated via the implicit I/O access at cycle start; OB85 may fire instead.
  • For cyclic direct-access patterns, OB122 will be called continuously and starve higher-priority OBs if it contains heavy logic. Always keep OB122 minimal or empty.

For the user's stated requirement (decide stop / continue based on slot), the slot-level OB122 approach is fragile. Prefer the OB82/SFB54 RALRM route.

Selective CPU Stop Logic Implementation

SFC46 "STP" transitions the CPU into STOP at the end of the current OB execution. In an S7-400H, SFC46 on the master stops the master; the partner takes over. To implement the requirement "stop on station 6 slot 5, continue on station 2 slot 8":

  1. Maintain the critical list in a retentive DB so an operator can edit via HMI without reloading the program.
  2. In each diagnostic OB (82 / 86), after decoding the (station, slot) tuple, search the DB.
  3. If the tuple is in the list and the event is a coming event (fault, not return), call SFC46 with STOP = TRUE.
  4. On going events (return), do not call SFC46; reset any latched alarms in your alarm DB instead.

Avoid calling SFC46 from OB82 if you have a fast-cyclic diagnostic; one channel wire-break on a critical module would permanently stop the CPU on every scan. Use an edge-detect on the event class to fire SFC46 only on the first "coming" transition.

Safety systems: If the S7-400H is part of a SIL-rated application, do not implement the stop logic in standard OBs. Use a fail-safe CPU (CPU 41xF) and route the diagnostic through the F-runtime library (F-I/O DB, F-channel error OB) where the F-system owns the stop decision.

Verification and Commissioning Steps

  1. HW Config check: Every diagnostic-capable SM in the ET200M station must show "Diagnostic Interrupt: enabled" in HW Config. Compile and download the HW Config.
  2. OB presence: Confirm that OB82, OB83, OB86 (and optionally OB85, OB122) exist in the offline project. If OB82 is missing and a module tries to raise a diagnostic interrupt, the CPU will STOP. Add empty OB82 at minimum.
  3. Forced station fault test: With the CPU in RUN and a watched instance of the diagnostic DB open, power down one ET200M station. Verify that OB86 fires, SFB54 RALRM returns the correct PROFIBUS station number, and the (station, slot) decision routes to "continue" or "STOP" per the configured DB.
  4. Forced SM fault test: Disconnect one channel of an analog SM (open thermocouple wire on a 331-7KF02, for example). Verify that OB82 fires, TINFO bytes 14–15 give the slot of the affected SM, AINFO channel number matches, and the HMI alarm text shows the correct module name.
  5. Forced return test: Restore the module / station and verify that the "going" OB82/OB86 fires and no STOP is triggered.
  6. Partner CPU test (H-system): Repeat steps 3–5 on both CPUs of the S7-400H. After a partner take-over, verify the diagnostic logic still runs on the new master.
  7. Diagnostic DB retention: Mark the diagnostic DB as retentive (NV attribute) so the last fault state survives a CPU restart.

Field-Proven Caveats and Common Pitfalls

  • OB82 missing on diagnostic-capable module. If OB82 is not loaded, any incoming diagnostic interrupt stops the CPU. Symptom: CPU goes to STOP with diagnostic buffer entry "OB82 not loaded; OB not available".
  • Module diagnosed but interrupt disabled. The module sets diagnostic bits visible in the online diagnostics view, but no interrupt is raised. OB82 will never fire. Enable the checkbox in the module properties.
  • IM153 firmware too old. IM153-1 (6ES7 153-1AA03) and earlier do not forward diagnostic interrupts reliably. Use 6ES7 153-1AA04 or later, or IM153-2 (6ES7 153-2BA00 / -2BB00).
  • TINFO layout differences between DP and PN. PROFINET IO interrupts add subslot and device-id fields. Do not reuse a PROFIBUS DP byte layout on a PN IO station.
  • OB86 fired but slot field is zero. This is normal: station-loss events do not carry slot info. Use SFB54 RALRM in OB82 to get slot-level detail.
  • STOP triggered on every scan. If SFC46 is called in OB82 without edge detection, the CPU will STOP on the first fault. Always latch "first event" state per (station, slot) tuple and clear on the matching return event.
  • Using OB122 as the main diagnostic. OB122 is meant for development-time access-error trapping; in production it generates a continuous exception load. Replace with OB82 + SFB54 RALRM.
  • Retentive diagnostic DB not initialized. After a CPU restart the DB may contain stale (station, slot) values. Always initialize the DB in OB100 / startup before enabling diagnostic processing.
  • H-system partner takeover. After a master-master swap, the new master's OBs may re-execute the diagnostic logic. Make sure the (station, slot) decision does not fire SFC46 twice on the same physical fault.

Documentation References

When commissioning or auditing, point to the following official Siemens documents:

  • Rack or Station Failure OB (TIA Portal documentation) – describes OB86 trigger conditions and behavior.
  • SIMATIC S7-400H Fault-Tolerant Systems system manual (Siemens order number 6ES7 498-0AA00-0AB0 or current release) – lists OB support per CPU.
  • STEP 7 Professional – System and Standard Functions reference manual – documents SFB54 RALRM TINFO / AINFO layout.
  • ET200M Signal Modules for SIMATIC S7 manual – diagnostic-capable SM list and diagnostic-interrupt enabling procedure.
  • Siemens Industry Online Support entry "SFB54 RALRM – Diagnostic processing in the user program" on support.industry.siemens.com.

FAQ

Which OB tells me the slot of a failed module inside an ET200M station?

OB82 (diagnostic interrupt) is the only standard OB that, combined with SFB54 RALRM, returns the slot number (TINFO bytes 14–15) of a single faulty SM. OB86 reports the whole DP station, not the slot; use OB82 + SFB54 RALRM for slot-level diagnostics.

Do I need to enable the diagnostic interrupt on every ET200M module?

Yes. Without the "Diagnostic Interrupt" checkbox in the SM properties (HW Config or TIA Portal device configuration), the module will set internal diagnostic bits but will not raise an interrupt, so OB82 never fires. Verify the checkbox on every diagnostic-capable SM.

Can I rely on OB122 to detect a missing module?

OB122 reports I/O access errors at the byte address (OB122_MEM_ADDR) but is intended for development-time error trapping, not as a runtime diagnostic source. For runtime diagnostics use OB82 with SFB54 RALRM, which returns the station and slot without continuous exception load.

Why does SFC46 STOP fire on every scan instead of once?

Calling SFC46 in OB82 without edge detection triggers STOP on the first event and then again on every subsequent OB82 call for the same fault. Latch a "first event" flag per (station, slot) tuple and clear it on the matching return event so SFC46 only fires on the coming transition.

Does this pattern work on both CPUs of an S7-400H?

Yes. Each CPU of the H-system loads and executes OB82 / OB86 independently. After a master-master swap, the new master will re-execute the diagnostic logic; debounce the (station, slot) decision to avoid triggering SFC46 twice on the same physical fault.

My IM153 is old; does it forward diagnostic interrupts?

IM153-1AA03 and earlier have known limitations forwarding diagnostic interrupts. Use IM153-1AA04 or later, or IM153-2 (6ES7 153-2BA00 / -2BB00), to guarantee OB82 events are delivered.

Where exactly is the slot number inside the SFB54 RALRM TINFO buffer?

For PROFIBUS DP interrupts on an S7-400 CPU, the slot number is at TINFO bytes 14–15 (low-byte-first) and the PROFIBUS station number is at bytes 12–13. Confirm against the CPU's System and Standard Functions manual because the layout is firmware-dependent.

Back to blog