Problem Summary
When commissioning a Siemens SIMATIC S7-300 software redundancy (SWR) pair built around two CPU 319-3 PN/DP modules (MLFB 6ES7318-3EL01-0AB0, firmware V2.6.x and V3.2.x), the standby CPU transitions to STOP and the SF (System Fault) LED illuminates immediately after the FB104 "SWR_START" call inside OB100 finishes its first run. The CPU diagnostic buffer shows two stacked events:
-
Event ID 16#4562 – STOP caused by programming error (OB not loaded or not possible, or no FRB). Breakpoint in user program is reported as cyclic program (
OB1), priority class 1, FB number 104, module address 62. Previous operating mode RUN, requested operating mode STOP (internal). -
Event ID 16#2523 – Area length error when writing. The fault occurs on an instance DB with double-word (DWORD) access at byte offset 284. The
OB121programming error OB is not loaded, so the CPU cannot recover and goes to STOP.
When an empty OB121 (a single NOP 0) is added to suppress the stop, a cascade of further area length errors appears at instance DB offsets 284, 288, 290, 292, and 294. Deleting the offending DB makes the CPU report "DB 284 not found" instead – the program will not run.
The root cause is a misconfiguration of the IEC timer instance DB window inside the OB100 startup block, not a fault inside the protected FB104 library code itself. The errors at addresses 284/288/290/292/294 are the visible signature of the CPU walking through an IEC timer block structure that does not exist in the loaded project.
Affected Hardware, Firmware, and Software
| Component | Identifier | Notes |
|---|---|---|
| CPU (primary) | 6ES7318-3EL01-0AB0 | CPU 319-3 PN/DP, 2 MB work memory code, 1.4 MB data |
| CPU (standby) | 6ES7318-3EL01-0AB0 | Identical MLFB required for SWR |
| Firmware | V2.6.x / V3.2.x | SW-Redundancy library V1.x is compatible with both |
| STEP 7 | V5.5 + SP4 / HF7 | SWR library installed from S7SWR_Vxx disk |
| SWR library | S7SWRED (STEP 7 Add-On) | Includes FB101/FB104/FB105, FC100, UDTs for the redundancy interface |
| Redundancy link | MPI, PROFIBUS, or Industrial Ethernet | Selection controlled by FB101 "SWR_AG_CN" configuration |
The S7-300/S7-400 Software Redundancy System Manual (entry ID 1136393) is the authoritative reference for the architecture described here. The CPU hardware reference is the S7-300 Module Data Manual (entry ID 12996906).
Diagnostic Buffer Decode
| Event ID | Meaning | Trigger in this case | Action |
|---|---|---|---|
| 16#4562 | Programming-error STOP. The CPU tried to execute a block and either the OB for the error class was missing, or the called block does not exist as loaded. | FB104 attempts to write a DWORD into a non-existent instance DB; OB121 is not present, so the CPU escalates to STOP per default reaction. | Load OB121 (or fix the underlying cause so OB121 is not needed). |
| 16#2523 | Area length error on write. A pointer or symbolic operand addresses a location that does not exist inside the destination area. | FB104 walks the IEC timer instance DB window starting at IEC_NO for IEC_LEN DBs. When the window does not match the IEC timer configuration in OB1, the offset 284 (and the surrounding 288/290/292/294) corresponds to the S5TIME/BOOL control fields of the IEC TP/TO/TON/TOF/TONR FB internal structure. |
Reconcile the OB100 window with the IEC timer DBs actually generated by the compiler. |
Root Cause: OB100 IEC Timer Window Mismatch
The OB100 startup OB must call FB104 "SWR_START" with two parameters that control an internal watchdog for the IEC timer instance DB window:
-
IEC_NO– DB number of the first IEC timer instance DB. -
IEC_LEN– total length (count) of the IEC timer instance DB window.
During cold restart the CPU walks the DBs from IEC_NO through IEC_NO + IEC_LEN - 1 and validates that each one is a valid IEC timer instance. If IEC_NO = 201 and IEC_LEN = 113, the expected window is DB201 … DB313. If the user program actually contains 112 IEC timer calls starting at DB111, the loaded project only contains DB111 … DB222, and the CPU validates the wrong range.
The result is a sequence of area length errors as FB104 attempts to read and write into the IEC timer block header at the offsets used by the STEP 7 IEC timer compiler. For an IEC_TP/IEC_TON/IEC_TOF/IEC_TONR instance the offsets around 280–296 contain the timing parameters (PT, ET, IN, Q, the time-base byte, and the edge-detection flags). The CPU raises one 16#2523 event per DWORD it tries to write into a missing instance. The exact offsets 284, 288, 290, 292, 294 are the signature of FB104 walking through the missing TP instance header at the upper end of the window.
Why Adding OB121 Makes It Worse
Once OB121 is present, the CPU no longer escalates to STOP at the first 16#2523. FB104 continues to execute and continues to attempt the next DWORD write, which fails in the next instance DB. The five cascading events at 284/288/290/292/294 are the five DWORD fields the FB tries to clear on a single missing instance. OB121 does not fix the cause – it only converts a hard STOP into a hard SF with a flooded diagnostic buffer and a corrupt data image.
Software Redundancy Library Architecture
| Block | Name | Used in | Purpose |
|---|---|---|---|
| FB101 | SWR_AG_CN | OB35 / OB1 | Controller-controller link supervision. Holds the AG (PG/OP) connection DBs and the partner CPU handle. |
| FB104 | SWR_START | OB100 (once) | Initializes the SWR subsystem, validates the IEC timer DB window, and arms the standby role. |
| FB105 | SWR_DIAG | OB1 / OB82 | Optional diagnostic block; read by SFC 51 "RDSYSST" with SSL ID 0x0131 / 0x0132 for SWR status. |
| FC100 | SWR_AG_COM | Called by FB101/FB104 | Encapsulates the AG_SEND/AG_RECV pairs on the redundancy link. |
| DB WORK | SWR_WORK | Background | Working DB for FB101; size depends on the number of mirrored DBs. |
| DB SEND/RECV | SWR_AG_SEND / SWR_AG_RECV | Background | Per connection, 12 bytes each by default. |
Reference: S7-300/S7-400 Software Redundancy – System Manual, section 4 ("Configuring the Redundancy Interface") and section 5 ("Startup Behavior and Warm Restart").
Step-by-Step Resolution Procedure
-
Capture the current OB100. In STEP 7 (SIMATIC Manager), expand S7 Program > Blocks > System Data and double-click
OB100. Switch the editor to STL view (View > STL) to see the FB104 call in full. -
Record the current values. Note the actual parameters passed to
FB104 "SWR_START"forIEC_NOandIEC_LEN. Typical bad configuration:IEC_NO := 201,IEC_LEN := 113, expected window DB201..DB313. - Locate the IEC timer DB window actually generated by your project. Open Options > Cross Reference, filter for FB number of the IEC timer FBs (1=TP, 2=TON, 3=TOF, 4=TONR for S7-300; FB 5..8 in the IEC library with instance DB prefix). Sort the result by DB number. The lowest and highest instance DB numbers define the real window.
- Compare the two windows. If STEP 7 reports instance DBs in the range DB111..DB222, but FB104 is configured for DB201..DB313, you have a 90-DB overlap and a 90-DB gap. This is the symptom that produces offsets 284/288/290/292/294 in the diagnostic buffer.
-
Choose one of two correction paths.
-
Correct the OB100 parameters. Edit the FB104 call in
OB100and changeIEC_NOandIEC_LENto match the real window. For 112 timers starting at DB111, setIEC_NO := 111,IEC_LEN := 112. Re-compile and re-download both CPUs. -
Correct the project to match the OB100 window. Re-number the IEC timer DBs to start at DB201 and reserve DB201..DB313, then re-generate the instance DBs (right-click the FB, Instance DB > Generate). Keep
OB100parameters unchanged.
-
Correct the OB100 parameters. Edit the FB104 call in
- Generate all instance DBs. Open the STEP 7 block container and confirm that every DB in the window exists. The cleanest method is Options > Check Block Consistency, then Program > Compile All (SW). STEP 7 will warn you about any missing instance DB in the IEC timer window.
-
Verify the OB121 is removed or disabled. After fixing the window, the original fault is gone and
OB121is no longer invoked. If you created a stubOB121during diagnosis, delete it (or leave the singleNOP 0) so future programming errors still trigger a clean STOP. -
Re-download the project to both CPUs in STOP mode, then perform a cold restart (
MRESor power cycle). The CPU must initialize the SWR window fromOB100on a cold restart, not on a warm restart.
Verification Procedure
- Power both CPUs. After PASS to RUN, the standby CPU should reach
RUN-Solowith the SF LED off. The active CPU reachesRUN-Redundant. - Open the online Module Information (PLC > Module Information or Accessible Nodes) on the standby CPU. The Operating Mode tab should report
RUN (SWR standby). The Diagnostic Buffer must contain no 16#2523 or 16#4562 events from the OB100 run. - Force a switchover: in SIMATIC Manager, use PLC > Operating Mode > Switch Over on the active CPU, or pull the PROFIBUS/MPI cable on the active CPU. The standby CPU must take over within the configured switchover time (typically 100–500 ms; default 100 ms with one mirror cycle).
- Check the
SWR_DIAGstatus word. SSL ID0x0131index 0 returns the current SWR state machine:0 = SWR disabled,1 = Solo,2 = Primary,3 = Backup,4 = Primary-failed,5 = Backup-failed. Confirm both CPUs can occupy state 2 and 3 on a forced toggle. - Inspect the data image. After the switchover, the values of all mirrored DBs on the new active CPU must equal the last good values from the old active CPU. If you see a corruption pattern, you most likely still have a DB in the window that is not an instance DB – re-run Check Block Consistency.
Common Pitfalls and Field-Tested Caveats
- IEC timer FBs are 1, 2, 3, 4 on the S7-300, not 0..3. FBs 0..3 are the S5-compatible TP/TON/TOF/TONR; FBs 1..4 in the IEC library are the S7-300 IEC variants. Mixing the two will produce instance DBs of the wrong length and trip the 16#2523 at the same offsets (284/288/290/292/294).
- Watch the DB number range limit. The CPU 319-3 PN/DP supports DB 0..16000 as data blocks, but STEP 7 will refuse to generate instance DBs that overlap the system DBs (DB 0..15 are reserved for SFCs/SFBs). Pick a window that does not collide.
-
OB100 only runs on cold restart. A warm restart skips the SWR initialization. If you cycle only the standby CPU while the active CPU is running, the standby must execute a full cold restart for the window to be revalidated. Use
MRESto force a cold restart if you are uncertain. - OB121 is not a free pass. It converts programming errors from a CPU stop into a logged event and a corrupt image. Use it only as a diagnostic aid, never as a permanent solution.
-
FB104 is protected. The block ships in the SWR library as a know-how protected block. You cannot open it, so the only way to see what window it is checking is the parameter list at the
OB100call site. The diagnostic buffer always shows "FB 104" as the source of the area length error – that is the FB104 timer window validation, not a logic bug inside FB104. -
Renumbering DBs after download corrupts the project. If you change
IEC_NOinOB100without re-numbering the IEC timer calls, the FB still reads the old DBs but FB104 now points to a window where the instance DBs do not exist. Always regenerate the instance DBs after re-numbering.
PLCSIM Limitations for Software Redundancy
PLCSIM does not simulate the S7 communication primitives that the SWR library depends on (AG_SEND / AG_RECV via SFC 216/SFC 217, plus the PROFIBUS FDL or ISO-on-TCP for the redundancy link). You will see diagnostic events 16#8013 ("Connection being established") and 16#8015 ("Connection cannot be established") on a stand-alone PLCSIM instance even when the project is correct. Always validate SWR projects on the real hardware pair. The only test that PLCSIM can substitute is the FB104 cold-restart path – the IEC timer window validation runs in OB100 before any communication is opened, so a stop on PLCSIM with the same diagnostic buffer signature is a valid signal that the window mismatch exists.
Redundancy Link Selection
| Link type | Configuration block | Connection resource | Recommended use |
|---|---|---|---|
| MPI | FB101, MPI address 2/3 | Built-in MPI port | Only for very small programs, not for production |
| PROFIBUS | FB101, DP master, FDL connection | DP port of the CPU | Classic S7-300 SWR wiring; up to 12 Mbps |
| Industrial Ethernet (ISO on TCP) | FB101, CP 343-1 Lean / CP 343-1 / built-in PN port | ISO-on-TCP port 500 | Recommended for new projects; switchover under 100 ms |
Reference: S7-300/S7-400 Software Redundancy – System Manual, chapter 4.3 ("Redundancy Link").
Related Event IDs in the Same Fault Class
| Event ID | Meaning | Likely companion of 16#4562? |
|---|---|---|
| 16#2521 | Area length error when reading | Yes – read of the same IEC timer offset |
| 16#2522 | Area length error when writing a byte | Yes – walks through the IEC timer instance header |
| 16#2523 | Area length error when writing a double-word | Yes – the original event in the source dump |
| 16#2524 | Area length error when reading a bit | Sometimes – caused by BOOL in the timer struct |
| 16#2530 | DB number error | Yes – when the entire DB is missing, not just the offset |
| 16#2531 | DB is not an instance DB but the FB expects one | Yes – the same root cause if the DB was created as a shared DB |
| 16#4562 | Programming error STOP | The headline event |
| 16#4570 | STOP due to OB not loaded (general) | Yes – if OB121 was missing and the area length error is unhandled |
| 16#8013 | Connection being established (S7 communication) | Related but separate; PLCSIM-only artifact |
| 16#8015 | Connection cannot be established | Related; check the redundancy cable/port |
Reference: S7-300 CPU 31x – Diagnostic Buffer Event IDs (entry ID 109751589) and the S7-300 CPU 31xC and CPU 31x – Operating Instructions (entry ID 44240604).
Preventive Configuration Checklist
- Before generating the first instance DB, decide the IEC timer DB window. Pick a starting DB number that does not collide with the redundancy working DBs (typically DB 100+).
- In every FB call to
SWR_START(i.e. inOB100), setIEC_NOto that starting number andIEC_LENto the exact number of timer calls in the program plus a 5–10 % margin for future growth. - Document the window in the project header. STEP 7 does not warn you when a new IEC timer call falls outside the window – it silently creates the instance DB anyway, and FB104 will reject it on the next cold restart.
- Re-run Check Block Consistency before every download. STEP 7 will not always catch a window mismatch in a single-block compile, but the full consistency check will surface any missing instance DB.
- Use the
SWR_DIAGblock to publish the SWR state to a HMI tag. This is the fastest way to detect a partial switchover failure caused by a stale window. - Test on the real hardware pair. PLCSIM will mask the real fault and surface only the secondary symptoms (16#8013 / 16#8015) once the IEC timer window is wrong.
FAQ
What does Event ID 16#4562 mean on a CPU 319-3 PN/DP in software redundancy?
Event 16#4562 is "STOP caused by programming error – OB not loaded or not possible, or no FRB". In an SWR project the most common cause is the FB104 IEC timer window validation failing inside OB100, leaving the CPU no programming-error OB to call (OB121 is missing) and forcing a STOP. Load OB121 as a diagnostic, but fix the OB100 IEC_NO/IEC_LEN parameters to remove the cause.
Why do offsets 284, 288, 290, 292, 294 appear in the diagnostic buffer?
These are the DWORD-aligned offsets of the IEC timer FB instance header (PT, ET, IN, Q and the time-base byte) for an IEC_TP/IEC_TON/IEC_TOF/IEC_TONR block on the S7-300. When FB104 walks a window in which the last instance DB is missing, the CPU raises one 16#2523 area-length error per DWORD write it tries to perform on the absent instance.
How do I size the IEC_NO and IEC_LEN parameters of FB104 in OB100?
Set IEC_NO to the lowest instance DB number of any IEC timer call in the program, and set IEC_LEN to the total count of IEC timer calls (one instance DB per call). Leave 5–10 % margin for future growth. For 112 IEC timers starting at DB111 the correct values are IEC_NO := 111, IEC_LEN := 112.
Can S7-300 software redundancy be tested on PLCSIM?
PLCSIM does not simulate the S7 communication primitives that the SWR library uses, so the redundancy link will report 16#8013 / 16#8015 indefinitely. The only part that PLCSIM can validate is the OB100 cold-restart path – the IEC timer window check runs before communication is opened, so a STOP with the same 16#4562 / 16#2523 events on PLCSIM is a valid signal that the window is misconfigured.
Which redundancy link should I use on CPU 319-3 PN/DP – MPI, PROFIBUS, or Ethernet?
For new projects use Industrial Ethernet with ISO-on-TCP (port 500) on the built-in PN port or on a CP 343-1. PROFIBUS is the classic choice and still supported. MPI is only suitable for very small programs and is not recommended for production. The choice is configured in FB101 "SWR_AG_CN"; see section 4.3 of the S7-300/S7-400 Software Redundancy System Manual.