Problem Description
A SIMATIC S7-300 or S7-400 controller is configured with redundant I/O at an ET 200M station using the Siemens REDIO library. After OB100 startup, the application code calls RED_IN (function block FB 451 in the standard REDIO V1.x library) and the block returns RET_VAL = 8004H (hexadecimal, decimal 32772) for the redundant input channel. Concurrent evaluation of RED_INIT in OB100 reports a return value of 1. The redundancy layer does not select between the two redundant input channels and the process image remains frozen or returns invalid data. This article documents the field-proven diagnostic path for that fault combination on ET 200M (6ES7 153-1AA03 / 6ES7 153-2BA02 / 6ES7 153-2BA10 / 6ES7 153-2BA22 IM 153-x heads) with SM 321 (6ES7 321-…) digital input and SM 322 (6ES7 322-…) digital output modules.
ET 200M I/O Redundancy Architecture
ET 200M supports channel-granular redundancy on the I/O level using two physically separated PROFIBUS-DP segments running into the same station. Each IM 153-x interface module terminates one PROFIBUS line; both IM 153-x heads are loaded with identical configuration. The user program sits on either an S7-300 (CPU 315-2 DP, CPU 317-2 DP/PN, CPU 319-3 PN/DP) or an S7-400 (CPU 41x, CPU 41xH, CPU 41xF/H) controller. The redundancy runtime is realized entirely in the REDIO library blocks, not in the CPU operating system.
| Building Block | Block Number | Call Location | Function |
|---|---|---|---|
| RED_INIT | FB 450 (FC 100 / FB 100 in some versions) | OB100 (warm restart / cold restart) | Initializes the redundancy data structures, validates the redundant partner module addresses |
| RED_IN | FB 451 / FC 101 | OB1 (cyclic) | Reads the redundant digital input pair and returns the value with status |
| RED_OUT | FB 452 / FC 102 | OB1 (cyclic) | Writes the redundant digital output pair and applies the value to both channels |
| RED_DIAG | FB 453 / FC 103 | OB1 / OB82 (diagnostic interrupt) | Reads per-channel diagnostic data from the partner module |
| RED_STATUS | FB 454 / FC 104 | OB1 | Returns the current redundancy status word |
| RED_DEPA | FC 105 / FB 455 | OB1 | De-energizes the partner channel after a sustained fault |
Two shared RED_IO data blocks (one for inputs, one for outputs) carry the channel mapping. The library expects the user to instantiate exactly one RED_IO DB per redundant pair and not to read or write the internal structure from user code.
Decoding RET_VAL 8004H from RED_IN
RET_VAL of RED_IN is a 16-bit WORD. The high byte (bits 15..8) contains the binary event source; the low byte (bits 7..0) carries the module-relative error index. The 8004H pattern is decoded as follows:
| RET_VAL (hex) | Decimal | Meaning per REDIO library manual |
|---|---|---|
| 0000H | 0 | No error; redundant channel healthy, value valid |
| 0001H–7FFFH | 1–32767 | Warning class; bit-relative status (e.g. 0001H = partner channel present but value differs, 0002H = passivation requested) |
| 8001H | 32769 | Module diagnostic pending; check RED_DIAG output structure |
| 8002H | 32770 | Channel fault on the active module; substitution value used |
| 8003H | 32771 | Wrong parameter assignment of one of the redundant modules |
| 8004H | 32772 | Channel temporarily unavailable / partner module reports a fault that is not yet diagnosed; the library cannot establish a healthy value and the input is frozen to the last valid value or a substitute value |
| 8005H | 32773 | External fault (wiring / sensor open circuit / short circuit) |
| 8006H | 32774 | No valid partner module found (e.g. wrong slot address) |
| 8007H | 32775 | Configuration mismatch (different module order numbers in the redundant pair) |
| 80FFH | 33023 | Internal library error; restart CPU required |
When RED_IN returns 8004H, the block has executed without raising a fatal error, but the returned input IN_VALUE is either the last good value or a configured substitute value. The partner module is reporting a condition that the library cannot classify — typically a transient diagnostic condition that has not yet been confirmed, or a partner module that is reachable over PROFIBUS but not yet configured for redundancy.
Decoding RED_INIT RET_VAL = 1 in OB100
The return value of RED_INIT is structured differently from the cyclic blocks. Possible values per the Siemens manual entry on FB 450 / FC 100:
| RET_VAL | Meaning |
|---|---|
| 0 | Initialization successful; redundant pairs established |
| 1 | Redundancy initialization not successful — one of the configured partner modules is not present at the configured logical base address, or the address list in the RED_IO DB is inconsistent with HW Config |
| 2 | One or more modules are not approved for redundancy (wrong order number / wrong firmware) |
| 3 | Internal pointer error in the RED_IO DB; re-import library |
| 4 | Library version mismatch between REDIO version on the master controller and the station |
A RET_VAL of 1 from RED_INIT is the root cause that cascades into the 8004H you observe on RED_IN: if the redundancy was not initialized, no healthy partner channel exists, so the cyclic block has no valid value to switch to and reports 8004H (partner temporarily unavailable). The two error codes are causally linked, not independent.
Root Cause Matrix
The following matrix maps the most common root causes observed in field service to the symptoms you would see in RED_INIT and RED_IN.
| Likely Root Cause | RED_INIT RET_VAL | RED_IN RET_VAL | Diagnostic Step |
|---|---|---|---|
| Partner module order number does not match the master module | 2 | 8004H / 8007H | HW Config → compare slots 0..7 of both IM 153-x heads |
| Module firmware mismatch between master and partner | 2 | 8004H | Online → accessible nodes → module information → firmware |
Logical base address of partner module differs from RED_IO DB |
1 | 8004H / 8006H | Cross-check RED_IO DB addresses against HW Config slot addresses |
| Module is a non-redundant type (e.g. SM 323) | 2 | 8004H | Replace with approved module — see compatibility list |
| PROFIBUS connector swapped (master and partner lines crossed) | 1 | 8004H | Physically verify which IM 153-x is on DP master system 1 vs 2 |
| IM 153-x is in head 1 (no redundancy) when head 2 is expected, or vice versa | 1 | 8004H | Set the rotary address switch correctly (1 = master, 2 = partner by convention) |
| Channel not in process image (assigned outside PI) | 1 (during init) | 8004H | HW Config → module properties → addresses must be in process image |
User program reads/writes the internal RED_IO DB fields |
1 or 3 | 8004H / 80FFH | Cross-reference search for the RED_IO DB name; remove any direct access |
| Module inserted in a slot that is not part of the redundant group | 1 | 8004H | Verify slot assignments per the approved pairing list |
| OB 70 / OB 82 / OB 86 not loaded | 0 (init OK) then later 8004H | 8004H | PLC → block folder → confirm OB70, OB82, OB86 present in S7 program |
Module Pairing Requirements (ET 200M)
Not every SM 321 / SM 322 module can be paired. The approved pairings — strictly enforced by the library — are listed in the Siemens ET 200M Redundancy manual. The most common pairings in service are:
| Module | Order Number | Function | Redundant Partner Order Number |
|---|---|---|---|
| SM 321 DI 16×24 V DC | 6ES7 321-1BH02-0AA0 | 16 DI, 24 V DC | 6ES7 321-1BH02-0AA0 (identical required) |
| SM 321 DI 32×24 V DC | 6ES7 321-1BL00-0AA0 | 32 DI, 24 V DC | 6ES7 321-1BL00-0AA0 |
| SM 322 DO 16×24 V DC / 0.5 A | 6ES7 322-1BH01-0AA0 | 16 DO | 6ES7 322-1BH01-0AA0 |
| SM 322 DO 8×24 V DC / 2 A | 6ES7 322-1BF01-0AA0 | 8 DO | 6ES7 322-1BF01-0AA0 |
| SM 322 DO 8×230 V AC / 2 A | 6ES7 322-1FF01-0AA0 | 8 DO relay | 6ES7 322-1FF01-0AA0 |
| SM 326 DI 8 / SM 326 DO 8 (F-modules) | 6ES7 326-1BK02-0AB0 / 6ES7 326-1RF01-0AB0 | F-DI / F-DO | Same order number, same firmware revision |
Modules that cannot be used in a redundant pair include SM 323 (combined DI/DO), SM 331 analog input, SM 332 analog output, SM 334, and SM 365 (the latter is the explicit non-redundant variant). If any of these are present in the redundant slot, RED_INIT returns 2 and RED_IN returns 8004H.
Step-by-Step Diagnostic Procedure
- Capture the snapshot. Connect STEP 7 to the CPU. Open Online → Accessible Nodes and read both PROFIBUS segments. Save the online view of the redundant station so you can compare against HW Config.
- Verify slot symmetry. In HW Config, open the station and confirm that every slot 0 through 7 in IM 153-x (head 1) has a counterpart slot in IM 153-x (head 2) with the same order number and the same input/output range. The slot indices must be identical in both heads.
- Verify base addresses are in the process image. For every module in the redundant group: Module Properties → Addresses. The Start address must be inside the process image (PI) range configured for OB1. The default PI size is 0; many users leave it at 0 which excludes I/O from OB1. Either increase the PI size in CPU properties or assign the redundant modules inside the configured PI.
-
Open the
RED_IOdata block and verify the channel map. TheRED_IODB contains one UDT entry per redundant channel with fields:CH_BASE_ADDR(input byte),CH_PARTNER_ADDR(partner input byte),CH_LEN(length in bits), andCH_FLAGS. EachCH_BASE_ADDRmust equal the configured start address of the master module; eachCH_PARTNER_ADDRmust equal the configured start address of the partner module. -
Confirm no user code touches the
RED_IODB. In STEP 7, use Options → Reference Data → Display and search for theRED_IODB number. Any read/write to its internal structure from user blocks other than the REDIO FBs is a violation and will corrupt the redundancy state machine. - Confirm OB70, OB82, OB86 are loaded. Without OB 70 (I/O redundancy error), OB 82 (diagnostic interrupt), and OB 86 (rack failure), the CPU cannot inform the library about module faults and the partner module will appear "temporarily unavailable." Load empty OBs as a minimum if the application does not use them.
-
Re-run a controlled restart. Perform a STOP → cold restart. Observe the
RED_INITreturn value in OB100. If it is still 1, the address map in theRED_IODB does not match HW Config — fix and re-run. -
After successful init, observe
RED_INcyclically. If 8004H persists with a healthy partner, escalate to a partner-channel diagnostic pull usingRED_DIAGand read the structuredDIAGoutput to identify which sub-condition is active (external fault, parameter error, etc.).
Hardware Wiring and PROFIBUS Configuration Checks
A software-only review is not sufficient. The 8004H / RED_INIT = 1 combination is often triggered by the partner module simply not being reachable on its PROFIBUS line:
- Confirm both IM 153-x heads have the same PROFIBUS address as configured (rotary switch on the IM). A common mistake is setting both heads to the same address; the master must be address N, the partner must be address N+1 (or per project-specific convention), and the addresses must not collide with any other node.
- Verify both PROFIBUS cables are terminated only at the ends of each segment, not in the middle. The IM 153-x has a switchable termination resistor that must be OFF except on the physical end nodes.
- Check the PROFIBUS diagnostics buffer of the CPU (via STEP 7 PLC → Diagnostic Buffer). Look for Station Failure events on the partner line. Bus errors on the partner line will surface as 8004H because the partner module becomes unreachable from the CPU's view.
- Confirm the partner IM 153-x is configured in HW Config under the same DP master system as the master IM 153-x, or under a separate DP master system tied to the same CPU. The library expects both heads to be reachable from the same CPU; a partner head on a different DP master system (e.g. on a different CPU) is not supported.
Programming Pattern for Robust Diagnostic Capture
Add the following STL snippet to OB1 to capture RED_IN return values and the active channel status into a flag word that can be read from the HMI. This makes intermittent 8004H events visible in the operator interface instead of disappearing into the cyclic scan.
// OB1 - cyclic segment
// Capture RED_IN return value per redundant channel
CALL FB 451 , DB RED_IN_DB1
IN_BASE_ADDR := 0 // base address of master DI module
IN_PRT_ADDR := 4 // base address of partner DI module
IN_LEN := 16 // number of bits (16 DI)
IN_VALUE := MW 100 // process image word
RET_VAL := MW 110 // RET_VAL from RED_IN
STATUS := MW 112 // current redundancy status
// Latch any non-zero RET_VAL for HMI display
L MW 110
L 0
<>I
JC LATCH
L MW 110
T MW 114 // last-error latched word
LATCH: NOP 0
When a non-zero RET_VAL appears, write MW 114 to a data word exposed on the HMI so the operator can see the last error code after the event has passed. Pair this with an SFC 51 "RDSYSST" call against SSL ID W#16#0131 to read the module diagnostic snapshot of the partner module at the moment of the event.
Verification After the Fix
- Force the partner module offline by removing its PROFIBUS connector.
RED_INmust return a warning (1..7FFFH) but not 8004H after a short transition (≤ 100 ms).RED_OUTmust continue to drive the master module. - Force the master module offline. The library must switch to the partner module and
RED_INmust continue to return the partner value with RET_VAL = 0 (or a warning code, not 8004H). - Reconnect both modules. After one full PROFIBUS reconfiguration cycle,
RED_INmust return to RET_VAL = 0 with both channels healthy. - Run OB100 cold restart 10 times consecutively.
RED_INITmust return 0 on every restart; any non-zero return indicates a residual address-map issue.
RED_DEPA, or schedule it for a maintenance window with the actuator safety chain bypassed per site procedure.Common Pitfalls
-
HW Config uploaded after a hardware swap changed the slot order. A technician replaced a module and inserted it in slot 3 instead of slot 2. The
RED_IODB still references slot 2. The library initializes but cannot reach the partner — RET_VAL 1. - Two different module order numbers were quoted on the purchase order. For example, a 6ES7 321-1BH01-0AA0 (16 DI) and a 6ES7 321-1BH02-0AA0 (16 DI, different firmware) are not a valid redundant pair even though the catalog description is similar.
- The CPU process image is configured to size 0. STEP 7 default for some older S7-300 CPUs is 0 input bytes / 0 output bytes. With PI size 0, the cyclic OB1 cannot read the inputs and the library initialization will fail.
-
STEP 7 version mismatch. The project was edited in STEP 7 V5.5 SP4 but the station was commissioned with a project exported from TIA Portal V13 with mixed-port PROFINET/PROFIBUS representation. The
RED_IODB layout differs. - Missing OBs after a full program download. The original project contained OB70, OB82, OB86. The new program was downloaded without the "Include system blocks" option, wiping them. The library cannot report diagnostic events, and any transient fault surfaces as 8004H.
Field-Proven Engineering Notes
In the field, the combination RED_INIT = 1 and RED_IN = 8004H is overwhelmingly caused by an address-map mismatch between the RED_IO DB and the actual module addresses. The library does not perform an explicit version or order-number check during the cyclic scan — it only performs it during RED_INIT. If RED_INIT returns 1, the library internally marks the partner channel as "temporarily unavailable" and the cyclic RED_IN then returns 8004H because that is the closest matching state it can express. Therefore the corrective action is to fix RED_INIT, not RED_IN.
For ET 200M stations, Siemens has shipped multiple REDIO library revisions (V1.0, V1.1, V1.2, V2.0, V2.1). The return value semantics are largely consistent across revisions, but the permissible module list has grown. If you are running an older revision and the module you intend to use is missing from the approved list, upgrade the library and re-import the RED_IO UDT to gain access to the new module types.
References to Official Documentation
For the complete list of approved module pairings, error-code semantics, and OB interactions, refer to the Siemens ET 200M Redundancy manual on the Siemens Industry Online Support portal: Siemens Industry Online Support. Search for entry ID 22613304 (REDIO library manual) and 18648552 (ET 200M system manual) for the authoritative source. The CPU-specific manual for the controller in use (e.g. S7-300 CPU 31x Technological Functions or S7-400 CPU 41x Manual) provides the process-image configuration details required to keep redundant modules inside the PI.
What does Siemens RED_IN RET_VAL 8004H mean in ET 200M redundancy?
8004H (decimal 32772) means the redundant partner channel is temporarily unavailable — typically because the partner module is reachable over PROFIBUS but reports a fault that is not yet diagnosed, or because the partner module address does not match the REDIO library's RED_IO data block. The library cannot establish a healthy partner value, so the input is frozen or replaced with a substitute value. Fix the upstream RED_INIT issue first, then re-check RED_IN.
Why does RED_INIT in OB100 return 1 with ET 200M redundant I/O?
RET_VAL = 1 from RED_INIT indicates that one of the configured partner modules is not present at the logical base address recorded in the RED_IO data block, or the address list in RED_IO is inconsistent with HW Config. Re-verify slot addresses in HW Config, ensure the master and partner modules use identical order numbers, and confirm the process image is large enough to cover the redundant I/O area.
Which SM 321 and SM 322 modules are approved for ET 200M I/O redundancy?
Only matching pairs of identical order numbers are approved. Common pairings are 6ES7 321-1BH02-0AA0 (16 DI), 6ES7 321-1BL00-0AA0 (32 DI), 6ES7 322-1BH01-0AA0 (16 DO), 6ES7 322-1BF01-0AA0 (8 DO), 6ES7 322-1FF01-0AA0 (8 DO relay), and the F-series equivalents 6ES7 326-1BK02-0AB0 / 6ES7 326-1RF01-0AB0. SM 323, SM 331/332/334 analog, and SM 365 are not approved for redundancy.
How can I make a transient 8004H visible to the operator on the HMI?
Latch the RED_IN RET_VAL in a flag word (for example MW 114) inside OB1 and expose that word to the HMI via a data block. Combine this with SFC 51 "RDSYSST" against SSL ID W#16#0131 to capture the module diagnostic snapshot at the moment of the event, so the operator can see both the error code and the partner-module diagnostic that triggered it.
Do I need OB70, OB82, and OB86 for ET 200M redundancy to work?
Yes. OB70 handles I/O redundancy errors, OB82 handles diagnostic interrupts, and OB86 handles rack/station failure. Without these OBs loaded in the S7 program, the CPU cannot forward module diagnostic events to the REDIO library, and any transient partner-module fault surfaces as 8004H in RED_IN. Load empty OBs as a minimum if the application logic does not require custom handling.