How-to
Read DP slave diagnostic addresses with SFC51 on an S7-300
Short answer
SFC51 RDSYSST with SSL ID 0x00B4 selects a DP slave by its configured diagnostic address, and that address never comes from the 0x0092 station list: station numbers and diagnostic addresses live in separate addressing domains with no conversion between them. Read the address from the documented 0x00B status list family or from the hardware configuration, then call 0x00B4 once per address.
On this page
- Why does SSL ID 0x00B4 not accept the PROFIBUS station address from 0x0092?
- Which system status list returns the configured diagnostic addresses?
- How do I read the diagnostic addresses step by step with SFC51?
- How do I read a slave's diagnostic data once I have its address?
- What do I do when no status list returns the addresses?
- What does a complete read look like with real numbers?
- Which mistakes make SFC51 return nothing or the wrong slave?
- Questions asked
SSL ID 0x00B4 of SFC51 RDSYSST selects a DP slave by the diagnostic address the hardware configuration assigns it, and that number is not on the bus: the 0x0092 station list returns PROFIBUS station addresses, which belong to a different addressing domain with no conversion between the two. To read the diagnostic addresses of slaves on an S7-300 that you do not already know, take them from the 0x00B[x] module status family documented with SFC51, or take them from the hardware configuration read online from the CPU, then call 0x00B4 once per address. This article walks the read, shows a worked example in which the tempting offset conversion misses by one count, and ends with the faults that make the call return nothing or the wrong slave.
Why does SSL ID 0x00B4 not accept the PROFIBUS station address from 0x0092? #
The 0x0092 list returns PROFIBUS station numbers, the node identities your master uses on the bus cable, while 0x00B4 indexes diagnostic objects by the address the CPU's hardware configuration assigns each slave or module, and no formula converts one number into the other.
The two numbers do different jobs. The PROFIBUS address is the bus node number set on the slave and entered in the master configuration; it identifies the station on the cable. The diagnostic address is a PLC-side logical address that the project attaches to the slave's diagnostic object, and the CPU keys its diagnostic lists by that object. The mapping between the two exists only in the loaded configuration: nothing in the operating system computes it. A value copied from the station list therefore either draws an error or lands on whichever object happens to own that number, so the read fails or, worse, silently reports the wrong slave. Treat 0x0092 as the inventory of who is on the bus and nothing more.
Which system status list returns the configured diagnostic addresses? #
The 0x00B[x] family of system status lists, the module diagnostic lists documented alongside SFC51, is where configured module and slave diagnostic addresses appear, and the 0x0092 station list never contains them.
The x in 0x00B[x] stands for the list generation modes of that family, and the exact members and record layouts are defined per CPU and engineering software version, so open the system status list table for the installed CPU in the STEP 7 documentation instead of guessing a variant. Two kinds of member live in the family: enumerating lists that return records for all diagnostic objects without an index, and indexed lists that already demand a diagnostic address as their index, 0x00B4 among them. The addresses you need come only from the enumerating side, read from the address field the documentation defines for each record, and only from complete records of a call that reported success, because SFC51 transfers whole records or nothing.
How do I read the diagnostic addresses step by step with SFC51? #
Call SFC51 RDSYSST twice: once with SSL ID 0x0092 to confirm which slaves the CPU reports, then with the documented 0x00B[x] list that enumerates diagnostic objects, taking each configured diagnostic address from the address field of a successfully returned record.
- Call SFC51 with SSL ID 0x0092 to build the station inventory, and check the return value before reading a single buffer byte.
- Use the returned two-word header, which gives the record length and the record count, and process exactly record count times record length bytes, never past the returned data.
- Store each record's PROFIBUS address as the bus-side identifier only.
- Open the system status list table for the installed CPU and pick the 0x00B[x] member that enumerates diagnostic objects without demanding an address as its index.
- Size a second buffer from that member's documented maximum record, call SFC51 with it, and accept the data only on a successful return value.
- Take each configured diagnostic address from the documented address field of a complete record, and discard records whose type fields mark them as other than DP slave objects.
- If no member of the family returns addresses without an index on this CPU, stop reading lists: the discovery path over SFC51 is closed for that CPU, and the next section applies.
- Keep the two inventories in separate variables, and pair a station address with a diagnostic address only from configuration data or a documented record.
How do I read a slave's diagnostic data once I have its address? #
With a configured diagnostic address in hand, set SSL ID 0x00B4, put that address in INDEX as a double word, clear the destination buffer before the call, and accept the payload only when the return value reports the transfer completed without error.
One call covers one address. On an S7-300 RDSYSST runs synchronously and returns in the same scan, so there is no job to poll: the return value tells you immediately whether the transfer succeeded. Clear or invalidate the destination before the request and publish the parsed record only after a clean return, so bytes left over from a previous read can never masquerade as a new answer. SFC51 always moves whole records into the buffer you pass, and the same header-and-record walk is shown record by record, on a larger CPU with the same block, in reading the S7-400 diagnostic buffer with SFC51 RDSYSST.
What do I do when no status list returns the addresses? #
When every 0x00B[x] member your CPU documents either carries no address field or itself demands an address as its index, SFC51 offers no discovery path, and the correct source is the hardware configuration: open it online from the running CPU, and read each slave's diagnostic address from its properties.
That value is the index 0x00B4 wants. Trial-and-error probing is the wrong tool: a failed index tells you nothing about which addresses exist, and a successful one can belong to an entirely different object, so you would ship a diagnostic display built on coincidence. If the slave is a gateway, the diagnostic address answers for the gateway node, and its remote modules carry their own module addresses behind it; when those modules show up as detected but read no I/O data, fix an S7-300 PROFIBUS gateway detected but reading no I/O data covers that repair. One safety boundary: a polled diagnostic read supports maintenance and troubleshooting, not safety — the machine's response to a lost slave must come from the configured safety function validated against the risk assessment, never from this polling loop.
What does a complete read look like with real numbers? #
In an example project, with every value invented to show the arithmetic, slave A sits at PROFIBUS station address 7 with diagnostic address 1023, slave B at station address 11 with diagnostic address 1026, and the sequence of calls proves that no offset converts the first pair into the second.
The 0x0092 inventory returns station addresses 7 and 11. The documented 0x00B[x] enumeration returns configured diagnostic addresses 1023 and 1026. The tempting shortcut fails on the second slave. From slave A the apparent offset is 1023 − 7 = 1016. Applied to slave B it predicts 11 + 1016 = 1027, but the configured value is 1026, so the prediction misses by 1027 − 1026 = 1. A call with index 1027 reads an object that does not exist here, the return value reports failure and the buffer stays invalid — and had 1027 belonged to some third module, the call would have succeeded while reporting the wrong object.
The correct sequence is two successful calls and no arithmetic: SFC51 with SSL ID 0x00B4 and index 1023 (hex 3FF) returns slave A's record, and index 1026 (hex 402) returns slave B's record. The decision this example forces: the diagnostic address is a value you read from the configuration or from an enumeration record, never a number you derive from the station list.
Which mistakes make SFC51 return nothing or the wrong slave? #
Almost every failed read traces to one of five handling faults: using the station number as the index, trusting a buffer before the return value confirms success, ignoring the header's record count, hardcoding addresses that a recompiled project reassigns, or probing indices the enumeration never returned.
| Symptom | Cause | Fix |
|---|---|---|
| 0x0092 works, 0x00B4 fails or reports another slave | the station number was copied into INDEX | pass the configured diagnostic address from the 0x00B[x] enumeration record or the online configuration |
| Only the first returned record is processed | the header's record count is ignored | iterate exactly record count times record length bytes |
| Old diagnostics survive a failed call | the buffer is consumed without a return-value check | invalidate the buffer before the call, publish the parse only after success |
| Addresses stop matching after a download | addresses were hardcoded from the previous compile | re-read the enumeration or reopen the online configuration after every download |
| Trial indices return plausible but wrong data | the program probes numbers the enumeration never returned | use only documented enumeration records; when none exists, read the online configuration |
The decision for every case on an S7-300: inventory the bus with 0x0092, take diagnostic addresses from the documented 0x00B[x] enumeration or from the hardware configuration read online, and call 0x00B4 once per confirmed address with a cleared buffer and a checked return value. When neither source yields the address, the CPU does not publish it over SFC51 — read the configuration, and never let the program guess.
Questions asked
Does the station address versus diagnostic address split also apply to PROFINET devices?
Yes. PROFINET IO devices are diagnostic objects of the CPU just as DP slaves are, and the device's Ethernet identity never selects a diagnostic object. The PROFINET list identifiers differ from the DP ones used here and live in the same CPU documentation, but the rule is identical: the bus identity says who is on the network, the configured diagnostic address says which object you are reading.
Can I get a failing slave's diagnostic address without polling every slave?
Yes. When a slave or a module fails, the CPU starts its diagnostic interrupt OB, and the start information of that OB carries the diagnostic address of the object that raised the event. Store the address there, then call SFC51 with SSL ID 0x00B4 and that address to pull the full slave record on demand instead of sweeping the bus on a timer.
Why did the diagnostic addresses stop matching after a new download?
Diagnostic addresses are configuration values, and a regenerated or recompiled project can assign them differently than the previous download, especially after hardware edits. Treat every stored address as stale after a download: re-read the enumeration or reopen the online configuration, and rebuild the pairing between station addresses and diagnostic addresses before the next indexed call.
How large should the SFC51 result buffer be?
Size it from the documentation for the specific list, not from habit: take the maximum record length documented for that SSL ID and multiply by the largest number of records the list can return, which for the DP slave lists is the number of configured slaves. Because SFC51 transfers complete records only, a buffer too small for one whole record returns nothing usable, so verify the return value before parsing.