How to Diagnose and Clear S7 CPU Programming Error 34 (Event 16#2534) in SIMATIC PCS 7

How to Diagnose and Clear S7 CPU Programming Error 34 (Event 16#2534) in SIMATIC PCS 7

To diagnose and eliminate S7 CPU Programming Error 34 (Event 16#2534 or 16#4534), which triggers recurring WinCC alarms and calls OB121, engineers must identify the faulted block call in the CPU diagnostic buffer and recompile the CFC program. Programming Error 34 indicates an area length violation or parameter mismatch—typically occurring when an incompatible block (such as an obsolete non-PCS 7 filter block) is loaded, or when an online download of changes downloads a modified block without updating its corresponding instance data block. The resolution requires opening the CPU Diagnostic Buffer in SIMATIC Manager to identify the faulted block number (e.g., FB831) and line offset, locating the block in Process Object View, removing or updating the block in CFC, and performing a clean program compilation and download.

Table of Contents

The Diagnostic Mechanism of S7 Programming Error 34

In SIMATIC S7-400 and AS 410 controllers, the operating system continuously supervises memory access boundaries and block call parameters during execution.

When an executing function block (FB) attempts to:
* Access a data block (DB) address that exceeds the physical length of the DB,
* Access an unassigned peripheral address, or
* Call an instance DB with an interface layout that does not match the FB definition,

The CPU firmware generates an internal exception: Programming Error 34 (Event class 16#25 or 16#45, Event ID 16#2534 / 16#4534). The CPU immediately invokes Organization Block 121 (OB121, Programming Error OB). If OB121 is present, the CPU remains in RUN and logs the event; if OB121 is missing, the CPU halts immediately into STOP mode.

Interpreting the CPU Diagnostic Buffer Event 16#2534 / 16#4534

When Programming Error 34 occurs, WinCC displays recurring system alarms (e.g., Programming error 34: FB831 / 102 / 0 / 36). To interpret the exact diagnostic data:

  1. Open SIMATIC Manager.
  2. Select the AS station -> PLC -> Diagnostics/Setting -> Module Information.
  3. Select the Diagnostic Buffer tab:
    * Event ID: 16#2534 (Area length error when reading) or 16#2535 (Area length error when writing).
    * Culprit Block: Identifies the exact block number (e.g., FB 831).
    * Block Address Offset: Shows the machine instruction line where the violation occurred (e.g., line 102).
    * Instance DB: Indicates which specific data block was being addressed during the illegal operation.

Root Causes: Area Length Errors and Delta Download Desynchronization

In PCS 7 engineering, Programming Error 34 arises almost exclusively from two scenarios:

1. Incomplete Download of Changes

An engineer modified a block type in SCL or imported a new library version, and executed Download Changes. If the download was interrupted or if certain instance DBs were locked by runtime execution slices, the CPU executes the new FB code against old, shorter instance DB memory layouts, triggering an area length read error.

2. Incompatible or Defective 3rd-Party Blocks

Inserting custom SCL/STL blocks (such as third-party moving-average filters, legacy communication drivers, or unverified mathematical algorithms) that utilize pointer arithmetic (ANY pointers or address registers AR1/AR2) without verifying array boundaries. If the block accesses an offset beyond the allocated DB limit, Error 34 fires cyclically.

Step-by-Step Resolution: Locating Culprit Blocks and Clean Compilation

Follow this engineering procedure to permanently clear the programming fault:

Step 1: Locate the Faulted Block Instance in CFC

  1. In SIMATIC Manager, open Process Object View (View -> Process Objects).
  2. Select the Blocks tab.
  3. Filter by Block Type: Search for the block number reported in the diagnostic buffer (e.g., FB831).
  4. Note the exact CFC chart name and technological hierarchy folder hosting the block.

Step 2: Analyze and Correct the Block in CFC

  1. Open the identified CFC chart.
  2. If the block is an obsolete or incompatible custom block (e.g., an unreleased filter), delete the block from the chart and replace it with a standard APL block (such as Smooth or MonAnL).
  3. If the block is a standard APL block, verify that all interconnected structures and array indices are valid.

Step 3: Execute a Full Program Compile and Download

  1. In CFC, select Chart -> Compile -> Charts as Program.
  2. Select Entire Program (do not select changes only, as this ensures all instance DBs are resized cleanly).
  3. If block interface changes occurred, schedule a planned maintenance window to execute Download Entire Program with the CPU in STOP (or use Type Change in RUN if supported on AS 410-5H).
  4. Clear the CPU diagnostic buffer and verify normal operation.

Programming Error Event Codes and Diagnostic Reference Matrix

The following table outlines the diagnostic event codes, error descriptions, and immediate remediation steps:

Event IDEvent DescriptionTypical Underlying CauseCorrective Action16#2534Area length error when readingPointer read beyond DB boundariesRecompile Entire Program; inspect array index16#2535Area length error when writingPointer write beyond DB boundariesVerify destination DB length in SCL/STL16#253ADB not loaded / missingInstance DB deleted or uncompiledRecompile charts; download missing DB16#253CBlock number errorFC/FB call to non-existent blockUpdate block library; download missing FB

Eliminating underlying code violations ensures deterministic controller execution without diagnostic buffer overflow.

Verification

To verify that Programming Error 34 is cleared:
1. In SIMATIC Manager, open the CPU Module Information -> Diagnostic Buffer.
2. Click Clear Buffer (if authorized).
3. Monitor the controller online for several minutes through cyclic OB execution.
4. Confirm that no new 16#2534 or 16#2535 entries are logged.
5. In WinCC Alarm Logging, verify that the recurring system alarm message Programming error 34 disappears.

Limitations and Operational Precautions

  • OB121 prevents the CPU from halting during programming errors, but operating with active programming errors consumes CPU execution cycles and risks data corruption.
  • Never use online tools from unverified third-party websites claiming to 'repair' Siemens programming errors; errors must be resolved in STEP 7 engineering.
  • If a full download in STOP is required to resolve interface mismatches, ensure plant operations are placed in a safe manual state prior to halting the CPU.
  • Always validate final license quantities, module availability, and MLFBs against the applicable Siemens catalog and authorized distributor quotation.

Engineer FAQ

Why did the CPU not stop when Programming Error 34 occurred?

The CPU remained in RUN because Organization Block 121 (OB121, Programming Error OB) is present in the block folder. OB121 catches the exception, logs the event, and allows the CPU to continue running.

What happens if OB121 is deleted from the CPU?

If OB121 is absent when an area length error occurs, the S7-400 CPU halts immediately into STOP mode to protect the controller from executing corrupted memory.

Can I locate the exact CFC chart where FB831 is used without PO-View?

Yes. In SIMATIC Manager, right-click the block folder -> Options -> Reference Data -> Display. Select Block Calls and search for FB831 to view all calling CFC charts.

Technical References

Related Articles

Related Tags

  • Programming Error 34
  • Event 16#2534
  • OB121
  • Area Length Error
  • Diagnostic Buffer
6 respuestas