1. Problem Statement and Field Symptom
An S7-1215C CPU was operating in RUN mode with an active process when retain memory was spontaneously cleared. No firmware download, no STOP-to-RUN transition request, and no online program edit was issued at the moment of failure. The only concurrent field activity was cable termination work on a separate section of the panel — not on the CPU backplane, signal modules, or 24 V supply.
A second, independent symptom appeared on the HMI historical log: tags backed up to a USB stick were stamped with the year 2020 after the system clock crossed midnight on 31 December 2019, even though the source records were generated in 2019.
Both symptoms are reproducible class-of-fault indicators for the S7-1200 family. This reference documents the diagnostic tree that distinguishes a CPU-induced retain wipe from a peripheral disturbance, the role of the LostRetentive system input, and the HMI time-stamp behavior that produces cross-year log corruption.
2. Retentive Memory Architecture in the S7-1200
Retentive storage in the S7-1200 is non-volatile, backed by an internal NV area (NVRAM on most firmware loads) that survives power loss but is subject to logical reset under specific CPU startup conditions. Three retentive domains exist:
| Domain | Range | Configuration Path |
|---|---|---|
| Bit memory (M) | MB0 – MB8191 (CPU 1215C) | CPU Properties → Memory → Retentive Memory → Merker bytes |
| Global data blocks (DB) | Each DB: instance is "Non-optimized" or "Optimized" with retain attribute set | DB Properties → Attributes → Retain |
| Process / IO image | Not supported as retentive | Use M or DB tags instead |
For optimized DBs, the retain bit is per tag (attribute column "Retain"). For non-optimized blocks, the entire DB can be marked retentive or a partial length can be defined. The maximum retentive volume on the CPU 1215C is 14 KB for data and 10 KB for bit memory. Always reserve explicitly in the device configuration; an unreserved tag receives no backup.
3. Startup Behavior Matrix and Memory Reset
The S7-1200 distinguishes between power-up, restart, and re-initialization. Memory reset is conditional, not unconditional.
| Condition | M (retentive) | DB (retentive) | Non-retentive | Outputs |
|---|---|---|---|---|
| STOP → RUN | Retained | Retained | Initialized to 0 | Re-enabled per OB1 |
| Power loss → power-up (Warm Restart – RUN) | Retained | Retained | 0 | Disabled until OB1 completes first cycle |
| Power loss → power-up (Warm Restart – mode before power off) | Retained | Retained | 0 (or retained if previous state was RUN) | Same as last state |
| Cold Restart (only available on S7-1500; S7-1200 maps this to a full reset path) | Erased | Erased | 0 | 0, disabled |
| MRES (memory reset via selector) | Erased | Erased | 0 | 0 |
| Firmware update | Erased | Erased | 0 | 0 |
For the S7-1200, the only path that wipes retentive memory without operator action is an unconditional power-supply collapse long enough to drain the internal NVRAM hold-up, or a firmware-induced reset. Watchdog events, communication faults, programming errors, and short-term brownouts that survive the internal hold-up (typically 5–10 ms for the 1215C at 24 V) will not clear retentive data.
4. CPU Startup Parameter: Warm Restart Mode
The relevant TIA Portal path is: CPU Properties → Startup.
| Parameter | Effect | Notes |
|---|---|---|
| Startup after power ON → "Warm Restart – RUN" | CPU powers up, executes OB100 (Startup OB), then enters RUN | Recommended for normal operation |
| Startup after power ON → "Warm Restart – mode before power off" | Returns to RUN if previously RUN, or STOP if previously STOP | Use only when external system requires same mode |
| Startup after power ON → "No restart" | CPU stays in STOP | Used for commissioning only |
None of the three options erase retentive memory on power-up. The diagnostic must therefore exclude CPU parameter as a root cause if a retentive wipe occurred during RUN.
5. The LostRetentive System Bit in Startup OB
OB100 (Startup OB) exposes a temporary input tag set of the data type STRUCT. Two tags are critical for retain diagnostics:
OB100.StartupInfoOB100.StartupInfo.LostRetentive : BOOLOB100.StartupInfo.LostRTC : BOOL-
LostRetentiveis TRUE for exactly one cycle at the end of the Startup OB if retentive memory was corrupted or lost during the last power-down. - If no Startup OB is programmed, the bit cannot be evaluated. The CPU still sets the internal diagnostic buffer entry
Retentive data lostregardless. - To capture and latch the state, copy the bit to a non-retentive M or DB tag at the end of OB100 and use it in OB1 to drive a fault indicator.
Example latch in OB100 (SCL):
IF "OB100".StartupInfo.LostRetentive THEN
"diag".retainLost := TRUE;
"diag".retainLostTimestamp := DT_TO_DATE(IN := "OB100".StartupInfo.StartupTime);
END_IF;
6. Diagnostic Tree for an In-RUN Retentive Wipe
When retentive memory clears while the CPU is in RUN, the only credible causes are:
-
Internal NV failure. The NVRAM cell block on the CPU has aged or experienced a write-cycle overrun. Diagnostic buffer entry:
Internal error, retentive data inconsistent. Resolution: replace CPU; export project first via TIA Portal online snapshot. -
Brownout below hold-up threshold. 24 V supply dipped under 19.2 V for longer than the PLC hold-up. Diagnostic buffer:
Power failureand a correspondingSTOP/POWER-ONpair. This wipes non-retentive only — not retentive — so it should be ruled out. -
Unintended MRES via selector. The selector was toggled to MRES (or held past the position). Visible in diagnostic buffer as
Memory reset performed. -
Online project download with "Reset PLC" flag. Only relevant if TIA Portal was attached. Diagnostic buffer:
Download of program to CPUwith subsequentSTOP → RUN. - EMC-induced reset on communication modules. A long cable tied to a live AC feeder can couple transients into the 24 V bus. The CPU may enter a defensive stop. This does not erase retentive memory; it may, however, trigger an event that appears as a memory wipe if the application reads initialization values that overwrite the DB on first scan and the designer was unaware of the difference between non-retentive DB instance and the HMI-supplied defaults.
Step-by-step isolation procedure:
- Open Online → Diagnostics → Diagnostic Buffer in TIA Portal. Filter on the date/time of the event. Note all entries between the last successful cycle and the recovery.
- Confirm whether a
STOPentry exists. If yes, read the cause; if no, the CPU never stopped — the wipe must be logical, not physical. - Inspect all
OB1code paths that write to the affected tags. Search forMOVEor assignment blocks at the start of cycle, particularly conditional on first-scan flags. - Add a Startup OB (OB100) if missing. Latch
LostRetentiveto a non-retentive flag and a HMI-visible bit. Recreate the fault; if the bit never latches, the wipe is application-driven, not CPU-driven. - Check 24 V rail with a memory oscilloscope. A 2 ms sag below 19.2 V on the CPU terminals will trigger a STOP but is not retentive-fatal. A sag exceeding 50 ms or repeated events can corrupt the NVRAM backup on early firmware loads.
- Replace the CPU with a known-good unit of the same MLFB. If the fault disappears, the NVRAM is the cause. If it persists, the cause is in the application or supply.
7. Cable Work and Electromagnetic Coupling
The field report states cable connections were being made to other parts of the panel during the wipe. Possible mechanisms:
- Shared 24 V return path. Routing an unshielded cable into the same duct as a 24 V supply that powers an inductive load creates a momentary ground shift when the new connection is made. This is rare on the 1215C but not impossible if the new load draws high inrush.
- Conducted transient on a long run. If the new cable runs in parallel with a 400 V feeder for more than 5 m, capacitive coupling can inject a sub-millisecond spike on the 24 V bus. The 1215C's input filter will absorb the spike, but a 1 ms undervoltage at 21 V is on the edge of the hold-up. Verify with a buffered scope.
- Static discharge to an open terminal. If the operator touched a live terminal while statically charged, the discharge can propagate to the backplane. The CPU enters a hardware interrupt and resets the communication subsystem; retentive memory is preserved, but the I/O image is re-initialized. This is the most likely benign cause for an apparent wipe combined with HMI comms loss.
STOP / POWER-ON transitions on a second channel.8. HMI Date Anomaly: Year Boundary in Historical Logs
The symptom — "data from 2019 is renamed to 2020 when the clock crosses midnight on 31 December" — is a documented interaction between the HMI runtime time base and the historical log file format. The HMI's data logging to USB uses a filename pattern tied to the system clock, and the timestamp inside each record is written at flush time, not at acquisition time.
| Cause | Mechanism | Resolution |
|---|---|---|
| HMI time base diverged from PLC time base by ~24 h at year-end | Each record inherits the timestamp of the most recent flush; on first flush after 00:00, all backlogged records get the new date | Set NTP or PLC-to-HMI time master; force a flush at year-end |
| USB file created with year tag; new year overrides filename segment | WinCC Comfort/Advanced renames file series on year change | Acknowledge new series; do not write into closed year file |
| Battery-backed RTC in the HMI panel reset on power loss | Default date is 01.01.2011 or 01.01.2020 depending on firmware | Enable "Set time from PLC" and verify PLC RTC battery |
For SIMATIC Comfort Panels (TP700, TP1200, KTP1200) and Unified Comfort Panels, the historical data is stored in CSV or proprietary .dblg files on the storage medium. The runtime's "Time synchronization" master must be configured:
- In the HMI project: Connections → Area pointer → Date/Time synchronization. Mark the PLC as the master.
- In the PLC: CPU Properties → Time of day → Time synchronization. Enable the PLC as NTP client or as a time master if no NTP is available.
- Verify the HMI receives a time update by reading the panel's local time after one hour of operation.
9. Verification Procedure
After applying any corrective change, perform the following verification sequence:
- Connect TIA Portal online. Read the diagnostic buffer; confirm no
Retentive data lostentries are generated during a forced power cycle. - Set a known value in a retentive DB tag. Stop the CPU. Wait 30 s. Power-cycle. Read the tag — it must equal the last value.
- With OB100 in place, trigger a power cycle. Confirm the latched
retainLostbit is FALSE for a healthy CPU. - Validate the HMI date sync by changing the PLC clock forward by 1 minute; the HMI must follow within one cycle.
- Create a historical log with 1-second acquisition; cross a year boundary (use the HMI simulator) and verify the file rotation respects the original timestamps.
10. Prevention and Best Practices
- Always program OB100. Even a 3-line block that latches
LostRetentiveand sets afirstScanbit eliminates the worst class of ghost-wipe investigations. - Reserve retentive memory explicitly per tag in TIA Portal. Do not rely on range-based reservation alone.
- Use a buffered 24 V power supply sized for 2× the worst-case inrush. A Phoenix Contact QUINT or Siemens SITOP 6EP1334 is appropriate for 1215C installations.
- Keep signal and power cables in separate ducts, crossing only at 90°. Maintain 200 mm separation on parallel runs.
- Enable HMI time-master = PLC and verify with a known good NTP server on the PLC if the network is available.
- Document the firmware version in the project. CPU 1215C firmware 4.2, 4.3, 4.4, and 4.5 have different NVRAM hold-up margins; refer to the Siemens Industry Online Support release notes for each version before drawing conclusions.
- Replace the PLC backup battery (if present on the variant) every 5 years. Loss of the buffer capacitor is silent and not always flagged in the diagnostic buffer.
11. Related Parameters and Tag Addresses
| Item | Address / Name | Type | Notes |
|---|---|---|---|
| Startup OB | OB100 | System | Executes once after power-up |
| Lost retentive flag | OB100.StartupInfo.LostRetentive | BOOL | One-cycle TRUE on retain wipe |
| Lost RTC flag | OB100.StartupInfo.LostRTC | BOOL | One-cycle TRUE on clock loss |
| First-cycle marker | User-defined M or DB tag | BOOL | Set in OB100, cleared in OB1 second scan |
| Diag buffer | Online → Diagnostics → Diagnostic Buffer | — | Look for "Retentive data lost", event ID 0x0300_xxxx |
12. FAQ
Does the S7-1200 CPU 1215C clear retentive memory on a normal power cycle?
No. Retentive memory is preserved across power cycles as long as the internal NVRAM hold-up is respected and the CPU is not reset via MRES, firmware update, or a "Reset PLC" download. A power cycle only clears non-retentive M, DB, and the process image.
What is the difference between "Warm Restart – RUN" and "Warm Restart – mode before power off"?
"Warm Restart – RUN" always starts the CPU in RUN mode after power-up. "Warm Restart – mode before power off" returns the CPU to its last mode before power loss (RUN or STOP). Neither option erases retentive memory.
How do I detect a retentive memory wipe if I do not have a Startup OB?
Read the diagnostic buffer in TIA Portal (Online → Diagnostics). A retentive wipe generates the event "Retentive data lost" with the corresponding time stamp. For an automated indication, add OB100 and latch the LostRetentive input tag to a non-retentive flag.
Why do my HMI historical log files on USB show the wrong year after 31 December?
The HMI timestamps each record at flush time. If the panel's clock drifted or was set forward at year-end, all backlogged records receive the new date. Configure the PLC as the time master, enable time-of-day synchronization, and ensure the PLC clock is NTP-disciplined.
Can a panel wiring activity cause a retentive memory wipe on a 1215C?
It cannot wipe retentive memory directly. It can cause a brief 24 V sag that triggers a STOP, after which application code that initializes the same tags in OB1 may appear to have wiped them. Verify with the diagnostic buffer and a power-quality recorder.