Reading CP 341 Diagnostics with SFC51 SSL_ID W#16#00B1

David Krause11 min read
Serial CommunicationSiemensTechnical 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

Reading CP 341 Diagnostics with SFC51 SSL_ID W#16#00B1 in S7-300/400

The Siemens CP 341 (Point-to-Point Communication processor) is a serial interface module used in S7-300 and, via the IM 153-2 interface, in S7-400 and S7-400H redundant systems. Like every Siemens distributed or central I/O module, the CP 341 publishes a 4-byte standard diagnostic record that the CPU can read out over the backplane bus. The standard tool for this on STEP 7 V5.x is the system function SFC 51 (RDSYSST) with partial system status list SSL_ID W#16#00B1. This reference documents the SFC 51 call, the 4-byte record layout, the meaning of each bit, common field errors, and the verification procedure.

1. Diagnostic Architecture of the CP 341

The CP 341 supports two complementary diagnostic paths:

  1. Hardware interrupt (OB 40 / OB 82 / OB 86) when a channel or module fault occurs. The CP can be configured to generate a diagnostic interrupt that is routed to the assigned CPU, indicating a malfunction of the CP 341 over the S7-300 backplane bus.
  2. Polled diagnostics via SFC 51 using the module's standard diagnostic data record. The CP 341 provides 4 bytes of diagnostics information that can be requested at any time through the system status list (SSL).

For S7-400 stations that use an IM 153-2 to expose an S7-300 ET 200M rack (for example, to insert a CP 341 in an S7-400H system), the same SFC 51 mechanism applies. The CP's logical base address is the slot's input or output address configured in HW Config (STEP 7) or in the TIA Portal hardware catalog.

Note: The 4 bytes returned by SSL W#16#00B1 are not identical to the diagnostic record layout described for distributed I/O (DPR0). For point-to-point CPs the bytes follow the SSL module diagnostic information definition. Always decode the result against SSL W#16#00B1, not against the DR0 layout used by SM/FM modules.

2. SSL_ID W#16#00B1 — Module Diagnostic Information

SSL partial list W#16#00B1 is the standard "module diagnostic data" record. The list is one entry long per module; each call returns the 4 bytes of the targeted module.

Parameter Value Meaning
SSL_ID W#16#00B1 Module diagnostic data (4 bytes per module)
INDEX bit 0..14 Logical base address of the slot Configured I or Q start address of the module
INDEX bit 15 0 = input, 1 = output Selects the address space the CP 341 occupies
RET_VAL INT SFC 51 return value (0 = OK; see Section 6)
BUSY BOOL TRUE while a read is in progress
SZL_HEADER STRUCT LENTHDR, N_DR (number of data records)
DR ANY Target area (typically ARRAY[0..3] OF BYTE)

For the CP 341 the most common call uses the input address space (bit 15 = 0), because in STEP 7 the CP 341 occupies a small input range used for status and handshake. If you wired the slot as an output-dominant module, flip bit 15 to 1.

2.1 Sample SCL / Structured Text call

// Read 4-byte diagnostic record of CP 341 at I-base address 272
// (replace 272 with the configured logical base address of your CP)

FUNCTION_BLOCK FB_CP341_Diag
VAR
    iRetVal   : INT;
    bBusy     : BOOL;
    szlHeader : STRUCT
        LENTHDR : WORD;
        N_DR    : WORD;
    END_STRUCT;
    abDiag    : ARRAY[0..3] OF BYTE;   // 4 bytes module diagnostic data
END_VAR
BEGIN
    // Trigger one-shot read
    iRetVal := RDSYSST(
        REQ      := TRUE,
        SZL_ID   := W#16#00B1,
        INDEX    := 272,              // bit15=0 => input address space
        RET_VAL  := iRetVal,
        BUSY     := bBusy,
        SZL_HEADER := szlHeader,
        DR       := abDiag);
END_FUNCTION_BLOCK

2.2 Ladder equivalent (STEP 7 V5.x)

      DBX.DBX0.0   "CP_Diag_Start"            --[ CALL SFC 51 ]--
                              REQ     :=  "CP_Diag_Start"
                              SZL_ID  :=  W#16#00B1
                              INDEX   :=  272         // I-address of CP 341
                              RET_VAL :=  "CP_Diag_RetVal"
                              BUSY    :=  "CP_Diag_Busy"
                              SZL_HEADER := "CP_Diag_Hdr"
                              DR      :=  P#DB100.DBX0.0 BYTE 4

3. Decoding the 4-Byte Diagnostic Record

The four bytes returned in abDiag[0..3] have the following meaning for an S7 module (CP 341 follows the same SSL definition):

Byte Bits Field Meaning
0 0 Module fault 1 = module has a fault (group error)
0 1 Internal fault 1 = internal module error
0 2 External fault 1 = external (wiring, partner, line) error
0 3 Channel fault present 1 = at least one channel faulty
0 4 External auxiliary voltage missing 1 = 24 V missing
0 5 Front connector missing 1 = no front connector / no module parameter assignment
0 6 Parameter assignment missing 1 = module has not been configured
0 7 Wrong module in slot 1 = inserted module does not match configuration
1 0..3 Module class 0001 = CPU, 0100 = FM, 1000 = CP, 1010 = IM, 1100 = SM, 1111 = other
1 4..7 Reserved 0
2..3 — Reserved / module-specific Vendor- and module-specific content (see CP 341 manual)
Module class check for CP 341: a healthy CP 341 slot returns abDiag[1] = 16#08 (binary 0000 1000) — that is the SSL module class CP indicator. If the value is anything else, the slot is occupied by the wrong module type (SM/FM/IM) or the CP has failed self-test.

4. STEP 7 vs. TIA Portal — Where the CP 341 Lives

Although the CP 341 is technically an S7-300 module, it is fully supported in:

  • STEP 7 V5.x / V5.5 SP2+ for SIMATIC S7-300 and S7-400 (including H systems).
  • TIA Portal V16+ for S7-300 CPUs and S7-400 CPUs (the CP 341 is included in the TIA hardware catalog under "S7-300 / Point-to-Point / CP 341"). The manual page for the module is at CP 341 (S7-300, S7-400) configuration.

Regardless of the engineering tool, the runtime mechanism is the same: the CP 341 publishes a 4-byte diagnostic data record over the backplane bus that the CPU can fetch with SFC 51 / RDSYSST at SSL W#16#00B1. The TIA Portal SCL/FB syntax for RDSYSST is identical to STEP 7 V5.x.

5. Step-by-Step Procedure

  1. Identify the CP's logical base address. Open HW Config (STEP 7) or the device view in TIA Portal and read the I-address (or Q-address if used) of the CP 341 slot. Typical values for a single CP 341 in slot 6 of a rack are 272..279.
  2. Declare a 4-byte buffer in a global DB or in the instance DB of an FB. The buffer must be exactly 4 bytes; SFC 51 will not write to a buffer that is the wrong size.
  3. Call SFC 51 / RDSYSST with SZL_ID = W#16#00B1 and INDEX = base address + (0 if input, 32768 if output).
  4. Evaluate RET_VAL. 0 means success. Negative values are error codes; the most relevant ones are listed in Section 6.
  5. Decode byte 1, bits 0..3 to confirm the slot is occupied by a CP. Anything other than 8 (hex 0x08) means the module class is wrong — the slot is the wrong module, or the wrong SSL index is being used.
  6. Decode byte 0 to identify the fault class (internal/external/channel). Use this to drive a status word or HMI faceplate.

5.1 STEP 7 Configuration Checklist

Step Action Expected Result
1 Insert CP 341 from hardware catalog into the slot Module appears with default I-address 272..279
2 Set the protocol (ASCII, 3964(R), RK 512, Modbus master/slave) CP 341 parameter dialog opens with protocol selection
3 Enable "Hardware interrupt on diagnostic event" in CP properties OB 82 is generated on fault
4 Download hardware configuration to the CPU CP 341 ready; SF LED off
5 Compile and download the user program containing SFC 51 Function executes in OB 1 / OB 35 / OB 82

6. SFC 51 RET_VAL Error Codes

RET_VAL (hex) Meaning Typical cause on CP 341
0000 No error —
8081 / 8082 SSL_ID or INDEX outside valid range Wrong SSL ID; INDEX bit 15 not set correctly for output slots
8085 System data could not be read (bus fault) CP 341 not reachable, backplane bus error, IM 153-2 failure
8090 Requested SSL partial list not available on this CPU Wrong CPU firmware; older S7-300 CPU that does not support W#16#00B1
80A1 Negative response from module (DPRAM error) CP 341 is in startup, defective, or slot is empty
80A2 DP/PN protocol error on logical address INDEX is not a valid module address in HW Config
80A4 Communication error on bus IM 153-2 / PROFIBUS link to S7-400 disturbed
80B1 Protocol error on the system status list Outdated CPU firmware; upgrade CPU
80Cx Resource bottleneck (jobs running) Multiple SFC 51 calls overlapping; serialize via BUSY
Critical: Only one SFC 51 with the same SSL_ID may be in flight at a time. Always re-trigger REQ only after BUSY = FALSE and RET_VAL = 0 on a fresh job — otherwise a job overflow will return 80C3 (resource busy).

7. Triggering Diagnostics from OB 82

For an event-driven implementation, hook the call into OB 82 (diagnostic interrupt):

// OB 82 - Diagnostic Interrupt
// OB82_MDL_DEFECT bit 0..3 of OB82_MDL_DEFECT flag in the local temp area

IF "CP_OB82_Evidence" THEN
    IF OB82_MDL_DEFECT = TRUE THEN
        // The CP 341 is signalling a fault - read SSL W#16#00B1
        // to learn which byte/bit tripped the alarm
    END_IF;
END_IF;

For a polled implementation, call SFC 51 cyclically in OB 1 (slow scan, e.g. every 1 s) and store the result in a global DB for the HMI to display. The CP 341 manual is available from Siemens Industry Online Support as CP 341 Point-to-Point Communication, Installation and Parameter Assignment — section 6 of that manual describes the diagnostic record in detail.

8. Verification Procedure

  1. Insert a fully working CP 341 in the configured slot. After CPU startup the SF LED on the CP must be off and byte 1 bits 0..3 must equal 1000b (0x08, module class CP).
  2. Trigger SFC 51 and read abDiag[1] = 16#08. This confirms the SSL path is reaching the right slot.
  3. Pull the front connector of the CP 341. Within one OB 82 cycle the SF LED lights and abDiag[0] bit 5 = 1 ("front connector missing").
  4. Disconnect 24 V at the load supply. abDiag[0] bit 4 = 1 ("external auxiliary voltage missing").
  5. Remove the CP 341 from the slot. OB 85 (program execution error) or OB 82 fires with abDiag[0] bit 7 = 1 ("wrong module / module removed").

9. Troubleshooting Matrix

Symptom Likely Cause Fix
RET_VAL = 80A1 on every call CP 341 not seated, defective, or in startup Power-cycle rack, reseat module, check SF LED
RET_VAL = 8085 IM 153-2 link to S7-400 failed Check PROFIBUS terminators, fiber optics, IM 153-2 diagnostics
abDiag[1] != 0x08 Wrong SSL INDEX — addressing SM or FM by mistake Verify the I-start address in HW Config matches the INDEX parameter
All bits 0, no faults, but data still invalid DR area is wrong type (BOOL array, INT array) Declare DR as ARRAY[0..3] OF BYTE or as a P# pointer to a BYTE area
Spurious OB 85 in H system SFC 51 polled too fast; OB 35 / OB 1 conflict Throttle to >= 1 s scan; or call only from OB 82
Byte 0 bit 6 ("parameter assignment missing") = 1 CP 341 not yet configured in HW Config Re-download HW Config, then full restart of CPU
Byte 0 bit 3 ("channel fault") = 1 RS422/485 line problem, partner powered off, termination missing Check wiring, partner device power, RS422 termination jumpers on CP

10. Edge Cases and Field Notes

  • S7-400H redundant CPU: both H-CPUs receive the diagnostic record independently. Place the SFC 51 call in a non-fail-safe OB (OB 1, OB 35, OB 82) and use a primary/backup discrimination tag if you need to log which CPU read which value.
  • IM 153-2 redundancy: if you operate two IM 153-2s on the same PROFIBUS segment, the SFC 51 call must be made on the active IM. Reading the passive IM returns a "module not available" error (RET_VAL 80A4) until failover completes.
  • CP 341 in a distributed ET 200M on PROFINET: SFC 51 still works because the CP's standard diagnostic data record is mapped through the PROFINET/PROFIBUS gateway (IM 153-4PN or IM 155). Just confirm that the slot is a real module in HW Config and that the device is online.
  • Multiple CP 341 modules: call SFC 51 sequentially per module; never call SFC 51 in parallel for two different SSLs on the same CPU because the call is not re-entrant.

11. Cross-References and Official Documentation

Which SSL_ID do I use to read CP 341 diagnostics?

Use W#16#00B1 with SFC 51 (RDSYSST). It returns the 4-byte module diagnostic record for the slot addressed in the INDEX parameter.

How is the SFC 51 INDEX parameter built?

Bits 0..14 hold the logical base address of the CP 341 (e.g., 272 for I-address 272). Bit 15 selects the address space: 0 = input, 1 = output.

How do I confirm the slot is actually a CP 341?

Byte 1 bits 0..3 of the returned record encode the module class. For a CP the value must be 1000b (0x08). Anything else means the wrong module is in that slot.

Why do I get RET_VAL 80A1 from SFC 51 on the CP 341?

80A1 indicates a negative response from the addressed module — the CP is starting up, missing, or defective. Power-cycle the rack, reseat the CP 341, and check its SF LED.

Can I use SFC 51 on a CP 341 that is mounted in an S7-400 via IM 153-2?

Yes. The SSL mechanism is independent of the rack. SFC 51 runs on the CPU; the IM 153-2 transparently forwards the diagnostic read to the CP 341 in the ET 200M rack. Use the CP's logical base address as INDEX.

Back to blog