1. Symptom Summary
A Sinumerik 840D PL integrated PLC drops to STOP the moment OB 100 finishes its first pass. The diagnostic buffer lists two back-to-back incoming events: 16#4562 ("STOP caused by programming error") at startup OB 100, and 16#2522 ("Area length error when reading, Global DB, word access, Access address: 62") pointing at a global data block whose length cannot satisfy a 16-bit read at byte offset 62.
Loading the PLC archive (ARC) of the Sinumerik project restores operation, but the next cold or warm restart re-introduces the same pair — sometimes on the first power-up, sometimes on the second. An NCU swap and a Simodrive line-module swap have been performed without effect, which already exonerates the hardware. Treat those swaps as the diagnostic that proves the root cause is software, not hardware.
2. Affected Sinumerik 840D Hardware and Firmware
The pattern has been observed on the classic 840D PL line and on early 840D sl systems where the PLC slot still hosts an integrated SIMATIC S7-300 CPU. Refer to the Sinumerik 840D sl product page for the NCU-to-CPU mapping and to the SIMATIC S7-300 product page for the underlying PLC platform.
| Component | Common part numbers | Notes |
|---|---|---|
| NCU box (classic 840D PL) | 6FC5 357, 6FC5 446 (840D sl NCU 561.x / 571.x / 572.x / 573.x) | Integrated PLC; battery-backed RAM on the NCU module. |
| PLC CPU inside the NCU | SIMATIC CPU 314, CPU 315-2 DP, CPU 317-2 DP | STEP 7 V5.x project required for engineering. |
| Simodrive 611D / Sinamics S120 | 6SN11..., 6SL3... | Power section does not load the PLC user program; replacement cannot fix a STOP caused by OB 100. |
| Firmware | NCU SW 4.x / 5.x / 6.x | Behaviour is reproducible across builds; fix is in the user program. |
| STEP 7 toolchain | STEP 7 V5.4 SP5 / V5.5 SP4 / V5.6 | Diagnostic buffer "Open Faulty Block" feature requires V5.4 SP3 or newer. |
3. Decoding the Diagnostic Buffer — Event 16#4562 and 16#2522
The two events are causally linked. 16#2522 is the cause; 16#4562 is the consequence. Reading them in the order they appear in the buffer matters: the CPU logs the underlying access error first, then logs the STOP that the access error triggered.
| Event ID | STEP 7 "Event text" field | What the CPU is reporting | Role in this fault |
|---|---|---|---|
| 16#4562 | STOP caused by programming error (OB not loaded or not possible, or no FRB) | CPU entered STOP autonomously because the operating system could not invoke a programming-error OB. | Consequence — the machine has now stopped. |
| 16#2522 | Area length error when reading — Global DB, word access, Access address: 62 | The instruction at the breakpoint tried to read a 16-bit word at byte offset 62 of a global data block that is shorter than 64 bytes. | Cause — the instruction that broke things. |
The priority class 27 that the diagnostic buffer reports for the 16#4562 entry is the standard S7 priority assigned to OB 100 (startup). The "Module address: 14" is the slot of the integrated PLC inside the NCU; on a classic 840D this is the slot of the internal S7-300 CPU.
The 5 supplementary words that follow each event in the raw diagnostic buffer (e.g. FF84 8E70 1B64 0001 000E for 16#4562, FE79 0024 003E 0000 0000 for 16#2522) are an event-type-specific payload. Their layout is documented in the STEP 7 V5.x online help under "Diagnostic buffer — supplementary information" and varies by event class. The reliable way to interpret them is not to decode them by hand but to click Open Block in the diagnostic buffer dialog and let STEP 7 jump to the failing instruction.
4. Byte Offset 62 vs DB Number: The Most Common Misdiagnosis
The single most common misdiagnosis of this exact pair is to read "Access address: 62" as the DB number, conclude that DB 62 is missing, and go looking for it. The S7 diagnostic buffer does not put the DB number in the access-address field. The DB number is recovered from the absolute operand of the failing instruction — the operand the "Open Block" jump highlights.
| Misread | Correct reading |
|---|---|
| "DB 62 does not exist" | The instruction tried to read byte 62 of some DB. The DB number is found by opening the block that the diagnostic buffer points to and reading the absolute operand. |
| "Restore DB 62 from the ARC" | Restoring DB 62 may still help, but only if FB 1 / OB 100 / the tool-change FB in question really opens DB 62 as its working data block. |
| "Replace the NCU again" | Hardware swap is irrelevant once a clean, identical diagnostic pair reproduces after the swap. |
Concretely, the "Access address: 62" string in the human-readable diagnostic buffer view is the byte offset inside the data block the failing instruction was reading. The number "62" is the offset, not the DB number. To find the real DB number, click the "Open Block" or "Open Faulty Block" button in the STEP 7 V5.x diagnostic buffer dialog. The editor will jump to the instruction that caused the fault and show the absolute operand — for example DB17.DBW62 or a fully symbolic equivalent such as "ToolData".Magazine[2].Position. The DB number is the number that precedes the dot in the absolute operand; the 62 is the byte offset within that DB.
5. Root Cause Analysis — Seven Reasons a Startup Fault Is Intermittent
The pattern "first or second time after power-up, then OK for hours" points to a small, repeating set of causes on 840D PL hardware. Ranked by frequency in the field:
- Non-retentive data block sized to zero on first restart. The instance DB of a tool-change FB is declared with a length that the FB only resizes at first RUN. If OB 100 runs before the first normal cycle has had a chance to populate the DB, the word access at offset 62 falls off the end of the DB.
- Re-entrancy of OB 100. Some older tool-magazine FBs re-enter themselves through a call chain that crosses OB 100 and OB 1. On the first cold start the FC called from OB 100 is still being initialised; on a warm restart it has already been initialised, and the same code path is safe.
- Battery-low on the NCU. When the lithium cell inside the NCU module is below its warning threshold, the CPU drops a few bytes of retentive memory at the moment of the first power-down. The instance DB returns from battery as garbage, the FB reads past the end, and the next STOP writes the DB back as "empty". A second start, with the FB's startup code now able to run to completion, recovers the DB.
- STEP 7 project vs. PLC archive (ARC) mismatch. The S7 project on the PG and the archive that gets re-loaded from HMI may carry different versions of the same FB. The "load ARC works" symptom means the ARC version of the FB is correct; the project version is not, or vice versa. Whichever is loaded second wins, and the next restart is what you measure.
- Symbolic vs. absolute access on a renamed data block. If the FB was written with symbolic access and the symbol file was regenerated, the compiler may pack the UDT differently and the access lands at byte 62 of the new layout, which is past the end of the old runtime DB.
- Watchdog / scan-time race in the first OB 1 cycle. A watchdog FB that truncates the DB on timeout can race against the tool-magazine FB on the first cycle. Replacing the watchdog with a one-shot flag set in OB 100 fixes it.
- Corrupted MMC / PC card image on sl systems. For 840D sl NCUs, the PLC project lives on the CF card. A bad-block remap on the first mount can hand the S7 runtime a truncated DBW for one cycle only.
Items 1, 2, 4 and 5 are the ones that match "first time or second time, then OK for hours". Item 3 is the most common hidden cause on machines that have been in service for several years. To rule item 3 in or out, read the diagnostic buffer's battery and buffer-status entries (event class 4, event IDs 0x4301 / 0x43FF) before doing anything else.
6. Hardware and Memory Pre-Checks
Before changing a single byte of code, run a 10-minute hardware pass. The user in the source case had already replaced the NCU and the Simodrive line module, so most of this list is fast to execute.
- NCU battery voltage. On classic 840D the battery is a 3.6 V lithium cell. Open HMI menu Commissioning > NC > Battery status; replace the cell when the HMI shows the red battery icon, regardless of what the diagnostic buffer says.
- RAM / FEPROM / PC card consistency. From STEP 7, go PLC > Diagnostics/Settings > Module Information > Diagnostic Buffer and read the most recent 0x4301 "Buffer status" entries. Look for a 0x43FF "Battery exhausted" or 0x4303 "Retentive data lost" event. Either one points to item 3 in the list above.
- MMC / CF card health (sl systems). Use Commissioning > NC > MMC > Check to run a sector test. A red "CRC error" or "Sectors bad" line means the project image is suspect — re-flash the CF card from a known-good backup before debugging the application code.
- PLC operating-mode switch. Put the CPU in STOP for 30 s, then back to RUN and observe whether the 16#2522 reappears. If it does, the FB in question is unconditionally run from OB 100 and the access violation is structural, not a power-up race.
- PROFIBUS / PROFINET slave presence. If FB 1 happens to call a PUT/GET to an I/O slave that has not yet come up at startup, the area-length error can be reported against the slave's I/O area. Open HW Config, compare the configured and actual slot lists, and bring any newly added slave online.
7. STEP 7 V5.x Recovery Procedure — Step by Step
Recovery has two layers: a fast path that gets the machine back into production, and a permanent fix that removes the cause. The fast path is "load the ARC". The permanent fix is what the next sections describe.
- Open STEP 7 V5.x with the project that matches the machine. Confirm the CPU type and firmware version in HW Config > PLC > Properties > Diagnostic/Clock match the nameplate on the NCU.
- Establish Online > Accessible Nodes and read the actual S7 program out of the PLC into the offline project: PLC > Upload Station to PG. Do not trust the offline project until it matches what the CPU is actually running.
- Open PLC > Diagnostics/Settings > Module Information. The 16#4562 / 16#2522 pair will be the most recent incoming event.
- Click Open Block (or "Open Faulty Block") on the 16#2522 entry. STEP 7 jumps to the instruction that read past the end of the DB.
- Note the absolute operand. It will look like
DBW 62of a specific DB — record both the DB number and the offset. - Right-click the DB in the project tree and choose Object Properties > Length. Confirm whether the DB has at least 64 bytes (offsets 0–63). If the length is 60 or less, the read is structural and the access is wrong.
- Choose the path from section 8 or 9 below depending on whether the DB exists.
- Compile the S7 program, download only the changed blocks (never the whole project during a hot commissioning unless the safety integration is verified), and perform the restart sequence in section 11.
For the screenshot-by-screenshot navigation of the diagnostic buffer, refer to the Siemens Industry Online Support portal and search for "diagnostic buffer S7-300 V5.5". For the OB 100 / OB 1 / OB 100 reset rules that 840D-specific tool-magazine FBs expect, refer to the Sinumerik 840D sl PLC Programming Manual in the same portal.
8. Case A — The DB Exists but Is Too Short
If the DB is present in the project and on the CPU, the fix is to extend it.
- Open the DB in the LAD/FBD/ST editor.
- Open View > Data View (or press
F9if you have a numeric keypad). Confirm the byte count in the status bar. - Either add a new variable of at least 2 bytes starting at offset 62, or extend an existing UDT so that byte 62 falls inside a real field.
- Save and recompile. The DB length must change in the compiled output. STEP 7 will warn "DB length changed" the first time you download — acknowledge only if the change has been reviewed.
A robust STL pattern to add a length guard in OB 100 is:
// OB 100 — restart
L DBW 62 // suspect word read
T "ToolData".FieldCheck // 1-shot flag, set in OB100, cleared in OB1 cycle 1
L 0
T DBW 62 // clear the field on every cold restart
SET
R "ToolData".FaultPending
This pattern does not fix the original UDT problem, but it bounds the damage: OB 100 clears the suspect area on every cold restart and lifts the flag, so the first OB 1 cycle that reads it cannot read past the end.
9. Case B — The DB Is Missing Entirely
If the "Open Block" jump points to a DB that is not in the project (e.g. DB 17 was renamed, or DB 62 was renamed in the latest compile and the PG was not refreshed), the fix is to restore the DB before the FB that opens it is downloaded.
- Search the project for the source UDT or the data block the FB was written against. Look in the Sources folder and in the Master copies folder — they often carry the original version.
- If the source is not on the PG, extract it from the PLC archive. From the HMI, Commissioning > PLC > Archive > Unpack writes the project into a known directory;
S7ARC.EXEcan be used to extract the SDB and the blocks. - Recompile the FB against the restored DB. Confirm the absolute operand now points inside the DB (byte 62 is reachable).
- Download the DB first, then the FB. Order matters: if the FB is downloaded before the DB, OB 100 will execute against the old, missing DB and re-trigger the STOP.
10. Adding OB 121 to Suppress the PLC STOP
The S7 operating system only forces a STOP if the error OB is missing, disabled, or cannot be started. Adding OB 121 is not a fix for the area length error itself, but it is the single most effective measure to keep the machine running while the root cause is being diagnosed. Most production 840D installations already have OB 121 / OB 122 loaded by the machine builder for exactly this reason; a retrofit machine may not.
Create a minimal OB 121:
// OB 121 — Programming error
// Temporary local variables:
// OB121_RESERVED_1, OB121_RESERVED_2, OB121_RESERVED_3
// OB121_BLOCK_TYPE, OB121_BLOCK_NUMBER, OB121_BLK_ADDINFO
L #OB121_BLOCK_TYPE
L W#16#000A // 0x0A = global DB
==I
JC DBX
L #OB121_BLOCK_TYPE
L W#16#0005 // 0x05 = instance DB
==I
JC DBX
JU EXIT
DBX: L #OB121_BLK_ADDINFO
SRW 16 // top 16 bits of the additional info word
T "System".FaultedDB
L #OB121_BLK_ADDINFO
T "System".FaultedByteOffset
SET
S "System".ProgramErrorFlag
EXIT: BE
The block captures the DB number and the byte offset that caused the violation, latches a system flag, and returns. With OB 121 in place, the same byte 62 read that previously stopped the PLC will now only set a flag, and the operator can be informed via the HMI without taking the spindle out of cut.
Repeat for OB 122 (I/O access error) and OB 80 (time error) on the same principle. The 840D tool-magazine FBs do not generate OB 80 / OB 121 under normal conditions, so the addition is purely defensive and cannot mask a real safety fault.
11. Verifying the Fix and Restoring the PLC Archive
After the change is compiled and downloaded, run a structured restart cycle and observe the diagnostic buffer for any 16#2522 / 16#4562 entry.
- Cold restart (NCU power-down for at least 30 s, then power-up). Confirm the HMI shows the operator screen within 60 s, the PLC is in RUN, and the diagnostic buffer has no 16#2522 entry.
- Warm restart (PLC STOP / RUN toggle from STEP 7 or the HMI). Same checks.
- Hot restart (simulated by triggering the warm-restart path during a part program). Same checks. This is the case where the fault was most likely to appear in the original report.
- Power cycle at least 5 times in a row. The intermittent symptom can be statistical; one or two passes are not enough.
- Run a tool-change cycle. If FB 1 is part of the tool-change code path, a 20-call cycle exercises it more than an hour of normal cutting.
- Once the fix is stable, save the corrected S7 project to the ARC on the HMI and to a versioned backup on the engineering server.
12. Related Diagnostic Event IDs and Preventive Maintenance
The 16#4562 / 16#2522 pair is one of a small family of OB-100-induced STOPs. The table below lists the siblings that an 840D PL commissioning engineer will eventually see.
| Event ID | Meaning | Typical cause on 840D PL | First action |
|---|---|---|---|
| 16#2521 | Area length error, area not available | DB missing entirely | Check that the DB was downloaded |
| 16#2522 | Area length error, read | DB too short for the access in OB 100 / FB 1 | Open Faulty Block; check DB length |
| 16#2523 | Area length error, write | Same as above, write path | Same; check the write instruction |
| 16#2524 | Area length error, bit access | Bool field overflow in a UDT | UDT review |
| 16#2525 | Area length error, byte access | Byte access past DB end | Same as 16#2522 |
| 16#2526 | Area length error, double word | DWORD access past DB end | Confirm DB length and 4-byte alignment |
| 16#4562 | STOP, programming error | OB 121 missing / disabled / not startable | Add OB 121; fix the underlying cause |
| 16#4563 | STOP, I/O access error | OB 122 missing / disabled | Add OB 122; check slave status |
| 16#4301 | Buffer status change | Diagnostic buffer wraparound, battery change | Read the new battery / reset info |
| 16#43FF | Battery exhausted | NCU battery end-of-life | Replace battery; reload retentive DBs |
Use this preventive checklist on every 840D PL that is being commissioned, retrofitted, or coming out of a long storage period:
- Replace the NCU battery before any firmware upgrade, regardless of the voltage reading.
- Confirm that OB 100, OB 1, OB 82, OB 121, OB 122 are present in the project, downloaded, and consistent across the PG and the CPU.
- Compile the S7 project with the "Length check" option enabled in the customiser.
- Document every DB length in a spreadsheet, and review it whenever a UDT is changed.
- Add a one-line comment in OB 100 with the date and author of the last change, so that the next engineer can see the version path.
- Run the 5-power-cycle test in section 11 before signing off.
- Save the project to the ARC after every approved change; verify the HMI can reload it from Commissioning > PLC > Archive > Restore.
For the broader preventive practices, refer to the Sinumerik 840D sl product documentation on the Sinumerik 840D sl product page and the SIMATIC S7-300 system manual on the SIMATIC S7-300 product page. Use the Siemens Industry Online Support portal to search for "OB 121", "OB 100", and "diagnostic buffer" against your specific NCU part number.
What does Event ID 16#4562 mean on a Sinumerik 840D PLC?
It is the S7-300/400 entry "STOP caused by programming error (OB not loaded or not possible, or no FRB)". It is the consequence event; the actual cause is a separate entry, almost always a 16#252x area-length error. Without OB 121 loaded, the S7 operating system turns the violation into a STOP.
Is "62" the DB number in the diagnostic buffer, or the byte offset?
It is the byte offset inside the data block that the failing instruction was reading. The "62" comes from the "Access address" field of the 16#2522 entry, which is the offset within the DB, not the DB number. The DB number has to be recovered by clicking "Open Block" in the diagnostic buffer and reading the absolute operand that STEP 7 highlights (e.g. DB17.DBW62).
The machine runs after loading the ARC but goes to STOP after the next power cycle — what now?
The ARC is healthy but the S7 project on the PG is not, or vice versa. Upload the running program from the CPU back to the PG, compare it block by block with the project, and identify the FB/DB mismatch. In the case described, the failing read at byte 62 of a global DB is the structural defect; fix the DB length or the access and add OB 121 so that the next error does not stop the spindle.
Do I really need to replace the NCU again?
No. The user in the original report had already replaced the NCU and the Simodrive line module without effect. Once the diagnostic pair reproduces across an NCU swap, the hardware is exonerated. Continue swapping modules only if a new diagnostic signature appears, not the same one.
Why is the fault intermittent — sometimes on the first power-up, sometimes on the second?
It is almost always a non-retentive or partially-retentive DB that is sized or populated during the first RUN cycle after a cold start. The first cold start runs OB 100 with the DB still in its post-battery-drop state, the read at offset 62 falls off the end, and the CPU stops. The second start runs OB 100 with the DB already initialised, and the same access is now valid. Battery health, OB 100 re-entrancy, and UDT packing changes are the three things to check first.
Will adding OB 121 hide a real bug?
It will. That is why OB 121 must latch the DB number and the byte offset into a system flag and surface it on the HMI. With the flag visible, the operator sees a latched "Programming error" alarm and the engineer gets the diagnostic data without taking the spindle out of cut. Without the latch, OB 121 silently swallows the fault and the next commissioning engineer has no record of what happened.