SINAMICS G120 Fault Code Read via SINA_SPEED and S7-1500

David Krause14 min read
SiemensTIA PortalTutorial / 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

Problem Overview

An S7-1500 controller drives a SINAMICS G120 (CU240E-2 PN, CU250S-2 PN, or later) over PROFINET using the SINA_SPEED function block from the Siemens SINAMICS blocks library. The control program is built on Standard Telegram 1 (PZD-4/4: STW1 + NSOLL out, ZSW1 + NIST in) and the existing project must stay on that telegram. When a drive fault occurs, the PLC must still read the SINAMICS fault number and present it on the HMI / SCADA.

The challenge: Telegram 1 does not carry the fault code in cyclic data. Only the status word bit "Fault present" is visible cyclically. The actual fault number (r945, r947, r2131) must be fetched with an acyclic read, or the user must switch to a Siemens-specific telegram that includes the fault code word.

This reference covers both paths: keep Telegram 1 and use SINA_PARA (acyclic DPV1 read) on the PLC side, or switch to Telegram 352 which exposes the current fault number in the cyclic process data.

Reference documentation: Siemens application example "SINAMICS G: Controlling a speed axis with the SINA_SPEED block", entry ID 109485727. The function block SINA_SPEED (FB285) and SINA_PARA (FB286) are part of the global library "SINAMICS blocks" delivered with STEP 7 / TIA Portal.

Telegram 1 vs. Telegram 352 Layout

The selection of the PROFINET telegram determines which process data the drive exposes in real time. Telegram 1 is the lean, vendor-neutral layout; Telegram 352 is a Siemens-specific, G120-optimized layout that includes extra control bits and a fault-code word.

Word Telegram 1 (PZD-4/4) Telegram 352 (PZD-6/6)
PZD1 OUT (PLC → drive) STW1 (control word 1) STW1 (control word 1)
PZD2 OUT NSOLL (speed setpoint, N2) NSOLL (speed setpoint, N2)
PZD3 OUT — STW3 (control word 3 / config bits)
PZD1 IN (drive → PLC) ZSW1 (status word 1) ZSW1 (status word 1)
PZD2 IN NIST (speed actual, N2) NIST (speed actual, N2)
PZD3 IN — ZSW3 (status word 3)
PZD4 IN — Fault number (current)
PZD5 IN — Warning number (current)
PZD6 IN — Reserved

With Telegram 352, PZD4 IN carries the active SINAMICS fault number directly to the PLC on every bus cycle. With Telegram 1, the PLC sees the bit ZSW1.3 = "Fault present" but no fault code, and must poll the drive over the acyclic channel.

OFF2 / OFF3 with Telegram 352: Telegram 352 does not carry explicit OFF2 / OFF3 bits in STW1 the same way as the "old" Siemens telegram 350/352 variant. The recommended approach is to use the bits inside ConfigAxis input of the SINA_SPEED block: bit 0 = OFF2, bit 1 = OFF3. See the SINA_SPEED application example for the exact bit assignment (the bits are reordered vs. STW1 bits 1/2).

Status Word 1 (ZSW1) Fault and Warning Bits

These are the ZSW1 bits the PLC evaluates cyclically regardless of which telegram is in use. All bit numbering is Siemens convention, bit 0 = LSB.

Bit Symbol Meaning
0 RDY_ON Ready to switch on
1 RDY_RUN Ready to run
2 RDY_REF Operation enabled (drive follows setpoint)
3 FAULT Fault active — drive is in fault state, OFF1 executed
4 NO_OFF2 OFF2 inactive (i.e. coast-stop is not requested)
5 NO_OFF3 OFF3 inactive (quick-stop is not requested)
6 INHIBIT_ON Switch-on inhibited (power terminals blocked)
7 ALARM (warning) Warning active — drive still runs
8 AT_SETPOINT Actual = setpoint (within tolerance)
9 REMOTE Control via PLC (PZD), not local panel
10 SP_ACT_GE_LIMIT Actual speed ≥ reference (n_act ≥ n_set)
11 I_ACT_LIMIT Current limit reached
12 HOLD_BRAKE Motor holding brake open / closed request
13 NO_OVOLT No over-voltage alarm
14 NO_UNDERLOAD No underload alarm
15 NO_OVERLOAD No overload alarm

Recommended PLC logic: monitor ZSW1.3 on every cycle. On a rising edge, latch the fault-present flag and trigger the acyclic SINA_PARA read. On a falling edge (acknowledge / clear), clear the latched flag and the last fault number.

SINA_SPEED Interface (FB285) on S7-1500

The SINA_SPEED function block is the standard Siemens interface for cyclic speed control of a SINAMICS G/S/V drive. For an S7-1500 it is loaded from the global SINAMICS blocks library, declared as a multi-instance inside the user FB, or instantiated as DB. The block handles the conversion between the speed setpoint (RPM, real) and the N2 format the drive expects, the control word bit assembly, and the lifecycle of the axis state machine.

Input Type Description
EnableAxis BOOL Master enable. 0 → drive leaves Operation
AckError BOOL Pulse acknowledge for active faults (pulse on ZSW1.7 acknowledge sequence)
SpeedSetpoint REAL [rpm] Speed setpoint in RPM
ConfigAxis DWORD Optional control bits: bit 0 = OFF2, bit 1 = OFF3, bit 2 = ref pulse enable, bit 3 = ramp-function generator enable, etc.
RefSpeed REAL [rpm] Reference speed (typically 1500.0 for 50 Hz, 4-pole)
HwInputOutput HW_IO PROFINET hardware identifier of the drive (system constant)
Output Type Description
AxisEnabled BOOL Drive is in Operation (ZSW1.2)
AxisFaulted BOOL Drive has an active fault (ZSW1.3)
AxisWarn BOOL Drive has an active warning (ZSW1.7)
ActSpeed REAL [rpm] Actual speed
ActCurrent REAL [A] Actual current (only with tel. 3xx variants or with explicit r27 read)
Error BOOL FB internal error (parameter assignment, hardware id)
Status WORD FB internal status / diagnostic

The SINA_SPEED instance does not surface the SINAMICS fault number on its own. The block only returns AxisFaulted (mirroring ZSW1.3). To get the fault number, the user program must either (a) read an acyclic parameter with SINA_PARA, or (b) extract the fault number from Telegram 352's PZD4 IN.

SINA_PARA Acyclic Read (FB286) Procedure

SINA_PARA performs an acyclic DPV1 read/write of a single SINAMICS parameter. With Telegram 1 in use, this is the standard path to read r945, r947, r0947, r2131, r0949[0], or the full fault buffer.

Input Type Description
Request BOOL Rising edge: start the acyclic request
ReadWrite BOOL 0 = read, 1 = write
ParameterNumber INT SINAMICS parameter number (e.g. 947 for fault number, 949 for fault value)
Index INT Index of the indexed parameter (0 for scalar)
ValueREAL / ValueDINT REAL / DINT Value to write (for read = 0)
HwInputOutput HW_IO PROFINET hardware identifier of the drive
Output Type Description
Done BOOL Request completed successfully
Busy BOOL Request in progress
Error BOOL Request failed
ErrorNum WORD DS0x / DPV1 error code (e.g. 0x80B1 — parameter does not exist)
ValueReadREAL / ValueReadDINT REAL / DINT Read value (use the same type as the SINAMICS parameter)

Key parameters to read on a SINAMICS G120:

Parameter Name Type Description
r0947[0] Fault number, current DINT/U16 Most recent fault code. If 0, no fault. Read as DINT.
r0949[0..63] Fault value DINT Up to 64 supplementary fault values (channel, component, etc.)
r2131 Current fault code, CO U16 Same as r0947, formatted for display
r2132[0..7] Active alarm code, bit-coded U16 Bit field of active alarms
r2135[0..63] Alarm history U16 Time-stamped alarm buffer (r2135, r2136, r2137)
For storing and resetting the fault buffer, the drive-side command used is p2104 = 0 (pulse → acknowledge all faults) or p3981 = 0 (acknowledge all faults immediately). On the PLC side, after acknowledgement, wait for ZSW1.3 to fall before triggering the next SINA_PARA read.

TIA Portal Configuration Steps

  1. Add drive to device configuration. Open the S7-1500 project in TIA Portal. Drag the SINAMICS G120 from the hardware catalog (e.g. SIMATIC S7-1500 → Drives → SINAMICS G120 → CU240E-2 PN F) into the PROFINET network. Connect it to the S7-1500 PN interface.
  2. Assign the PROFINET device name. Use Online → Accessible devices → Assign PROFINET device name. The PLC must be able to AR (Application Relationship) the drive before the cyclic data is exchanged.
  3. Insert the telegram. In the drive's Properties → Device view → Telegram configuration, set Standard Telegram 1, PZD-4/4. Note the hardware identifier of the IO device — you will assign it to the HwInputOutput input of SINA_SPEED and SINA_PARA.
  4. Add the SINAMICS blocks library. Libraries → Global libraries → SINAMICS blocks. Drag SINA_SPEED (FB285) and SINA_PARA (FB286) into your program. For an S7-1500 the latest version is required (V4.0 or higher for the G120 multi-instance usage).
  5. Call SINA_SPEED in OB1 / cyclic OB. Use a rising-edge detector on ZSW1.3 from the same drive's input PZD to drive the fault-handling state machine.
  6. Call SINA_PARA in a time-controlled OB (e.g. OB30 / OB35 at 100 ms) so that the acyclic request does not block the cyclic exchange. Only trigger the SINA_PARA when the fault bit is latched.
  7. Map the parameter to HMI. Export the read DINT to a tag on the HMI (e.g. DB_Common.G120_FaultCode) and use it on a fault message view.
Diagnostic buffer import: For maintenance, the SINA_PARA block can also be used to read r0949[0..63] sequentially to retrieve the diagnostic buffer. Siemens Starter / Startdrive uses the same acyclic mechanism; the value present in the IOP / BOP-2 panel is the same parameter.

Structured Text Example: SINA_SPEED + SINA_PARA

The following SCL (Structured Control Language) snippet illustrates a complete axis block for a G120 with Telegram 1 and acyclic fault readout. The block is called from OB1 (cyclic, 4 ms) and from OB35 (100 ms) for the acyclic read.

// --- Cyclic call (OB1, 4 ms) ---
IF bEnable THEN
  iSinaSpeed(EnableAxis := bEnable,
             AckError   := bAckPushbutton,
             SpeedSetpoint := rSetpointRPM,
             ConfigAxis := dwConfig,
             RefSpeed   := 1500.0,
             HwInputOutput := hwG120,
             AxisEnabled => bAxisEnabled,
             AxisFaulted => bAxisFaulted,
             AxisWarn    => bAxisWarn,
             ActSpeed    => rActualRPM,
             ActCurrent  => rActualCurrent,
             Error       => bFbError,
             Status      => wFbStatus);
END_IF;

// Latch the fault-present edge
IF bAxisFaulted AND NOT bFaultLatched THEN
  bFaultLatched := TRUE;
  bReadNow      := TRUE;          // trigger acyclic SINA_PARA
  iReadBusy    := FALSE;
END_IF;

IF NOT bAxisFaulted AND bFaultLatched THEN
  bFaultLatched := FALSE;
  dwFaultCode   := 0;
END_IF;

// --- 100 ms call (OB35) ---
// One SINA_PARA read of r0947. Re-trigger on Done or Error.
IF bReadNow AND NOT iSinaPara.Busy THEN
  iSinaPara(Request         := bReadNow,
            ReadWrite        := FALSE,
            ParameterNumber  := 947,         // r0947 fault number, current
            Index            := 0,
            ValueDINT        := 0,
            HwInputOutput    := hwG120,
            Done             => bReadDone,
            Busy             => bReadBusy,
            Error            => bReadError,
            ErrorNum         => wReadErrNum,
            ValueReadDINT    => dwFaultCode);
  bReadNow := FALSE;               // single-shot
END_IF;

Use dwFaultCode in the HMI. For a human-readable description, copy the SINAMICS list of fault codes (function manual Firmware Version V5.2 / V6.4, depending on the CU) into the HMI text list.

Alternative Path: Telegram 352 with Cyclic Fault Number

If the communication overhead is acceptable (only 2 extra PZD per direction), switch to Telegram 352. The PLC will receive the active fault number on every bus cycle on PZD4 IN. SINA_PARA is no longer required for fault-number retrieval, but is still useful for reading the diagnostic buffer (r0949[0..63]) and warnings (r2110).

Telegram 352 also adds ZSW3 (status word 3) and STW3 (control word 3) which carry the additional control bits the G120 supports, e.g. motor identification, fixed setpoints, etc. If your existing project had a custom FB that read STW3 / ZSW3 manually, you can either extend SINA_SPEED with the LSINAExt example, or read ZSW3 directly from the input PZD area.

OFF2 / OFF3 with Telegram 352: In Telegram 352 the OFF2 / OFF3 control bits are not in STW1. Set them through the ConfigAxis input of SINA_SPEED: bit 0 = 0 → OFF2 (coast stop), bit 1 = 0 → OFF3 (quick stop). Bit 0 / 1 of ConfigAxis do NOT have the same bit index as bit 1 / 2 of STW1 — the order is different. Always cross-check with the SINA_SPEED example project (entry ID 109485727) before commissioning.

Verification and Commissioning

  1. Bring drive to fault intentionally. In Startdrive, force a fault: set p0009 = 1 to enter commissioning, then trigger a "simulated fault" (e.g. trip encoder loss by setting p0400 = 0 on a closed-loop FVC configuration, then restore). Acknowledge and re-try the procedure.
  2. Watch ZSW1.3 in the watch table. Open a watch table on the axis DB and monitor AxisFaulted. It must go TRUE the cycle after the fault is set.
  3. Watch the acyclic SINA_PARA response. In the same watch table, monitor dwFaultCode, bReadDone, bReadError, wReadErrNum. After the latched edge the value must appear within the OB35 cycle (100 ms).
  4. Cross-check with Startdrive online. In Startdrive → Online → Diagnostics buffer, confirm the r947 number matches the PLC's dwFaultCode. The values must be byte-identical.
  5. Test the acknowledge chain. With the fault still active in the drive, press the HMI's "Ack" button → PLC sets AckError := TRUE → ZSW1.3 falls → bFaultLatched := FALSE. The drive must be ready to run again after the next ON command.
  6. Test the cyclic path (if Telegram 352). If Telegram 352 is in use, force a fault and read PZD4 IN from the I/O start address. The value must match the diagnostic buffer without any acyclic request.

Troubleshooting Matrix

Symptom Likely cause Check / fix
AxisFaulted never goes TRUE despite a drive fault Telegram mismatch; PROFINET name or AR not established Online → Accessible devices: AR is up. Properties of drive: Standard Telegram 1 selected. Hardware id matches the SINA_SPEED HwInputOutput.
SINA_PARA.Error = TRUE, ErrorNum = 16#80B1 Parameter number / index does not exist on this firmware Confirm the drive's firmware version (e.g. V5.2 SP3) exposes r947. For older FW, use r945. Cross-check with the parameter list in Startdrive.
SINA_PARA.Error = TRUE, ErrorNum = 16#80B2 Access to a write-protected parameter or wrong access type Read is blocked: parameter is write-only or "commissioning" level. Use Read access on r0947 (always read-only).
Done never comes Hardware id wrong; drive is in AR loss Check HwInputOutput. Open the S7-1500's diagnostic buffer; look for PROFINET station failure.
Fault code 0 even with active fault Reading r0947[0] when drive has acknowledged or the parameter is reset on the same cycle Add a rising-edge latch; do not re-trigger SINA_PARA until ZSW1.3 has a new rising edge.
Telegram 352: PZD4 IN always 0 Drive telegram not set to 352, or wrong order of PZDs in the device view Properties of the SINAMICS G120 → Telegram configuration. Remove all telegrams and add Telegram 352 in the first slot. Recompile and download.
OFF2 / OFF3 do not stop the drive Wrong ConfigAxis bit indexing in SINA_SPEED Bit 0 = OFF2, bit 1 = OFF3 (NOT STW1.1 / STW1.2). See the application example entry ID 109485727.
Axis trips the moment it is enabled Wrong motor data or missing encoder Run Startdrive → Commissioning → Motor data identification (p1900).

Field-Proven Caveats

  • One SINA_PARA at a time per drive. The SINA_PARA block is single-instance per request. Trigger a new request only after Done OR Error has fired; otherwise the second trigger is lost on a busy state machine.
  • Index of r0947 and r0949. r0947 is indexed but only r0947[0] is the "current" fault. The other indices are the history. Read Index = 0.
  • Type matching. Use ValueDINT for r0947, r0949, r2131 (32-bit signed). Using the REAL input returns garbage on integer parameters and vice-versa.
  • OB1 vs OB35 cycle time. Acyclic parameter requests are sequential; if the SINA_PARA is called in the 4 ms OB1 the drive-side response time (~10–50 ms typical) can stall the SINA_PARA state machine. Call the block from a 50–100 ms time-controlled OB.
  • Read-only buffer reset on power cycle. The diagnostic buffer (r0949, r2135) is in volatile memory by default. To retain it across mains-off, write p0964 = 0 to disable the power-up reset of the diagnostic buffer (firmware-dependent).
  • CPU firmware compatibility. On the S7-1500, the SINA_SPEED block requires at least TIA Portal V16 + SINAMICS blocks library V4.0. For the S7-1200 the same FB is used; the application example is titled for the S7-1200 (entry ID 109485727) but applies identically to the S7-1500.

FAQ

Can Telegram 1 carry the SINAMICS fault number cyclically?

No. Standard Telegram 1 (PZD-4/4) only exchanges STW1/NSOLL and ZSW1/NIST. To read the fault code cyclically, switch to Siemens-specific Telegram 352 which adds the fault number on PZD4 IN, or fetch it acyclically with SINA_PARA from parameter r0947.

Which SINA_PARA parameter reads the current fault number on a G120?

Read r0947 with index 0. It returns the active fault code (0 if no fault). For the supplementary fault value (channel, component, etc.), read r0949 with the matching index.

How do I trigger the acyclic read only on a real fault, not on every cycle?

Latch the rising edge of AxisFaulted (ZSW1.3). On the rising edge, set a one-shot flag that triggers SINA_PARA exactly once. Clear the latched flag and the last fault code only when AxisFaulted falls back to FALSE after a successful acknowledge.

What is the difference between r945, r947, and r2131?

r0947[0] is the active fault number from the diagnostic buffer. r2131 is a connector (CO) version of the same value, formatted for HMI display. r0945 is an older alias used on legacy firmware; prefer r0947 on CU240E-2 / CU250S-2 with V4.7+ firmware.

Does SINA_SPEED itself reset faults when I assert AckError?

Yes. SINA_SPEED assembles the acknowledge sequence in STW1 (bit 7) and forwards it to the drive. The drive then resets the active fault. The PLC still has to read r0947 afterwards (or PZD4 IN with Telegram 352) to confirm the fault has cleared.

Can I keep SINA_SPEED in one CPU and run SINA_PARA on another?

No. SINA_PARA needs the same PROFINET AR to the drive as SINA_SPEED. Run both blocks on the same S7-1500 that owns the PROFINET IO connection to the SINAMICS G120, otherwise the acyclic DPV1 read has no route to the drive.

Back to blog