Reading Profibus Slave Diagnostic on SIMATIC 555 with APT

David Krause15 min read
ProfibusSiemensTutorial / 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

The SIMATIC 555 (TI505 series) CPU exposes Profibus slave diagnostics only through the Read Slave Diagnostic (RSD) instruction. RSD lives inside the Relay Ladder Logic (RLL) instruction set of Tisoft - it is not an APT instruction, not a structured-text block, and not a function accessible from APT's chart programming environment. Engineers who run their main application in APT (the Productivity Application Tool, the structured successor to Tisoft for the TI505 family) cannot issue RSD directly, but the data the RSD instruction reads is precisely the standard diagnostic buffer that EN 50170 Volume 2 mandates for every Profibus DP slave.

This article documents the field-proven bridge: build a small RSD-only ladder subroutine in Tisoft, reserve ladder and variable words in APT's Control Configuration, and load the two programs in a strict order so the ladder survives every APT download. The result: Profibus diagnostic data sits in V-memory where APT charts can monitor and alarm on it natively.

Why not just use a different CPU? Legacy TI505 lines with field-wired Profibus DP networks cannot be replaced mid-life. The RSD-in-APT bridge lets new diagnostic logic ride on top of an existing APT application without disturbing the working program.

Why APT Cannot Issue RSD Directly

APT and Tisoft share the same V-memory and the same I/O image, but the compiler is split. APT compiles tasks (analogous to OB1 / cyclic) and uses CALL/CALB to invoke ladder subroutines that the user has pre-built in Tisoft. The RSD opcode is a relay-ladder-only instruction - APT's compiler does not parse it. Issuing RSD from an APT chart produces a compile error. The only way to call RSD is from a Tisoft rung.

The reference for the instruction and its operand format is the SIMATIC 555 Programming Reference manual. The relevant opcode layout is:

Operand Type Description
Slave address Constant (3-126) Profibus DP node address of the slave being queried
V-memory pointer V-address Destination buffer in V-memory
Length Constant (6-244) Number of diagnostic bytes to read
Status word V-address Receives RSD completion code (0 = success)

Per the SIMATIC 555 Programming Reference, one RSD rung consumes six (6) words of ladder memory regardless of slave count or length value. This number is fixed and is the key sizing input for the APT reservation.

Prerequisites

  • SIMATIC 555 CPU (or any TI545/TI555/TI575 with Profibus DP scanner) running firmware that supports RSD
  • Tisoft (or 505 Workshop) installed on a programming PC
  • APT installed and able to open the project's Control Configuration
  • Working Profibus DP network with a known slave GSD file and configured node addresses
  • Serial or Ethernet download path to the PLC
  • Documentation of existing V-memory allocation in the live APT program to avoid collisions
Check firmware before committing to RSD. The RSD opcode and the diagnostic buffer length limit are firmware-dependent. Verify the CPU firmware revision supports the slave count and byte count you intend to use. The PLC Programming Reference shipped with the controller lists the exact firmware cut-in.

PROFIBUS DP Standard Diagnostic Format (EN 50170 Volume 2)

When RSD executes, the buffer it fills follows the format defined by EN 50170 Volume 2 (the PROFIBUS DP standard). The first six bytes are always present, and bytes 6+ are the optional extended diagnostic area.

Byte 0 Station Status 1 Byte 1 Station Status 2 Byte 2 Station Status 3 Byte 3 Master Addr Bytes 4-5 Ident Number Bytes 6+ Extended Diagnostic (vendor specific) Standard Diagnostic Buffer Layout (per EN 50170 Vol. 2 / PROFIBUS DP) Bytes 0-1: Mandatory status bits. Bytes 2-5: Conditional on Diag.Mas.S activation. Bytes 6+: Vendor / device profile.

Station Status 1 bit mapping (per PROFIBUS DP):

Bit Symbol Meaning
0 Diag.Stations Another slave has set a diagnostic flag
1 Diag.Non_Existent Slave not reachable by the master
2 Diag.Mas.S Master has pending diagnostic for the slave
3 Diag.Prm_Fault Parameterization fault from slave
4 Diag.Prm_Req Slave requests re-parameterization
5 Diag.Not_Supported Function not supported by slave
6 Diag.Invalid_Slave_Response Slave returned malformed response
7 Diag.Fault Slave has at least one diagnostic entry pending

Station Status 2 bit mapping:

Bit Symbol Meaning
0 Wait_Prm Slave waiting for parameterization
1 Wait_Cfg Slave waiting for configuration
2 Slave_Not_Ready Slave not ready for data exchange
3 Slave_Non_Existent Slave not in master's scan list
4 Station_Not_Existing Address not assigned to any slave
5 Cfg_Fault Configuration fault from slave
6 Prm_Fault Parameterization fault from slave
7 Slave_Active Slave is in active data exchange

Bytes 2-3 only appear when Diag.Mas.S (master diagnostic) has been activated in the master's parameterization message. Bytes 4-5 hold the slave's Ident Number as set by the manufacturer in its GSD file. Bytes 6+ are vendor-specific extended diagnostics - the format and meaning are defined per device profile (e.g. encoder, drive, valve block). For an example of how to interpret extended channel diagnostic bytes in a modular station, see the Schneider Electric Profibus DP diagnose service FAQ.

Step-by-Step: Building the RSD Bridge

  1. Open a fresh Tisoft project and create a dedicated subroutine (SBR) named RSD_DIAG or similar. Keep it in its own file so APT recompiles do not affect it.
  2. Add one RSD rung per slave. Order them by slave address (3, 4, 5, ...). For each rung, populate the operands as shown in the recipe section below.
  3. Reserve destination V-memory in a block that will not collide with APT. Document the start and end V-address of each slave's buffer.
  4. Compile the Tisoft program and note the total word count of the new subroutine. The RSD instruction contributes 6 words per rung. Tag addresses, comments, and blank rungs add 0-2 words each.
  5. Open the APT project, go to Control Configuration, then Reserved Locations.
  6. Enter the ladder word count in the Ladder field: Tisoft subroutine word count plus 20-30% spare for future additions.
  7. Enter the variable word count in the Variable field: total V-memory words consumed by all RSD buffers plus 20-30% spare.
  8. Recompile the APT program. The compiler allocates the reserved area at the high end of the V-memory map.
  9. Place the PLC in PGM mode and clear PLC memory using the Tisoft or APT utility menu. This is mandatory - do not skip.
  10. Download the Tisoft program first. Use Tisoft's download dialog and let it complete fully before touching APT.
  11. Download the APT program second, and uncheck the "Clear PLC before download" option. APT's download manager will overlay its application on top of the existing Tisoft image without erasing the RSD subroutine.
  12. Switch to RUN mode from APT debug. The CPU begins scanning the RSD subroutine every cycle. Open an APT chart and add a watch window on the V-memory range you reserved.

RSD Operand Recipe

A typical RSD rung for slave address 5 with a 32-byte diagnostic buffer starting at V300 and a status word at V340 looks like this in Tisoft:

|  RSD(05, V300, 32, V340)  |

Operands in order:

Position Value Purpose
1 05 Profibus slave node address (decimal, 3-126)
2 V300 Destination buffer base address
3 32 Bytes to read (6-244, even value recommended)
4 V340 Status word - 0x0000 on success, non-zero on error

For a 12-slave network the rung list looks like:

|  RSD(03, V100, 32, V140)  |
|  RSD(04, V200, 32, V240)  |
|  RSD(05, V300, 32, V340)  |
|  RSD(06, V400, 32, V440)  |
|  ... 12 rungs total ...
|  RSD(14, V1300, 32, V1340) |

Total ladder words: 12 x 6 = 72. Total V-memory used: 12 x 36 = 432. Reserve 100 ladder words and 550 variable words in APT to give headroom.

APT Control Configuration - Reserved Locations

The APT Reserved Locations dialog tells the compiler to leave a hole in the V-memory map so Tisoft-owned data is not overwritten. Configure it exactly as shown:

APT - Control Configuration - Reserved Locations Ladder (words): 100 Variable (words): 550 Ladder reservation: 12 RSD rungs x 6 words = 72, plus 28 words of headroom. Variable reservation: 12 buffers x 36 words = 432, plus 118 words of headroom. Both values must be at least the actual Tisoft usage. Round up to next 50.
Reservation direction matters. APT's compiler places the reserved area at the top of V-memory (highest addresses). Tisoft writes from low addresses upward. As long as the reservation is at least as large as the Tisoft allocation, the two never overlap.

Download Order and PLC Memory Hygiene

The download sequence is the make-or-break step. APT defaults to "Clear PLC before download" - leave that checked for the very first download, but for every subsequent download, uncheck it. The RSD subroutine lives in ladder memory that APT does not know about, and an APT-initiated clear will wipe it.

PLC Key to PGM Clear PLC Memory (Tisoft or APT utility) Download Tisoft (includes RSD subroutine) Download APT UNCHECK "Clear PLC before download" RUN + Monitor APT Profibus diagnostic live in V-memory
Document the download procedure at the cabinet. A laminated procedure card on the inside of the panel door prevents the next shift engineer from re-enabling the "Clear PLC" checkbox and silently breaking Profibus diagnostics. Include a screenshot of the uncheck position.

Monitoring Diagnostic Data in APT Charts

Once the CPU is in RUN mode, the RSD subroutine writes the standard diagnostic bytes into the reserved V-memory range on every scan. In APT, build a chart page that displays each slave's status bytes.

For a slave at V300, the chart monitor configuration is:

// Slave 5 - Standard Diagnostic
V300  : Station Status 1  (binary view, bits 0-7)
V301  : Station Status 2  (binary view, bits 0-7)
V302  : Station Status 3  (binary view, bits 0-7)
V303  : Master Addr
V304  : Ident# High
V305  : Ident# Low
V306+ : Extended Diagnostic
V340  : RSD Status Word   (0 = OK, FFFF = error)

To convert V300 (a 16-bit word) into individual bits, use APT's MOVE and AND pattern, or simply enable the binary display in the chart watch window. Many teams mask the bits of interest with constants for HMI display:

// Mask the "Diag.Fault" bit (bit 7 of Station Status 1) for HMI alarm
FaultFlag = V300 AND 0x0080

Sizing the Tisoft Subroutine

The total Tisoft ladder word count is the sum of every RSD rung (6 words each) plus any glue logic you add (coils, contacts, MOVE blocks for status processing). Use the following rule of thumb:

Total Ladder Words = (N_slaves x 6) + (Aux_rungs x 4) + Spare
Total V-Memory Words = (N_slaves x (Length + 4)) + Spare
// "Length + 4" because the status word and a 3-word internal buffer
// sit adjacent to the user buffer in TI505 implementations.

Add 20-30% spare on top so future slaves (a new drive or a new I/O island) do not require another APT recompile. The example below shows a 12-slave sizing for a typical cell.

Parameter Value Calculation
Number of slaves 12 DP nodes 3-14 on the segment
RSD ladder words 72 12 x 6
Auxiliary rungs 0 No glue logic in this example
Headroom 28 ~40% spare for future slaves
APT Ladder Reservation 100 words 72 + 28
Buffer length per slave 32 bytes Standard + extended for drives
Per-slave V-memory 36 words 32 + 4 status/internal
Total V-memory used 432 words 12 x 36
Headroom 118 words ~27% spare
APT Variable Reservation 550 words 432 + 118

505 Workshop / PLC Workshop Suite Alternative

For new deployments on a 2500-series or TI555-class CPU, the modern path is the PLC Workshop Suite. It is a Windows-native IDE that supersedes Tisoft and adds:

  • Integrated Profibus configurator with live topology import from the GSD library
  • Online Profibus status monitor that reads the same standard diagnostic buffer the RSD instruction writes
  • Symbolic tag database shared between ladder and chart logic - no separate APT ladder reservation step
  • Native ladder upload/download with project diff

The PLC Workshop Suite supersedes both Tisoft and APT, storing Profibus diagnostics as named tags accessible from any block type, removing the bridge technique entirely on supported hardware.

Modern S7 Equivalent: DPNRM_DG

Engineers migrating to S7-1200 or S7-1500 with Profibus DP masters use the DPNRM_DG instruction. It is the direct conceptual descendant of the SIMATIC 555 RSD instruction, but in a CALL-able function block form. The TIA Portal DPNRM_DG documentation describes the operands as follows:

Operand Type Description
REQ BOOL Edge-triggered start of the read
LADDR INT Hardware identifier (HW ID) of the slave
RET_VAL INT Return code - 0 on success, error code on failure
RECORD VARIANT Destination buffer in a data block
BUSY BOOL TRUE while the read is in progress

The buffer populated by DPNRM_DG follows the same EN 50170 Volume 2 layout documented in the standard diagnostic format section above. Migration from a SIMATIC 555 RSD bridge to S7 DPNRM_DG is essentially a translation of the rung count to a series of CALLs and the V-memory pointer to a DB block.

Physical Layer Diagnostics - Diagnostic Repeater

Standard diagnostic bytes tell you that a slave has a fault, not why. The Siemens Diagnostic Repeater (6ES7 972-0AB01-0XA0) is a Profibus DP repeater that monitors segment-level signal quality on copper cables, including reflections, missing terminators, and short circuits. Connecting it between the master and the first slave adds a physical-layer alarm stream that complements the standard diagnostic data from RSD. The Siemens diagnostic repeater delivery release lists the part number, supported baud rates (9.6 kbps to 12 Mbps), and segment monitoring capabilities.

Troubleshooting Matrix

Symptom Likely Cause Diagnostic Step Fix
V300 area reads all zeros RSD rung not in scan path Verify the Tisoft subroutine is in the active task list Re-add the subroutine to the program file and re-download
V340 (status word) shows 0xFFFF Slave address not in master's scan list Check Profibus configuration in the master setup Add the slave to the master scan list and re-parameterize
Status word shows 0x0001 Buffer length too short for slave's extended diag Read the slave's GSD to confirm max diag length Increase the RSD length operand to match
Diagnostics disappear after APT download "Clear PLC before download" was checked Check the download dialog state Re-run the full download sequence; uncheck the option
V300 area shows stale data after power cycle V-memory not initialized to zero on power-up Inspect power-up behavior in CPU manual Add an explicit MOVE of 0 in the Tisoft subroutine
Status 1 bit 5 (Diag.Not_Supported) is set Slave firmware does not support the standard diag buffer Confirm GSD conformance class Use vendor-specific channel diagnostics instead
Only one slave shows live data RSD length is 0 or the rung is not enabled Check the rung conditions in Tisoft Enable the rung and re-download Tisoft
Cycle time jumps after adding RSDs RSD instructions synchronous, blocking scan Profile scan time before/after Stagger the RSDs across multiple scan cycles with a counter

Verification Procedure

  1. Disconnect one Profibus slave and confirm the Diag.Non_Existent bit (Station Status 1, bit 1) sets within one scan cycle in the corresponding V-memory word.
  2. Force a diagnostic condition on a slave (unplug an I/O module from a modular station) and confirm the Diag.Fault bit (bit 7) sets and the extended diagnostic bytes in V306+ carry the expected channel error code.
  3. Reconnect the slave and confirm the Diag.Fault bit clears after the next slave's parameterization cycle.
  4. Compare the slave's Ident Number in V304-V305 against the value in the GSD file. A mismatch indicates the master is configured for the wrong device profile.
  5. Cycle power on the PLC and verify the diagnostic data resumes within two scan cycles of RUN mode entry.
  6. Run an APT download (without "Clear PLC before download" checked) and verify the diagnostic data continues to update. If it stops, the APT download overwrote the Tisoft area - increase the reservation.

Field-Proven Caveats

  • Cycle time penalty. Each RSD takes a measurable slice of the scan. On a 12-slave network with 32-byte buffers, expect an additional 15-30 ms per scan on a TI555. If cycle time is critical, distribute the RSDs across multiple scans by enabling each rung on a different scan counter value.
  • V-memory address alignment. TI505 V-memory is word-addressed, but Profibus diagnostic data is byte-stream. Always use an even-numbered starting V-address to avoid misalignment when reading bytes from a chart.
  • Memory reservation at compile. APT only reclaims the reserved V-memory at full recompile. If you change the reservation in Control Configuration and forget to recompile, the new reservation has no effect.
  • Firmware compatibility. Some legacy TI545 CPUs shipped before RSD support landed. Confirm the CPU firmware revision supports RSD before starting the bridge - the Programming Reference manual lists the minimum cut-in firmware.
  • Reserved Locations are project-wide. If the same Tisoft subroutine is used across multiple APT projects (a typical maintenance scenario), the reservation value must be consistent in every project that downloads the same image, otherwise the diagnosis V-memory will be in a different location in each.

Frequently Asked Questions

Can I read the same RSD buffer from both APT and a Tisoft chart without contention?

Yes. Tisoft's RSD instruction writes to V-memory; APT only reads. The two engines are temporally separated by the CPU's scan. Use APT charts with read-only access to the reserved V-range and avoid writing to those addresses from APT tasks.

How many bytes of diagnostic data can RSD read per slave?

6 to 244 bytes per the Profibus DP standard. The exact upper limit is CPU-firmware dependent. Set the length operand to the maximum extended diagnostic size declared in the slave's GSD file; reading fewer bytes truncates the extended area.

What does the RSD status word contain after a successful read?

0x0000 on success. A non-zero value indicates one of: slave not in scan list (0xFFFF), buffer too short (0x0001), bus fault during read, or slave returned malformed response. The exact code list is in the SIMATIC 555 Programming Reference manual.

Does the bridge work on a TI545 or TI575 as well as the 555?

Yes, on any TI500-series CPU whose firmware supports the RSD opcode. The bridge technique is the same; only the ladder word count per RSD instruction and the V-memory upper limit change between CPUs.

Is there a way to avoid the dual-download procedure?

Yes - use the PLC Workshop Suite. It stores Profibus diagnostics as named tags in a unified project, so there is no need to share ladder and APT images, and there is no Clear-before-download risk. It is the recommended path for new projects on 2500-series CPUs.

Back to blog