S7-314C-2PTP Work Memory Full: Adding Modbus TCP Blocks Fix

David Krause13 min read
S7-300SiemensTroubleshooting
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

Problem Overview

An S7-314C-2 PTP CPU reports "Work memory full — Do you want to compress?" the moment the engineer drags a Siemens Modbus/TCP block library onto the project and attempts download. STEP 7 / SIMATIC Manager then refuses the partial download with a second dialog: "Unable to download all blocks." The configuration that produces the symptom is the same configuration that recurs in almost every brownfield S7-300 migration to Modbus TCP:

  • CPU type: S7-314C-2 PTP (compact CPU with on-board serial interface), MLFB family 6ES7 314-6BGxx / 6ES7 314-6BHxx.
  • Installed work memory (loadable program + data): 96 kB.
  • Existing user program footprint: ≈91 kB of work memory (~95 % utilisation — the user cannot shrink it because the program was authored by a third party and the plant owner will not authorise code changes).
  • Modbus TCP add-on library (FB65/FB66/UDT/UDF blocks plus instance DBs for the CP-343-1 Lean): ≈35 kB additional work memory.
  • CP-343-1 Lean (6GK7 343-1CX10-0XE0) already present and licensed for Modbus TCP PN CPU.
  • One HMI connected via MPI on the same segment.

Net required work memory ≈ 91 + 35 = 126 kB. Net available work memory = 96 kB. Deficit = ≈30 kB. The CPU simply cannot hold the augmented program.

The "compress memory" prompt in SIMATIC Manager only reclaims fragmented, used-and-then-deleted blocks inside the existing working-memory partition. It cannot create new memory. If the free area after compress is smaller than the next download's footprint, the operation aborts.

Root Cause: Work Memory vs. Load Memory

The most common misconception in this scenario is that the Micro Memory Card (MMC) determines program capacity. It does not. The CPU has three separate memory regions:

Region Where it lives Can be expanded? Role
Load memory MMC (Flash) Yes — by fitting a larger MMC (128 kB → 8 MB). Passive storage of all blocks, comments, symbols, sources. Holds the project offline copy.
Work memory (code) Integrated RAM (volatile) No. Fixed at the factory, MLFB-dependent. Runtime copy of OB/FB/FC/SFB/SFC logic that the CPU executes.
Work memory (data) Integrated RAM (volatile) No. Same die as code RAM; partitioned by firmware. Runtime copy of DB contents and bit memory.

For the S7-300 family the partitioning between load and work memory is a hardware characteristic of the CPU — not a setting, not a parameter, not something a firmware upgrade alters. Swapping an MMC from 512 kB to 4 MB enlarges the offline storage and the source archive, but the integrated RAM that holds the running program stays exactly the same 96 kB.

This is why the engineer's first instinct ("replace the 512 kB MMC with a 1 MB MMC") is technically wrong: load-memory usage in the example was only 22 %, and even at 100 % load-memory fill the integrated work memory remains 96 kB. The download still fails.

Modbus TCP Block Footprint on CP-343-1 Lean

The "35 kB of add-on blocks" seen in the dialog is dominated by the SIMATIC Modbus/TCP PN CPU library and the connection / instance data blocks generated when the CP-343-1 Lean is parameterised:

Component Library / Block Approx. work-memory cost
Modbus/TCP PN CPU — FB blocks (FB65 TCP_CONNECT, FB66 MB_REDCL, FB67 MB_REDSV, FB68 MB_REDCLI, FB69 MB_REDSVI) SIMATIC Modbus/TCP PN CPU (entry ID 22660304) ≈18–22 kB code + instance DBs
UDT and UDF helpers (header / footer per job) Same library ≈4–6 kB
CP-343-1 Lean connection DBs (one per Modbus partner, typically 1–4) Generated by NetPro / HW Config ≈1.5–3 kB each
I&M / diagnostic DBs (DB1267–DB1270) Firmware-generated ≈2–4 kB

The exact cost varies with STEP 7 version (V5.4 SP5 vs. SP6+), library patch level, and number of simultaneous partners. The 35 kB figure reported by the engineer is consistent with two simultaneous Modbus partners, four connection DBs, and a recent SIMATIC Modbus/TCP PN CPU library.

The Modbus/TCP PN CPU library is licensed per CP-343-1 Lean. The license key (single-key licence on the MMC of the S7-300 CPU) is the "Modbus TCP PN CPU" article number. Without the licence, the blocks compile but the FB returns STATUS = W#16#80A1 (license missing) at the first call.

Solution 1 — Upgrade the S7-314C-2 PTP In-Place to a Higher-Memory Variant

This is the lowest-risk, lowest-cost fix because the replacement CPU is pin-compatible, program-compatible, and retains both on-board serial interfaces (PtP and MPI/PROFIBUS-DP) so the wiring, MPI HMI, and serial devices do not have to move.

MLFB Description Work memory Load memory (MMC) Remarks
6ES7 314-6BG03-0AB0 S7-300 CPU 314C-2 PTP, 24 DI / 16 DO / 4 AI / 2 AO on-board 96 kB up to 8 MB MMC Original CPU in the symptom report.
6ES7 314-6BG03-7AB0 / 6AG1 314-6BG03-7AB0 SIPLUS S7-314C-2 PTP (extended temperature / conformal coating) 96 kB up to 8 MB MMC Identical work-memory size — upgrade is not a fix.
6ES7 314-6BH04-0AB0 S7-300 CPU 314C-2 PTP, firmware V3.3, same I/O 192 kB up to 8 MB MMC Drop-in upgrade target. ~2× the work memory of the -6BG03.
6AG1 314-6BH04-7AB0 SIPLUS S7-314C-2 PTP, 192 kB 192 kB up to 8 MB MMC SIPLUS variant for harsh environments.

The firmware generation also moves forward from V2.x to V3.3, which is itself a benefit: V3.x firmware supports the latest Modbus/TCP PN CPU library without the secondary "ob77 / ob82 trigger" workarounds required on V2.6 firmware.

Migration procedure:

  1. Document the existing hardware configuration from HW Config (rack, slot, all module order numbers, I/O addresses, diagnostic addresses, CP-343-1 Lean IP/subnet, CP firmware version, CP order number 6GK7 343-1CX10-0XE0 vs. -0EX30 — they share the same Modbus TCP license).
  2. Do an offline archive of the S7-300 project (File → Archive → User-defined archive) plus an online backup (PLC → Upload Station to PG). Both copies become the rollback artefacts.
  3. Insert the new CPU into the rack. Power down, swap, power up. The CPU will report "STOP — no MMC inserted" until you transfer the card.
  4. Update the HW Config of the offline project to the new order number (6ES7 314-6BH04-0AB0). The slot, I/O addresses, diagnostic addresses, CP, and PROFIBUS/MPI parameters stay identical — STEP 7 will reassign the same addresses because the symbol table drives the assignment.
  5. Compile HW Config, then download the entire station (target system → "Download to Target Device → Entire Station" with "Replace object during download" enabled). This pushes the new CPU identity, the augmented block library, and the Modbus connection DBs in one pass.
  6. Transfer the licence key for "Modbus TCP PN CPU" to the new CPU's MMC via S7-PCT, Automation License Manager, or the license tool inside SIMATIC Manager.
  7. Run a CPU memory diagnostic: PLC → Module Information → Memory should now report ≈126 kB used / 192 kB total work memory, ≈66 % utilisation.
  8. Cold-restart the CPU and verify the Modbus TCP connection via the CP-343-1 Lean diagnostic page.

Solution 2 — Add a Companion S7-315-2 DP/PN as a Gateway

If the plant owner will not entertain even a same-footprint CPU change, the engineer can introduce a separate S7-315-2 DP / PN that hosts the Modbus TCP program, with the existing S7-314C-2 PTP acting only as an "interfacing module" that mirrors inputs to the new CPU and re-emits outputs back to the field. The two CPUs exchange data over MPI or PROFIBUS using global data (GD) or configured PUT/GET (S7 communication) on ISO-on-TCP.

Item Specification
New CPU S7-315-2 DP (6ES7 315-2AFxx) or S7-315-2 PN/DP (6ES7 315-2EHxx), 256–512 kB work memory
Coupling MPI between the existing CPU's MPI port and the new CPU's MPI port; cable length ≤ 50 m without repeater, ≤ 1000 m with two repeaters; baud rate 187.5 kbit/s is the safe default.
Data exchange S7 PUT/GET via FB14 / FB15 (single-sided write) or configured GD circles if both CPUs are configured for GD.
Modbus TCP engine Hosted entirely in the new S7-315-2, which carries the CP-343-1 Lean (or CP-343-1 Advanced for >8 partners).
HMI Can stay on the existing MPI segment pointed at the S7-314C-2 PTP, or be migrated to point at the S7-315-2 (the HMI tag database has to be re-tagged, which is itself a project change the owner may resist).
Caveat Doubles the hardware footprint; doubles the spare-parts holding; introduces a second PROFIBUS/MPI bus termination; introduces a single point of failure in the inter-CPU link.

Working example of a PUT block on the new S7-315-2 that pulls 32 bytes of input status from the old S7-314C-2 PTP every scan (illustrative — adapt the ID / pointers to your project):


// FB14 "PUT" — read input image from old CPU into DB100 on new CPU
CALL  FB14 , DB14
REQ    := TRUE                       // pulse-driven from OB35
ID     := W#16#0001                   // connection ID (matches NetPro)
DONE   := M10.0
ERROR  := M10.1
STATUS := MW12
ADDR_1 := P#E0.0 BYTE 32             // source area in old CPU
SD_1   := P#DB100.DBX0.0 BYTE 32     // target area in new CPU
LEN    := 32

Mirror logic in the old CPU writes the result to its outputs via FB15 "GET" (single-sided fetch). The cycle-time penalty for a 32-byte GD circle on MPI at 187.5 kbit/s is typically 30–60 ms per direction.

Solution 3 — Off-Load Modbus TCP to a Standalone Gateway

If neither CPU swap nor companion CPU is acceptable, the Modbus TCP engine can be moved off the S7-300 entirely onto a Siemens PN/MODBUS gateway (e.g. 6BK1700-0BA20-0AA0 Modbus/TCP → Modbus RTU/ASCII gateway, or the IE/PB Link PN IO with Modbus master capability). The gateway is configured in primary-setup-tool-style wizards, sits on the same PROFINET segment as the CP-343-1 Lean (or replaces the CP altogether if the plant elects to talk Modbus TCP directly to the gateway and let the gateway proxy Modbus RTU over an on-board serial port back into the S7-314C-2 PTP via its PtP interface).

This route preserves the S7-314C-2 PTP completely. It costs less hardware than a second CPU but introduces a third-party gateway whose lifecycle, security patches, and DCS-side diagnostic integration sit outside the SIMATIC world. For most brownfield plants this is acceptable; for sites under ISA-99 / IEC 62443 audit, the gateway must be documented in the cyber-security zone model.

Step-by-Step Verification After Upgrade

  1. Open PLC → Module Information → Memory on the new CPU. Confirm used work memory is now ≤ 65 % of the new total.
  2. Open PLC → Module Information → Diagnostic Buffer. Confirm clean cold-restart, no OB121 / OB122 programming errors, no SFC51 diagnostic entries referring to the Modbus blocks.
  3. From the CP-343-1 Lean diagnostic page (PLC → Module Information → CP, or web-based diagnostics via the CP's IP) confirm: Connection state = ESTABLISHED, Active partner = configured DCS IP, Bytes sent / received incrementing.
  4. Force one read job and one write job from the user program; verify DCS registers are updated and STATUS returned by FB65/FB66 equals W#16#0000.
  5. Monitor OB1 scan time (OB1_PREV_CYCLE_TIME in OB1) for 60 minutes. Acceptable budget: cycle time should remain < 100 ms; the upgrade from a 95 % utilised 96 kB CPU to a 66 % utilised 192 kB CPU typically reduces cycle time because the CPU no longer spends cycles on memory management.
  6. Test a power-cycle: remove power for 10 s, restore, confirm CPU returns to RUN with retain values intact and Modbus connection re-establishes within 30 s.

Cycle-Time and Performance Considerations

Work-memory utilisation above ~80 % does not merely block new downloads — it also slows scan time because the S7-300 firmware uses a paging algorithm that thrashes between RAM pages when the working set is large. A CPU running at 91 % utilisation can show scan times 1.4–1.8× that of the same program on a CPU at 50 % utilisation, even at identical clock speed. The 96 kB → 192 kB upgrade therefore also pays a performance dividend:

Work memory utilisation Typical relative scan time (V3.x firmware, normalised)
40 % 1.00×
70 % 1.05×
90 % 1.20×
95 % 1.40× – 1.80×

The above is illustrative and depends on DB count, FB nesting depth, and bit-memory footprint. Always measure after the upgrade rather than rely on a calculator.

Common Misconceptions to Clear With the Customer

  • "Buy a bigger MMC." The MMC is load memory only. It cannot add a byte of work memory.
  • "Compress and try again." Compress reclaims only previously deleted blocks' residual footprints; it does not create memory.
  • "Update the firmware." Firmware updates in the same MLFB family do not change work-memory size; they only fix bugs and add new instruction support.
  • "Just edit the existing program to free 30 kB." Often impossible because the program was authored by a third party whose IP the customer cannot expose. CPU upgrade is the only legal path.
  • "Migrate to S7-1500." Architecturally cleaner, but a full S7-1500 migration is a project of its own; the S7-314C-2 PTP → S7-314C-2 PTP -6BH04 swap is the correct drop-in fix when the only goal is to host the Modbus TCP blocks.

Troubleshooting Matrix

Symptom Likely root cause Action
"Work memory full — compress?" prompt on download Required blocks exceed integrated work memory Upgrade CPU MLFB to a variant with higher work memory (e.g. 6ES7 314-6BH04-0AB0, 192 kB).
"Unable to download all blocks" after compress Even after reclaim, free work memory < required footprint Confirm CPU MLFB; do not retry compress.
Compress succeeds but cycle time > 150 ms Work memory utilisation still > 90 % Reduce footprint or upgrade CPU.
Modbus STATUS = W#16#80A1 on first call after upgrade Modbus TCP PN CPU license not transferred to new MMC Re-license via Automation License Manager.
MMC reports "Card fault" after fitting larger MMC MMC size mismatch with CPU firmware (very old firmware ≤ V2.0 cannot use > 4 MB) Update CPU firmware to V3.x.
GD / PUT/GET between old and new CPU times out MPI baud rate mismatch or wrong connector pin-out Both CPUs on 187.5 kbit/s; use PROFIBUS connector with termination ON at both ends only if they are the physical ends of the segment.

Frequently Asked Questions

Can I expand the work memory of an S7-314C-2 PTP by changing the MMC?

No. The MMC is only the load memory (passive Flash storage). Work memory is integrated RAM that is fixed at the factory and depends on the CPU order number. A larger MMC gives you more offline storage and more project history; it does not give the CPU more RAM to execute blocks in.

What is the smallest MLFB upgrade that gives me enough work memory to add Modbus TCP to a 96 kB S7-314C-2 PTP?

The 6ES7 314-6BH04-0AB0 (or SIPLUS 6AG1 314-6BH04-7AB0) carries 192 kB of work memory in the same mechanical footprint, same I/O, and same PtP / MPI / PROFIBUS interfaces. Existing program, MPI HMI, CP-343-1 Lean, and field wiring transfer without modification.

How much work memory does the SIMATIC Modbus/TCP PN CPU library actually consume?

For a typical configuration with two Modbus partners, four connection DBs, and the standard FB65/FB66/FB67/FB68/FB69 set, expect 30–38 kB. The exact value depends on STEP 7 version, library patch level, and number of simultaneous jobs; use PLC → Module Information → Memory after the first upload for a precise reading.

Does adding Modbus TCP require a licence on the CP-343-1 Lean?

Yes. The "Modbus TCP PN CPU" licence is keyed against the S7-300 CPU's MMC, not against the CP. After a CPU swap, transfer the licence via Automation License Manager or the SIMATIC Manager licence tool. Without the licence the blocks compile and download, but the first FB call returns STATUS = W#16#80A1.

Is a same-footprint S7-315-2 DP a valid alternative if the customer refuses a CPU swap?

Yes, but only as a companion CPU. The new S7-315-2 hosts the Modbus TCP program and exchanges data with the existing S7-314C-2 PTP via MPI / PROFIBUS PUT/GET or GD circles. It roughly doubles the hardware footprint and the spare-parts holding, and it shifts the Modbus TCP licence to the new CPU. Most plants prefer the direct 314C → 314C MLFB upgrade because it keeps the BOM smaller.

Back to blog