Diagnosing Profibus-DP Slave Faults on S7-300 CPU315-2DP

David Krause10 min read
ProfibusSiemensTroubleshooting
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

1. Overview: Why Empty OBs Don't Show the Fault

The classic symptom reported on S7-300 CPU315-2DP masters is that diagnostic Organization Blocks OB82, OB85, OB86, OB87, and OB122 are downloaded into the controller, the CPU never goes into STOP, yet operators still cannot tell which DP slave has been lost. The reason is that simply inserting OBs only prevents the CPU from stopping on the corresponding error class; the OBs themselves contain no logic. To turn those OBs into a useful identification mechanism you must read the OB start information (or call SFC51 RDSYSST) and write the result to a flag area, a data block, or an HMI tag.

This reference covers three production-proven approaches used on S7-300 / S7-400 / CPU315-2DP systems:

  1. Reading diagnostic data inside the OBs (OB86_MASTER, OB82) and storing the slave address in a global DB.
  2. Calling SFC51 (RDSYSST) cyclically with SSL ID W#16#00B4 (DP slave diagnostic information) to enumerate the bus.
  3. Using Report System Error (RSE) in STEP 7 to generate the diagnostic blocks, WinCC messages and icon views automatically.
  4. Deploying the SIMATIC Maintenance Station for WinCC to surface the topology to operators.

2. Prerequisites

Item Required value Notes
CPU CPU315-2DP (6ES7315-2AG10 / -2AH14 / -2AJ14) Integrated DP master, order number ending with DP
Firmware V2.x or V3.x Firmware 3.3 recommended for full OB86_LOCAL / OB86_MASTER support
STEP 7 V5.5 + SP4 or higher Required for RSE wizard and SFC51 SSL catalog
GSD files Vendor-specific for non-Siemens slaves Import via HW Config > Options > Install GSD
Optional HMI WinCC flexible 2008 SP3 or WinCC V7.x Only needed for SIMATIC Maintenance Station
Cabling Profibus-DP cable, 9.6 kbit/s to 12 Mbit/s Terminators ON at both ends

3. Diagnostic OB Reference and Start Information

Each OB receives a 20-byte local-data area that contains the error source. The fields relevant to slave identification are summarized below.

OB Triggered by Local byte / word Meaning
OB82 Diagnostic interrupt from slave (DIA) LB8 / LB9 DP master / slave address causing the interrupt
OB85 Priority class error / I/O access fault LW8 Event identifier (e.g. W#16#XX31)
OB86 DP master / DP slave / IO controller failure LB12 / LB13 (slave)
LB16/17 (master)
Logical base address of failed slave (LB12) and DP master system ID (LB13)
OB87 Communication / rack fault LB8 Fault ID
OB122 Periphery access error LW12 Byte/word offset of failing I/O access
Coding rule: Always copy the local data of an OB into a global DB at the very top of the OB. Local data is overwritten as soon as a nested FB/FC is called.

3.1 STL Snippet for OB86 (DP Slave Failure)

FUNCTION_BLOCK FB_Diag
VAR_TEMP
  info : STRUCT
    evt_class  : BYTE;   // LB8
    fault_id   : BYTE;   // LB9
    slot       : WORD;   // LW10
    spec       : WORD;   // LW12
    log_base   : WORD;   // LB16/LB17  logical base addr
  END_STRUCT;
END_VAR
BEGIN
  info.evt_class := OB86_FLT_ID;       // byte 8  event class
  info.fault_id  := OB86_FLT_ID;       // byte 9  e.g. W#16#3A
  info.log_base  := OB86_MASTER_STATE; // LB16..17 master state
  // Save logical base of failed slave into global DB
  "dbDiag".slave_failed  := info.log_base;
  "dbDiag".ob86_event    := OB86_FLT_ID;
END_FUNCTION_BLOCK

3.2 Mapping Logical Base to Profibus Address

The logical base address of a DP slave is the address configured in HW Config for slot 0 of the slave. To convert it into the human-readable Profibus address (1-125) use the diagnostic buffer of the CPU or call SFC51 with SSL ID W#16#00B4, which returns the full diagnostic record including the physical Profibus node number.

4. Reading the Bus with SFC51 (RDSYSST)

SFC51 RDSYSST reads System Status Lists (SSL). For DP diagnostics the most relevant SSL IDs are:

SSL ID Index Returns
W#16#00B4 0 List of all DP slaves known to the master (status + diagnostics)
W#16#00B3 0 Diagnostic buffer of the DP master
W#16#0392 0 Communication status data of a single slave
W#16#0A00 slot Module diagnostic data (if DPV1 capable)
W#16#00B2 0 Module status of the central rack

4.1 STL Example - Enumerate All DP Slaves

// Call once on startup or cyclically every 5 s
CALL SFC51
  REQ        := TRUE
  ID         := W#16#00B4   // DP slave diagnostic list
  INDEX      := 0
  MLEN       := 256          // receive buffer length
  RET_VAL    := MW100        // 0 = OK, 80A1 = busy, 80B0 = illegal ID
  BUSY       := M101.0
  RECORD     := P#DB50.DBX0.0 BYTE 256
  // Output:
  // Each entry 32 bytes:
  // Byte  0  : rack/station
  // Byte  2  : logical base address low
  // Byte  3  : logical base address high
  // Byte  4  : Profibus node number (1..125)
  // Byte  5  : status (0=ok, 1=failed, 2=disabled, 3=not configured)
  // ...

4.2 Status Byte Decoding

Bit pattern Meaning Operator action
0000 0000 (00) Slave OK, cyclic data exchange None
0000 0001 (01) Slave failed - bus station not reachable Check connector, terminator, power, address
0000 0010 (02) Slave disabled Check HW Config 'Activate' flag
0000 0011 (03) Slave not configured Add slave in HW Config
0000 0100 (04) Slave with diagnostics Read OB82 / SSL 0A00

5. Report System Error (RSE) Wizard

STEP 7 V5.5 ships with the Report System Error wizard (Options > Report System Error). It auto-generates:

  • FB49 / FB50 / FB79 diagnostic blocks
  • Diagnostic DBs DB90..DB99
  • WinCC message configuration with text library
  • Icon view for the WinCC Maintenance Station

5.1 Step-by-Step Setup

  1. In SIMATIC Manager open the S7 program, then Options > Report System Error.
  2. Select the OB priority, default = priority class 5 for OB82 / OB86 / OB85 / OB87 / OB121 / OB122.
  3. Choose the message destination: WinCC, HMI Pro, or Save as file.
  4. Activate the checkboxes DP slave diagnostics and DP master diagnostics.
  5. Click Generate. STEP 7 inserts the FBs and creates DB90 with one bit per configured slave.
  6. Compile the WinCC project. The wizard creates a Standard diagnostics screen with a plant view where red/green icons indicate each slave.
Tip: The wizard does not modify your existing user program. It only adds blocks prefixed with @. You can keep them disabled (DBX0.0 = FALSE) and only enable them when commissioning is finished.

6. SIMATIC Maintenance Station for WinCC

The Maintenance Station package (entry ID 24359616) extends WinCC with a dedicated diagnosis view that lists every Profibus master, every slave and every module. It uses the same @Maintenance blocks generated by RSE and adds:

  • A navigable tree of plant areas
  • Live status icons (green = OK, gray = deactivated, red = failed)
  • A message log that points to the affected Profibus address, the slot, and the channel number
  • Operator button to acknowledge the fault

6.1 Compatibility Matrix

WinCC version Maintenance Station package STEP 7 version
7.0 SP3 V7.0 SP3 upd 6 V5.5 SP4
7.4 SP1 V7.4 SP1 upd 5 V5.6 / V5.7
WinCC flexible 2008 SP3 Built-in via Report System Error V5.5
TIA Portal WinCC V13+ RSE wizard inside TIA TIA V13+

7. WinCC Flexible / Comfort Integration

For smaller panels (TP177, KTP1200, MP277) the RSE wizard generates a tag-prefix-based screen. Procedure:

  1. After RSE generation in STEP 7, export the messages using Options > WinCC Configuration > Export.
  2. In WinCC flexible open the project, then Project > Import WinCC Configuration.
  3. Add a screen DiagView and insert an Alarm View with the imported message classes @System error 3000..3999.
  4. Add a 16-bit integer tag SlaveStatus[16] and bind each bit to one slave (offset = profibus address - 1).

8. Diagnostic Buffer Reading (CPU Diagnostic Buffer)

When a slave disappears the CPU writes a detailed entry into its diagnostic buffer. Reading it programmatically with SFC59 DB_REC_READ is useful for archiving. The entry format:

DB_BUFR.read(REQ:=TRUE, ID:=W#16#00B1, INDEX:=0, MLEN:=2048, RECORD:=P#DB_DIAG_BUF.DX0.0 BYTE 2048);

The buffer entry contains: timestamp (32-bit), event ID (16-bit), info1..info4 (16-bit each). Typical event IDs:

Event ID (hex) Description
0x3930 DP slave diagnostics data
0x3940 DP slave failure
0x3950 DP slave return
0x3A80 Loss of redundancy on Y-link
0x3B00 DP master system error
0x3C80 Diagnostic interrupt from DP slave

9. Practical Step-by-Step: From OB to Operator Screen

  1. Insert OB82, OB85, OB86, OB87, OB122 in the S7 program (Blocks > Insert > Organization Block).
  2. Inside OB86, evaluate OB86_MASTER_STATE and copy OB86_FLT_ID into DB100.DBW0. Use temporary STAT variables so nested blocks do not corrupt them.
  3. Add a 256-byte buffer DB101. Call SFC51 cyclically (e.g. OB35 every 100 ms) with SSL W#16#00B4.
  4. Run the Report System Error wizard and regenerate. The wizard picks up your new DB101 and adds slave-status bits automatically.
  5. In the WinCC project create an Alarm logging screen with the imported messages. Add an I/O field bound to DB100.DBW0 to display the failing Profibus address numerically.
  6. Simulate the fault: in HW Config uncheck Operating on a slave, or physically pull the connector. Verify OB86 fires and the operator screen turns the corresponding icon red.

10. Troubleshooting Matrix

Symptom Likely cause Action
OB86 does not fire although slave is unplugged OB not downloaded; OB priority wrong PLC > Operating Mode > Module Information > OB list - verify OB86 present
OB86 fires but slave address reads 0 Local data evaluated too late (after first FC call) Move evaluation to first line of OB86 using STAT
CPU goes to STOP OB86 missing for the priority class of the error Insert OB86 (and the matching OB82 / OB85 / OB87 / OB122)
SFC51 returns RET_VAL = 80B0 Wrong SSL ID Use W#16#00B4 for DP slaves, not 0xB4
RSE wizard does not list slaves Slaves configured but not 'connected' to a master Open HW Config > DP master > Properties - check 'Operating'
WinCC shows message but no icon Icon set not imported Project > HMI > Import Picture > @diag_icons.bmp
Bus LEDs on slave off, OB86 not triggered Slave power lost below Profibus transceiver threshold Measure 24 V at slave; check voltage drop on long cables
Repeating OB85 / OB122 on HMI access HMI tag bound to failed slave's I/O area Set update strategy to 'Read only when visible' or use proxy DB
Diagnostic data never refreshed SFC51 called in OB1 with MLEN too small Increase MLEN to at least 256 and call in OB35

11. Verification Checklist

  • OB presence: PLC > Module Information > Diagnostic Buffer > Event ID 0x4300 confirms each OB.
  • Slave status bits: Toggle a slave in HW Config and watch DB101 byte 5 change to 0x01.
  • WinCC alarm: Acknowledge alarm and confirm bit cleared in DB90.
  • Cable health: Disconnect and reconnect the connector; CPU must log entry ID 0x3950 (slave return).
  • Bus timing: Open Bus diagnostics in HW Config and verify Tslot, Tset, Tqui match the slave GSD file (typical Tslot = 300-1000 bit-times).

12. Advanced Topics

12.1 Using SFB52 / SFB53 for DPV1 Diagnostics

For ET200S / ET200MP stations that support DPV1, call SFB52 (RDREC) to read record 0 (module diagnostic) and record 1 (channel diagnostic). Each record contains 4 bytes of channel + error type that can be forwarded to MES as a quality stamp.

12.2 Failsafe DP Slaves

If the network includes PROFIsafe slaves the diagnostics are written to F-Peripherie DB (e.g. DB1000). OB82 entries must be evaluated for safety-related PVs as well; otherwise the safety program will go to STOP via F-STOP on F-channel-fault.

12.3 Replacing a CPU315-2DP with CPU315F-2DP

The F-variant has identical diagnostic blocks but adds a safety message frame. Re-running the RSE wizard regenerates all @ blocks; no user code changes required. The Safety Acceptance Test must be re-run (entry ID 18945243).

13. Frequently Asked Questions

My OB82, OB85, OB86, OB87, OB122 are loaded but nothing happens - why?

An OB only catches the corresponding error class to prevent STOP. To react to the error you must read its local data (for example OB86_FLT_ID) inside the OB and copy it into a global DB, or call SFC51 RDSYSST with SSL ID W#16#00B4.

How do I find the Profibus address of the failed slave?

Inside OB86 read OB86_MASTER_STATE and the logical base address (LB16/LB17). Convert the logical base to the Profibus node number with SFC51 SSL W#16#00B4 - byte 4 of each 32-byte entry contains the Profibus address.

Is Report System Error free of charge?

Yes, the RSE wizard is bundled with STEP 7 V5.5 and above and with TIA Portal V13+. It generates the WinCC alarm and icon screens automatically; no license fee is required for the wizard itself.

Can I use the same blocks on WinCC flexible?

Yes. Generate RSE with message target WinCC flexible. STEP 7 exports an XML that WinCC flexible imports as message classes and tags. The screens have to be built manually but the message text is auto-generated.

What is the difference between OB86 and OB82?

OB82 is triggered by a diagnostic interrupt from a slave (e.g. wire break on a channel) while OB86 fires when a slave goes offline or returns. You need both OBs to cover diagnostic and failure events.

Back to blog