SINAMICS S120 PROFIBUS GSD Diagnostic Data: SFC51 Reading Method

David Krause11 min read
ProfibusSiemensTechnical Reference
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

The SINAMICS S120 drive family exposes a defined PROFIBUS DP slave diagnostic interface that can be evaluated from a SIMATIC controller. Engineers commonly attempt to read the drive's diagnostic data with SFC13 (DPPRRM) after parsing the GSD file, but Siemens Product Support has confirmed that this path returns no useful values for SINAMICS drives: SFC13 was designed for distributed I/O stations (ET 200M, ET 200S), not for complex drive objects. The correct technique is to use SFC51 (RDSYSST / Read SSL) with SSL-ID W#16#00B4 on a CP 443-5 extended as a DP master, or to evaluate the raw response telegrams and the diagnostic frame visible inside HW Config of STEP 7 / TIA Portal.

The purpose of this reference is to:

  1. Locate the diagnostic data section in the SINAMICS S120 GSD file.
  2. Explain the Max_Diag_Data_Len = 244 constraint and how it shapes the receive buffer.
  3. Decode the standard, identifier-related, and device-related diagnostic blocks.
  4. Implement the recommended SFC51 (RDSYSST) W#16#00B4 alternative.
  5. Verify the read-out and map the bytes to SINAMICS fault and alarm words (r0945/r2122).

Prerequisites

  • STEP 7 V5.5 or TIA Portal V16+ with the SINAMICS S120 GSD file installed in the hardware catalog.
  • SINAMICS S120 Control Unit (CU320-2 DP or CU320-2 PN) with PROFIBUS DP interface active.
  • CP 443-5 Extended as DP master (for SFC51 SSL W#16#00B4 path) or an integrated PROFIBUS port on S7-300/400 CPU.
  • The matching GSD file revision: SIEM80FA.GSD or later. The diagnostic block layout described below corresponds to GSD revision matching firmware V5.x of the SINAMICS S120.
  • Manual reference: SINAMICS S120 Communication Function Manual (1218).
Important: The diagnostic structure described in the GSD file is the PROFIBUS slave diagnostic frame, not the drive parameter channel. The S120 reports its actual fault and alarm state through the cyclic process data (PZD) as well as through parameter r0945[0..7] (fault code) and r2122[0..7] (alarm code). Treat the diagnostic frame as a complementary health channel, not a replacement for the cyclic status word (ZSW1, ZSW2).

Where to Find the Diagnostic Section in the S120 GSD File

Open the GSD file in any text editor and search for the keyword Diagnosis or the section header ;--- Diagnosis ---. A typical SINAMICS S120 GSD excerpt from the diagnostic block looks like this:

;--- Diagnosis ---
Diagnostic_Alarm_supp      = 1
Extra_Alarm_SAP_supp       = 1
Alarm_Sequence_Mode_Count   = 0
Alarm_Type_Mode_supp        = 1
Max_Diag_Data_Len          = 244

The most important entry is Max_Diag_Data_Len = 244. This value dictates the maximum number of bytes the slave can place in its diagnostic response telegram. When you allocate the receive buffer in the user program, set its length to 244 bytes; anything shorter risks truncation, anything longer is rejected by the SFC. The other flags describe alarm model capabilities:

GSD Keyword Meaning SINAMICS S120 Setting
Diagnostic_Alarm_supp Slave supports diagnostic alarm (D_ALARM) 1 = yes
Extra_Alarm_SAP_supp Supports additional alarm SAPs 1 = yes
Alarm_Sequence_Mode_Count Number of supported alarm sequence modes 0 = not used
Alarm_Type_Mode_supp Supports alarm type mode field 1 = yes
Max_Diag_Data_Len Maximum length of diagnostic data block in bytes 244

The GSD does not describe the content of each diagnostic byte - that description is given by the PROFIBUS standard (EN 50170 Volume 2 / IEC 61158-6) and refined by the SINAMICS S120 Communication Function Manual. The GSD only declares the size and the alarm model features.

Why SFC13 (DPPRRM) Fails on SINAMICS S120

SFC13 DPPRRM - "DP read diagnostics of a slave" - expects a PROFIBUS slave with a fixed, contiguous module arrangement (ET 200M with one DI and one DO, for example). Its internal parsing assumes the standard PROFIBUS diagnostic block layout where each module's status is reported in a known bit position of the identifier-related diagnostics. SINAMICS S120, however, is a modular drive object with virtual slots (DO1 = Control Unit, DO2 = first drive axis, DO3 = second drive axis, etc.). The mapping of slot number to drive object is dynamic and is not exposed in the same way as physical I/O modules.

Siemens Product Support response, summarized:

"We have concluded that SFC13 will not deliver useful values in connection with SINAMICS. The SFC13 was meant for distributed IO stations and not drives."

Therefore, do not allocate a buffer of 244 bytes to SFC13 and expect a clean diagnostic payload back. The FB returns either zeros, frozen previous data, or the SFC sets RET_VAL = W#16#80A2 (DP slave failure) when the drive is busy processing a write request.

The Recommended Path: SFC51 (RDSYSST) with SSL_ID W#16#00B4

When the SIMATIC station uses a CP 443-5 Extended as PROFIBUS DP master, the diagnostic data of every configured slave can be read out centrally with SFC51 (RDSYSST) using SSL-ID W#16#00B4 (partial list excerpt of "DP slave diagnostic data"). The SSL part index INDEX corresponds to the configured PROFIBUS address of the S120 drive:

Parameter Value Description
SSL-ID W#16#00B4 DP slave diagnostic data (partial list excerpt)
INDEX W#16#0001 ... W#16#0125 PROFIBUS address 1 ... 293 of the slave
SZL_HEADER / SZL_MODL filled by SFC51 Length and number of records returned
DR ANY pointer Destination data record; size must be >= 244 bytes
RET_VAL / BUSY W#16#0000 if OK Status of asynchronous call

STEP 7 V5.5 Implementation Skeleton (SCL)

FUNCTION_BLOCK FB_DiagS120
VAR
    iRetVal  : INT;            // RET_VAL of SFC51
    wBusy    : BOOL;           // BUSY flag
    abDiag   : ARRAY[0..243] OF BYTE;   // 244-byte buffer
    wIndex   : WORD;           // PROFIBUS address of the S120
END_VAR
BEGIN
    // Call SFC51 - Read SSL
    iRetVal := RDSYSST(
        SZL_ID   := W#16#00B4,    // DP slave diagnostics
        INDEX    := wIndex,        // e.g. W#16#0004 for DP addr. 4
        SZL_HEADER := NULL,        // not used for partial list
        DR       := abDiag,        // 244-byte target buffer
        BUSY     := wBusy
    );

    IF (iRetVal = 0) AND (NOT wBusy) THEN
        // abDiag[0]  = Station status 1
        // abDiag[1]  = Station status 2
        // abDiag[2]  = Station status 3
        // abDiag[3]  = Diag.master addr
        // abDiag[4..5] = Ident number high/low (e.g. 0x80FA)
        // abDiag[6..7] = Header for identifier-related diagnostics
        // abDiag[8..]  = Identifier-related + device-related blocks
    END_IF;
END_FUNCTION_BLOCK
Buffer length rule: Always allocate at least Max_Diag_Data_Len (244) bytes as the DR ANY pointer. SFC51 returns the actual used length in the SZL header (offset 0 of the buffer). The remainder is undefined and must be masked out by the application.

Alternative: Reading Diagnostic Data Online in HW Config

For commissioning, open the S120 slave in HW Config → DP Slave Diagnostics. STEP 7 will show the same 244-byte payload decoded. A typical frame from a multi-axis S120 system resembles:

Standard diagnostics              : 00 0C 00 02 80 1E
Identifier-related diagnostics    : 43 00 00
Device-related diagnostics        : 08 82 00 00 00 00 00 00
Device-related diagnostics        : 08 9F 00 00 00 2A 11 05

Each block can be parsed as follows:

Block Byte Index Hex Value Meaning
Standard diag - Station status 1 0 0x00 Slave in data exchange, no fault
Standard diag - Station status 2 1 0x0C Bit 2: ready, Bit 3: diagnostics data present
Standard diag - Station status 3 2 0x00 Reserved
Standard diag - Diag.master addr 3 0x02 DP master PROFIBUS address 2
Ident number (high / low) 4..5 0x801E Siemens ident for SINAMICS S120 family (GSD ident)
Identifier-related diag - header 6 0x43 Bit 0 (0x01) and Bit 6 (0x40) set: module 0 and module 1 affected
Identifier-related diag - bitfield 7..8 0x00 0x00 No further modules flagged
Device-related diag - header 9..10 0x08 0x82 Length 8 bytes, status type 0x82 = channel diagnosis
Device-related diag - payload 11..16 0x00 ... Channel, error codes (see S120 manual)
Device-related diag - header 17..18 0x08 0x9F Length 8, status type 0x9F = extended channel diagnosis
Device-related diag - payload 19..24 0x00 0x2A 0x11 0x05 ... Decoded per SINAMICS S120 communication manual

The 0x801E ident number is the PNO-registered ident for the SINAMICS S120 family. If the ident on the wire differs (e.g. 0x80C0 for an older S120 firmware V4.x), the GSD revision does not match the loaded firmware - update the GSD or the CU firmware to make the diagnostic blocks parse correctly.

Decoding Channel and Extended Channel Diagnosis

The device-related diagnostic blocks of the S120 follow PROFIBUS convention:

  • Status type 0x82 = channel diagnosis, 8 bytes: 1 byte channel number, 1 byte error code, 2 bytes channel properties, 2 bytes user-defined (often drive fault number r0945 truncated), 2 bytes additional info.
  • Status type 0x9F = extended channel diagnosis, 8 bytes: same as 0x82 plus an extra 2 bytes that point to the DO (drive object) and the exact fault code stored in r0945 / r2122.

For the example frame 08 9F 00 00 00 2A 11 05 (with the preceding header):

Field Value Interpretation
Channel number 0x00 Channel 0 (drive object 1)
Error code 0x00 No channel-level error
Extended payload 0x2A 11 05 Fault code reference to SINAMICS parameter r0945 / r2122 - look up in S120 List Manual

Step-by-Step: Commissioning the Diagnostic Read-out

  1. Install the GSD. In STEP 7 V5.5 choose Options → Install GSD File and point to the latest S120 GSD for your CU firmware. Restart HW Config.
  2. Wire the S120. Configure the CU320-2 DP at the correct PROFIBUS address (default 3, change with PROFIBUS address switches on the CU). Match the baud rate (typically 12 Mbit/s for S120).
  3. Configure the slots. Insert the standard telegram (e.g. Telegram 1, 2, 3, 4, 5, 6, 7, 9, 102, 103, 105, 106) for each drive axis. The number of slots the GSD exposes determines the maximum identifier-related diagnostic bitfield width.
  4. Compile and download the HW Config to the CPU.
  5. Insert SFC51 call in OB1 with SSL-ID W#16#00B4 and INDEX = PROFIBUS address of the S120. Allocate a 244-byte ANY pointer to a static DB or instance FB.
  6. Monitor the call: RET_VAL should be 0, BUSY should be 0 after one cycle. The first 6 bytes of the buffer contain the standard diagnostic block.
  7. Map the SINAMICS fault number from the extended channel diagnosis to a textual message using the S120 List Manual (article number 6SL3097-4AP00-0BPx).

Verification Procedure

  1. Force a known drive fault by writing p0009 = 1, p0976 = 1 (factory reset is too drastic - instead use p2100/p2101 to inject a fault).
  2. Observe the diagnostic buffer: abDiag[1] bit 3 ("diagnostic data present") must toggle to 1.
  3. Confirm abDiag[4..5] still equals 0x801E (or the ident of the actual GSD).
  4. Decode the device-related blocks and verify they match the fault number shown on the AOP30 or in r0945[0] of STARTER / Startdrive.
  5. Clear the fault from the drive side and verify the diagnostic frame returns to 00 0C 00 02 80 1E.

Troubleshooting Matrix

Symptom Likely Cause Action
SFC13 returns zeros Wrong FB for SINAMICS drives Replace with SFC51 W#16#00B4
SFC51 RET_VAL = W#16#80B1 SSL not supported on this CPU/CP Use CP 443-5 Extended firmware ≥ V6.x
SFC51 RET_VAL = W#16#80A2 DP slave not reachable Check PROFIBUS wiring, terminating resistors, address switch
Ident number mismatch (e.g. 0x80C0 vs expected 0x801E) GSD / firmware mismatch Reinstall GSD matching CU firmware
Buffer shorter than 244 bytes Truncation on SZL header Reallocate ANY pointer to ≥ 244 bytes
Diagnostic frame does not update after fault Diagnostic alarm disabled in HW Config Set "DP Interrupt" in slave properties → "Diagnostics" tab
All bits in identifier-related diag set Module mismatch (telegram not loaded) Verify the cyclic I/O configuration matches the drive

Related Reading and Standards

The diagnostic structure of the S120 follows the generic PROFIBUS DP slave diagnostic model defined in IEC 61158-6 / EN 50170 Volume 2. For background on the header and the bitfield layout, the GSD specification of PNO (PROFIBUS Nutzerorganisation) is the authoritative source.

For drive-specific decoding, see:

Field-Notes Summary

  • The S120 GSD tells you how much diagnostic data the slave can emit (Max_Diag_Data_Len = 244) and which alarm model features are available, but never what each byte contains.
  • SFC13 is the wrong FB. Use SFC51 (RDSYSST) with SSL W#16#00B4 on a CP 443-5 Extended, or read the cyclic status word ZSW1 directly from the process image.
  • Always cross-check the decoded fault number with parameter r0945 / r2122 in STARTER or Startdrive - the diagnostic frame is consistent with the cyclic data, not a separate source of truth.
  • Reserve 244 bytes in the target buffer to avoid truncation.
  • If the ident number on the wire does not match the GSD ident, you have a GSD / firmware mismatch - update the GSD before commissioning the diagnostic application.

Where in the S120 GSD file is the diagnostic data length declared?

Search for the keyword Diagnosis or the section header ;--- Diagnosis ---. The relevant keyword is Max_Diag_Data_Len = 244, which defines the maximum length of the diagnostic response in bytes. Allocate the receive buffer to at least 244 bytes.

Why does SFC13 (DPPRRM) return useless values for SINAMICS S120?

SFC13 is designed for distributed I/O stations such as ET 200M, not for modular drive objects. Siemens Product Support has confirmed that SFC13 will not deliver useful values for SINAMICS drives. Use SFC51 (RDSYSST) with SSL-ID W#16#00B4 on a CP 443-5 Extended, or read the diagnostic frame from HW Config.

How do I read the S120 diagnostic data from a STEP 7 program?

Call SFC51 (RDSYSST) with SSL-ID W#16#00B4 and INDEX set to the PROFIBUS address of the S120 (e.g. W#16#0004 for address 4). Pass a 244-byte ANY pointer as the destination. The first 6 bytes of the buffer are the standard diagnostic block; subsequent bytes contain identifier-related and device-related diagnostic data per IEC 61158-6.

What does the ident number 0x801E in the S120 diagnostic frame mean?

The ident number is registered with PNO and identifies the SINAMICS S120 drive family. If the ident on the wire does not match the GSD ident (e.g. 0x80C0 for older firmware V4.x), the GSD revision does not match the loaded CU firmware and the diagnostic blocks may not parse correctly. Update the GSD or the CU firmware.

Can I use the diagnostic frame as a substitute for the cyclic status word (ZSW1)?

No. The PROFIBUS diagnostic frame reports latched fault and alarm events and is updated only on state change. The cyclic status word ZSW1 reflects the current operating state of the drive axis and is transmitted every bus cycle. Use ZSW1 for real-time control; use the diagnostic frame for fault logging and HMI messages.

Back to blog