Reading SINAMICS S120 r945 Fault Buffer to WinCC from S7-300

David Krause12 min read
S7-300SiemensTutorial / How-to
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

Overview

Reading the SINAMICS S120 fault buffer (parameter r945 / r949) from the drive and displaying it on a WinCC Flexible 2008 HMI requires three coordinated segments: PROFIBUS DP from the drive to the S7-300 CPU, an acyclic parameter-channel read implemented with the Toolbox SINAMICS S120 V1.3 HF1 function blocks (FBs) and data type UDT30002, and an Industrial Ethernet connection from the S7-300 to the HMI panel. The acyclic PKW read runs on top of PROFIBUS DP without consuming additional PZD slots, and the resulting fault data lands in a data block that WinCC tags can address directly.

The architecture below separates the three networks cleanly and matches the configuration most commonly used with a CPU 319F-3 PN/DP or CPU 319-3 PN/DP paired with a SINAMICS S120 CU320-2 DP control unit and a Multi Panel or Comfort Panel running WinCC Flexible 2008.

SINAMICS S120 CU320-2 DP r945 / r949 Drive CLiQ components S7-300 CPU 319 PROFIBUS DP master DB200 (Fault buffer) FB30102 / UDT30002 WinCC Flexible 2008 Comfort / Multi Panel Tags → DB200 Fault view screen PROFIBUS DP (PKW acyclic) Industrial Ethernet (TCP/IP, ISO-on-TCP) Single PROFIBUS segment, single Ethernet segment, no bridge required Acyclic PKW reads do not consume PZD slots

Prerequisites

  • SINAMICS S120 drive system with CU320-2 DP control unit (or CU320-2 PN with PROFIBUS option module). All drives and Line Modules are visible in the drive CLiQ topology.
  • CPU 319-3 PN/DP or CPU 319F-3 PN/DP with integrated PROFIBUS DP master and PROFINET interface. Firmware V3.3 or higher is recommended.
  • STEP 7 V5.5 + SP4 or STEP 7 (TIA Portal) V13 SP1 or later for project engineering of the S7-300 station. The Toolbox V1.3 HF1 was developed for STEP 7 V5.x; for TIA Portal use the SINAMICS S120 S7-300/400 Function Blocks for TIA Portal equivalent (FB30202 etc., see Siemens KB entry 109480367).
  • Toolbox SINAMICS S120 V1.3 HF1 (Siemens order number 6SL3070-0AA00-0AG0) installed. Contains FBs FB30100–FB30106 and UDTs UDT30001–UDT30004.
  • WinCC Flexible 2008 SP5 or later with Hotfix 18 (KB entry 109482244) on the engineering station; WinCC Flexible Runtime on the target panel.
  • STARTER V4.5 SP1 or SCOUT V5.4 for commissioning the drive and verifying PROFIBUS / PKW access on the bench.
  • PROFIBUS DP cable (e.g. 6XV1830-0EH10) with PROFIBUS connectors (6GK1500-0FC10) and bus terminators switched on at both ends.
  • Ethernet cable (Cat 5e or higher) for the HMI ↔ CPU link. If the panel is a non-PN model, the CPU's integrated PROFINET port serves as the gateway.
Note: Toolbox SINAMICS S120 V1.3 HF1 is the last released revision for STEP 7 V5.x. For S7-300 stations in TIA Portal projects, the successor library SINAMICS S120 S7-300/400 FBs for TIA Portal replaces the V1.3 HF1 FBs one-to-one.

SINAMICS S120 Fault Buffer Structure

Every SINAMICS S120 Control Unit (CU320-2, CU310-2) and every active DRIVE-CLiQ component maintains its own fault buffer. The parameters used for read-out are documented in the SINAMICS S120/S150 List Manual.

Parameter Meaning Type Buffer depth
r945[0] Number of fault events currently in the buffer Integer16 —
r945[1]…r945[8] Fault codes, newest first Unsigned16 8 entries
r947[0]…r947[7] Fault time, day/month/year (BCD) Unsigned16 8 entries
r949[0]…r949[7] Fault time, hour/minute/second/millisecond (BCD) Unsigned16 8 entries
r782[0]\code>
Fault time, days since 01.01.1992 Unsigned16 —
p2102 Acknowledgement configuration (IMMEDIATELY / POWER ON) Integer16 —

Reading r945 alone gives the numerical fault code; pairing it with r947/r949 yields a timestamped buffer that can be displayed in chronological order on the HMI.

Field-proven tip: Always read r945[0] first; if the value is zero, skip the remaining buffer indices. This avoids issuing eight unnecessary PKW requests when no faults are present.

PROFIBUS DP Network Configuration

  1. In HW Config (STEP 7) insert the SINAMICS S120 CU320-2 DP from the catalog (path: PROFIBUS DP → SINAMICS → SINAMICS S120 → CU320-2 DP). Set the PROFIBUS address to match the rotary switches on the CU (default 3 for CU320-2 DP).
  2. Configure the PZD telegram length. For cyclic motion control use the standard telegrams (e.g. Telegram 1, 2, 3, 102, 105, 106, 116–118). The PKW parameter channel requires an additional slot only on drives that do not support DP-V1; CU320-2 supports DP-V1 acyclic access natively and no extra PZD slot is needed.
  3. Compile HW Config and download. Verify the drive goes to RUN with cyclic PZD exchange (check LED BF off, RDY green, DPR green).
  4. In STARTER or SCOUT go online, right-click the drive → Properties → Bus Configuration and confirm the PROFIBUS node ID and baud rate (1.5 Mbit/s default, 12 Mbit/s supported by DP-V2).

STEP 7 Program: Reading the Fault Buffer

The Toolbox V1.3 HF1 ships FBs and UDTs that wrap the DP-V1 acyclic parameter access. The relevant pair for fault-buffer readout is:

Block Name Function
UDT30002 UdtParaReadResp Structure of the parameter read response (header + values)
UDT30003 UdtFaultRead Pre-shaped structure for the 8-entry fault buffer response
FB30102 FB ParaRead Acyclic PKW parameter read
FC30100 FC FaultRead High-level wrapper that fills UDT30003 from r945/r947/r949
DB200 Instance + target data block Stores fault buffer data exposed to WinCC

Step 1 – Copy the Toolbox Blocks

Open the library supplied with Toolbox SINAMICS S120 V1.3 HF1 (SINAMICS_S120_V13_HF1) and drag UDT30002, UDT30003, FB30102, FC30100 into your S7 program.

Step 2 – Build the Target Data Block (DB200)

Create a data block that WinCC can address. Use the structure of UDT30003 plus a small request block of your own:


DATA_BLOCK "DB_FaultBuffer"
STRUCT
  Request : UDT30001;       // header for the next read request
  Response : UDT30002;      // latest response (raw, header + 16 words)
  Buffer : UDT30003;        // decoded fault buffer
  Trigger : BOOL;           // HMI button: read on rising edge
  Busy : BOOL;
  Done : BOOL;
  Error : BOOL;
  Status : WORD;
END_STRUCT;
END_DATA_BLOCK

Step 3 – Call FC30100 in OB1

The high-level wrapper accepts the PROFIBUS address of the drive, the parameter number (945 for fault codes, 947 for the day timestamp, 949 for the time-of-day timestamp), the index (always 0 for r945 in single-DO drives; for DCC or parallel drives the index may be 0–2) and writes the response into Buffer.


CALL "FC FaultRead" , "DB_FaultBuffer"
  I_Ctrl_Adr := 2048        // logical address of CU320-2 DP (slot 0 / diagnostic address)
  I_Para_Nr  := 945         // r945 = fault code buffer
  I_Para_Idx := 0
  I_ReadN    := 8           // 8 entries
  I_Trigger  := "DB_FaultBuffer".Trigger
  O_Busy     := "DB_FaultBuffer".Busy
  O_Done     := "DB_FaultBuffer".Done
  O_Error    := "DB_FaultBuffer".Error
  O_Status   := "DB_FaultBuffer".Status
  IO_Buffer  := "DB_FaultBuffer".Buffer

For a complete timestamped buffer, call FC30100 three times in OB1 — once each for r945, r947, r949 — or call FB30102 in sequence from a sequencer FB.

Parameter indices: On SINAMICS S120 DO types with multiple identical data sets (e.g. SERVO_2 or VECTOR_2 in parallel operation), the parameter index may not be zero. Check the parameter list (r945.0‣r945.7) in STARTER under Commissioning → Parameter list.

Step 4 – Acknowledge Faults from the HMI (Optional)

To acknowledge faults from the HMI, write p3981 = 1 or use the standard STW1.7 bit in the cyclic telegram. Acyclic write: parameter 2103 with value 1 triggers a fault acknowledge on the drive object.


CALL "FC ParaWrite" , "DB200"
  I_Ctrl_Adr := 2048
  I_Para_Nr  := 2103
  I_Para_Idx := 0
  I_Value    := 1
  I_Trigger  := "HMI_Ack_Button"

WinCC Flexible 2008 Configuration

Step 1 – Add the Connection

  1. In the WinCC Flexible project tree, right-click Connections → New Connection.
  2. Select driver SIMATIC S7 300/400.
  3. Set HMI device address to the panel's IP (e.g. 192.168.0.10), PLC address to the CPU's PROFINET IP (e.g. 192.168.0.1), subnet mask 255.255.255.0.
  4. Select ISO-on-TCP transport. Rack 0, Slot 2 (CPU 319). Enable Access point 2 if the CPU is configured as a PN station with PN-IO mode.

Step 2 – Create Tags

WinCC Flexible cannot import a STEP 7 DB structure directly; either export DB_FaultBuffer via STEP 7 → Options → Symbol Table Export and import into WinCC, or create the tags manually as area pointers on the configured connection.

WinCC tag Data type Address Purpose
FaultCount Int DB200 DBB 0 Number of faults (r945[0])
Fault_1 … Fault_8 Word DB200 DBW 2 … DB200 DBW 16 Fault codes r945[1] … r945[8]
FaultTime_1 … FaultTime_8 Word DB200 DBW 18 … DB200 DBW 32 r947 / r949 timestamp words
FaultReadBusy Bool DB200.DBX 34.0 Read in progress
FaultReadDone Bool DB200.DBX 34.1 Read completed
FaultReadTrigger Bool DB200.DBX 34.7 Operator button → triggers FC30100
FaultAck Bool DB200.DBX 35.0 Acknowledge faults
Addressing caveat: Word tag offsets depend on whether UDT30001 starts at DBW 0 or DBB 0. Use the offset view in STEP 7 LAD/FBD/ST → View → Data View to confirm the byte offset for each symbol before creating WinCC tags.

Step 3 – Build the Fault View Screen

  1. Insert an I/O field or text list bound to Fault_1. Map numerical fault codes to descriptive text using a text list imported from the SINAMICS S120 fault list (column "Number" → "Reaction" → "Cause").
  2. Insert a button labelled Read faults with event Press → SetBit → FaultReadTrigger. Add a one-shot reset after 1 s with an invert + delay.
  3. Insert an output field bound to FaultReadBusy showing a progress bar.
  4. Insert a button Acknowledge bound to FaultAck.

Step 4 – Recipe / Alarm Logging (Optional)

Add an alarm log to record every fault transition. WinCC Flexible can store up to 2,000 alarm entries on a Comfort Panel and 1,000 on a 270 Multi Panel. Configure alarms with the same text list used on the fault view.

Verification

  1. In STARTER go online → right-click drive → Commissioning → Diagnostics → Fault buffer. Trigger a controlled fault: in Diagnostics → Inputs/Outputs force signal loss on one encoder, or set p2102 = 1 to enable a fault test.
  2. On the HMI press Read faults. Within 1–2 s the fault code number and the descriptive text should appear.
  3. Compare the WinCC display with STARTER's fault buffer; codes, count, and timestamps must match.
  4. Acknowledge the fault from the HMI. The Busy bit shall clear, and the entry should disappear from Fault_1 while remaining visible in STARTER's history (per S120 acknowledgement logic).

Troubleshooting Matrix

Symptom Likely cause Remedy
O_Status = W#16#0010 PROFIBUS diagnostic address wrong Check I_Ctrl_Adr; should equal the diagnostic address of the CU320-2 in HW Config (default 2048)
O_Status = W#16#0080 PKW timeout (drive busy, no response) Increase retry counter in FB30102 RETRY input; check DP-V1 is enabled in HW Config
O_Status = W#16#80C0 Drive rejected the read (parameter does not exist on this DO) Verify the drive object type in STARTER; for TM/Line Modules use index ≥ 1
HMI shows 0 for all faults but STARTER shows faults WinCC tags read from wrong DB offset Re-export the STEP 7 symbol table; verify DB offsets in the WinCC tag properties
HMI connection LED red Wrong IP / subnet / gateway Ping the CPU from a service laptop with cmd → ping 192.168.0.1; check WinCC connection Status in Connections → Diagnostics
Fault codes visible but timestamps wrong r947 and r949 are BCD; WinCC displays as decimal Add a scaling function block that converts BCD to decimal in STEP 7, or use a text list in WinCC with Decimal places = 0 and BCD-aware input format
FaultReadBusy stays TRUE FC30100 called with wrong parameter index for parallel drives Verify parameter index in STARTER parameter list; SERVO/VECTOR variants use 0–2

Performance and Timing

An acyclic DP-V1 read of 8 words typically completes in 80–150 ms at 1.5 Mbit/s and 30–60 ms at 12 Mbit/s. A full timestamped fault-buffer read (r945 + r947 + r949) therefore takes ~250–450 ms at 1.5 Mbit/s. Avoid polling the read trigger faster than 1 s; DP-V1 acyclic bandwidth is limited and excess requests will be queued and eventually rejected by the drive.

Edge Cases and Field-Proven Caveats

  • Drive CLiQ topology: r945 on a Line Module or Terminal Module is read from the DO number assigned by STARTER. Failing to address the right DO returns 80C0.
  • Faults from Safety Integrated: Safety faults (F016xx, F306xx) sit in a separate buffer (r975 / r977). If the HMI shall show safety faults too, add a second FC30100 call with I_Para_Nr := 975.
  • Hot restart: A warm restart of the CPU clears DB_FaultBuffer. If persistence is required, copy the buffer to a non-retentive area or to a recipe on the panel.
  • Panel change mid-read: If the operator changes screen during a read, WinCC keeps the tags updated; the read is initiated by the button, not by the screen change. No special handling required.
  • Firmware compatibility: Toolbox V1.3 HF1 was tested against S120 firmware V4.x and V5.x. On V6.x (CU320-2 PN with SINAMICS V6) prefer the TIA Portal successor library.

Related HMI Error Code Reference

For general patterns of mapping numerical fault codes to descriptive HMI text lists, see the AutomationDirect HMI and PLC Error Code Tables reference (panel-agnostic template, applies to any alphanumeric panel that consumes a tag with discrete codes): HMI and PLC Error Code Tables (EA9-RHMI appendix A).

FAQ

Which parameter do I read to display only the latest fault code on the HMI?

Read r945[1]. The first buffer slot always contains the newest fault code. Pair it with r945[0] (number of active faults) to decide whether to clear the field on the panel.

Does reading r945 require an additional PZD slot?

No. On CU320-2 (DP-V1 capable) the read uses the acyclic parameter channel (DP-V1 read/write) and consumes no cyclic PZD words. Older S120 control units without DP-V1 need an additional PKW slot (e.g. 4 words PKW + 2/6/10 PZD).

Can I read fault codes of Line Modules and Motor Modules in the same loop?

Yes. Issue one FC30100 call per drive object. Set I_Ctrl_Adr to the diagnostic address of each CU/Line Module and increment I_Para_Idx when reading a specific DO. For DCC-based drives the index may exceed 7; check the parameter list in STARTER.

How do I acknowledge SINAMICS faults from WinCC Flexible?

Either toggle bit 7 of the cyclic control word STW1 or write 1 to parameter p2103 using the Toolbox FC ParaWrite block. After acknowledgement, r945[0] returns to 0 and the HMI text fields clear.

Why does the HMI show fault codes but with wrong timestamps?

r947 and r949 are stored in BCD format. Without a BCD-to-Integer conversion in STEP 7 the panel displays the raw decimal value. Add an FC that unpacks each word into high/low nibbles and converts to integer before passing the result to WinCC.

Is Toolbox SINAMICS S120 V1.3 HF1 still available?

Yes. It is shipped as the entry-level library for S7-300/400 stations and remains in the product catalog. For TIA Portal projects, install the SINAMICS S120 S7-300/400 FBs for TIA Portal library, which provides the same blocks under updated FB numbers (e.g. FB30202).

Can I poll the fault buffer continuously without an HMI button?

Yes, but limit the polling interval to 1–2 s. Drive a clock bit (e.g. M10.7 from OB35, 1 Hz) into Trigger. Faster polling saturates the DP-V1 acyclic channel and may return W#16#0080 timeout errors.

Back to blog