S7-400 Profibus: Removing DP Slaves Without HWConfig Download

David Krause15 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

1. Overview

The question of whether a full HWConfig download is mandatory when an interface module and its downstream DP slaves are physically removed from the last segment of a Siemens SIMATIC S7-400 PROFIBUS network is one of the most common configuration-management dilemmas on brownfield plants. Two practical engineering paths exist:

  1. Path A — Modify and re-download HWConfig: the canonical, fully documented Siemens procedure. Always used when the topology changes are permanent and the system is in a maintenance window.
  2. Path B — Software deactivation via SFC 12 (D_ACT_DP): allows the CPU to logically mark a DP slave as "deactivated" at runtime, suppressing diagnostic interrupts and access errors, without modifying the hardware project. The physical module can be removed and the rest of the network will keep running.

This reference covers both methods in full, with the parameter set, OB requirements, restrictions, edge cases, and a verification matrix. The procedures are valid for S7-400 CPUs (CPU 412/414/416/417) with integrated DP interface or external CP 443-5 as of STEP 7 V5.5 / S7-GRAPH / S7-SCL, and remain valid in TIA Portal projects with S7-400 stations running legacy mode.

Warning: Path B is a logical deactivation only. The slave still occupies its configured PROFIBUS address. If the slave is replaced by a different physical device on the same address, the CPU will still treat the configured description as authoritative.

2. Prerequisites

Item Specification Notes
CPU CPU 41x-2/3 PN/DP or CPU 41x-3 with DP master interface Firmware ≥ V5.1 recommended for full SFC 12 support
STEP 7 V5.5 SP4 or higher, or TIA Portal ≥ V15 with S7-400H/S7-400 legacy support package SFC 12 has been present since STEP 7 V3.x
Online connection PROFIBUS DP MPI cable (PC adapter USB) or Ethernet routing via PN/IE Routing permits direct download without site visit
Passwords / access rights CPU password (write protection) must be known Operating mode selector must allow "RUN-P"
Diagnostic addresses Configured in HWConfig for every DP slave Diagnostic address ≠ PROFIBUS address
Fault OBs OB 85, OB 86, OB 100 (or OB 101/102 for restart class), OB 121/122 Missing OBs will stop the CPU on first failure

3. Method A — Modify and Re-Download HWConfig

3.1 When to use it

  • The removed module is permanent and the new project must reflect the as-installed state.
  • Documentation and audit requirements mandate an updated CAx data set.
  • You intend to add new DP slaves to the freed bus address in the same maintenance window.

3.2 Procedure

  1. Open the STEP 7 project that contains the S7-400 station.
  2. Launch HWConfig from the SIMATIC Manager toolbar or the TIA Portal "Devices & Networks" editor.
  3. Navigate the PROFIBUS subnet. Right-click the DP master (CPU or CP) and choose PROFIBUS > Subnet Properties; verify the bus profile (DP, Universal, User-defined) and transmission rate (typically 1.5 Mbps or 12 Mbps).
  4. Identify the slave at the last segment. Right-click the slave station, then select Delete. Confirm that the connected I/O module(s) of that slave are also removed from the table view.
  5. If the slave sits behind a repeater or coupler that stays in the network, the repeater/coupler must remain in the configuration.
  6. Save and compile. The Compile HWConfig action regenerates the system data blocks (SDBs) — SDB 0, SDB 1, SDB 2, and the DP-specific SDBs (SDB 1000+).
  7. Switch the CPU to STOP, or schedule a hot restart per project setting (CPU 417H / 414H only with synchronization). For S7-400 standard CPUs, full download requires STOP mode; partial download for connected / non-connected configuration changes requires an S7-400 CPU with Configuration in RUN (CiR) capability, which is supported on CPU 41x FW ≥ V5.1.
  8. Download the new HWConfig to the target station. Monitor the diagnostic buffer; look for Parameter assignment of module OK and the absence of Station failure events for the surviving slaves.
  9. Switch the CPU to RUN. Verify that the process image updates as expected.
CiR (Configuration in RUN): S7-400 supports CiR on CPUs with firmware V5.1 or higher. CiR allows I/O add/remove in RUN. For the removal case, the system can be configured to keep the previously connected slaves online while the deleted slave is logically isolated. This is the cleanest path when the CPU must not stop.

4. Method B — Software Deactivation with SFC 12 (D_ACT_DP)

4.1 The D_ACT_DP mechanism

SFC 12 is the standard CPU system function used to deactivate and activate configured DP slaves. When the CPU receives the deactivate command, it:

  1. Logs the slave out of the cyclic PROFIBUS frame.
  2. Stops I/O access and substitutes configured substitute values (or the previous value, depending on the parameter assignment).
  3. Suppresses the station failure diagnostic (OB 86 is not triggered) and suppresses process image updates for that slave.
  4. Stops module I/O error (OB 85) on the diagnostic address.

4.2 SFC 12 interface

Parameter Declaration Type Description
REQ INPUT BOOL Rising edge starts the job. Rising-edge triggered — not level-triggered.
MODE INPUT BYTE 0 = Check status, 1 = Deactivate, 2 = Activate
LADDR INPUT WORD Diagnostic address (slot 0) of the DP slave, not the PROFIBUS address.
RET_VAL OUTPUT INT Return value; 0 = OK, non-zero = error code.

4.3 Critical restrictions on SFC 12

  • Not allowed in startup OBs: SFC 12 cannot be called from OB 100 (warm restart), OB 101 (hot restart), or OB 102 (cold restart). Reason: during startup the PROFIBUS master is in the process of parameterizing the slaves; deactivation would race the system data download.
  • Not allowed in a programmed loop: the call must be edge-triggered. Calling SFC 12 every cycle is technically legal but undesirable — it issues a new job every cycle.
  • OB 1 may be used, but is discouraged. Siemens explicitly recommends wrapping the call inside an FC or FB, then calling that block from OB 1. This keeps OB 1 lean and matches the "OB = block container" philosophy of well-structured STEP 7 code.
  • Not allowed for PROFINET IO devices on S7-400 PN/DP CPUs in all firmware versions. SFC 12 targets DP (PROFIBUS) only. For PROFINET IO deactivation, use SFC 12-equivalent (PNIO functions in STEP 7 ≥ V5.5 SP2) or an IO device port disable.
  • Cannot be used on the DP master itself. Use MODE = 0 (status check) to read the current state without side effects.

4.4 Standard error codes (RET_VAL)

RET_VAL Meaning Action
0000h Job completed, slave deactivated/activated None
8090h Addressed module does not exist or wrong LADDR Re-check diagnostic address in HWConfig
8091h Diagnostic address of the DP master — invalid Pick the slave address, not the master
8092h DP slave configured for DP-V1 with non-supported mode Check CPU FW / SDB compatibility
80A1h / 80A2h Job cannot be executed in current CPU state Wait, retry on next OB 1 cycle
80B0h Slave is in deactivation/activation transition Poll MODE=0 to wait until ready
80B1h Function not supported by CPU FW Update CPU firmware
80B2h Slave is in a PROFIsafe group — cannot be deactivated Re-design safety architecture
80B3h DP slave configured but not present on bus Check physical wiring / termination
80C0h Deactivation failed due to active CiR reserve Release CiR reserve in HWConfig
80C1h Activation failed — slave did not respond within watchdog Check slave power supply and PROFIBUS termination
80C2h Diagnostic address in use by another module Re-assign diagnostic addresses
80C3h CPU is in startup (OB 100/101/102) Move SFC 12 call out of startup OB

4.5 Sample code (Structured Text / SCL)

FUNCTION_BLOCK FB_DeactivateDpSlave
VAR
    bDeactivate : BOOL := FALSE;     // Trigger input
    bBusy       : BOOL;
    bDone       : BOOL;
    bError      : BOOL;
    wRetVal     : INT;
    bEdgeHold   : BOOL;              // Edge memory
END_VAR

BEGIN
    // Rising-edge detection
    IF bDeactivate AND NOT bEdgeHold THEN
        // Issue a single SFC 12 call (MODE = 1 = deactivate)
        RET_VAL := D_ACT_DP(
            REQ   := TRUE,
            MODE  := 1,
            LADDR := W#16#0FA0          // Diagnostic address of the slave
        );
        IF RET_VAL = 0 THEN
            bDone  := TRUE;
            bError := FALSE;
        ELSIF (RET_VAL >= 16#80A0) AND (RET_VAL <= 16#80C3) THEN
            bError := TRUE;
        ELSE
            bBusy := TRUE;             // Job in progress, poll next cycle
        END_IF;
    END_IF;

    bEdgeHold := bDeactivate;
END_FUNCTION_BLOCK

Call this FB from OB 1 only. Do not place the call in OB 100/101/102 or in a cyclic timer that re-issues REQ every cycle. After successful deactivation, the slave is no longer polled on PROFIBUS and OB 86 is suppressed. The physical module can be powered down and removed.

4.6 Ladder logic equivalent

Network 1: rising-edge SFC 12 call
    "Deactivate_Slave_Start"   "Deactivate_Edge"
        |P|----[Call SFC 12 (D_ACT_DP)]----( )--|
        |   |   REQ := "Deactivate_Edge"        |
        |   |   MODE := 1                       |
        |   |   LADDR := W#16#0FA0              |
        |   |   RET_VAL=> "DB_Diag_Deact".RET  |
        |   |-----------------------------------|
        |                                        |

5. Fault OB Requirements

Whenever a DP slave disappears — even if the disappearance is intentional — the CPU will normally raise the following asynchronous events:

Event Triggered by Default behavior if OB absent Recommended OB
Station failure / return DP slave enters or leaves the cyclic polling CPU goes STOP on first occurrence OB 86
Priority class error (I/O access) Process image update fails on absent slave CPU goes STOP OB 85
Module I/O access error (synchronous) L PB / L PI on a non-existing address CPU goes STOP OB 121 / OB 122
Watchdog / failure of the DP master interface Hardware failure of the IF module CPU goes STOP if the master is part of the CPU OB 87 (S7-400 only)

Even when using SFC 12, keep OB 85 and OB 86 loaded as empty blocks. Although SFC 12 suppresses the station-failure interrupt, any peripheral access inside the user program that targets a removed input or output word will still trigger OB 85 unless OB 121/122 handles it. With both fault OBs in place, the rest of the network continues operation unaffected.

6. Step-by-Step: SFC 12 Deactivation Procedure

  1. Open the existing STEP 7 project; do not delete the slave in HWConfig yet.
  2. In HWConfig, note the diagnostic address of the slave to be removed (the first I/O row of the slave, slot 0). This is the value that goes into SFC 12's LADDR.
  3. Create a new FB (e.g., FB_Deactivate_DpSlave) in the S7 program and implement the SFC 12 call (see §4.5).
  4. Add an instance DB and call the FB from OB 1, gated by a flag (e.g., Deactivate_Slave_X) that is set via HMI or PG during the maintenance window.
  5. Compile the S7 program and download only the changed blocks (no full HWConfig download).
  6. Verify with STEP 7 > Online > Monitor/Modify that the SFC 12 call returns 0. The slave's diagnostic address will change from "OK" to "deactivated" in the online view.
  7. Check the CPU diagnostic buffer for the entry "DP slave deactivated by user" (event ID 0xE4C4 or similar depending on firmware).
  8. Switch off power to the slave (and its downstream I/O on the last segment). Disconnect the PROFIBUS connector if the segment is being physically dismantled.
  9. Run the surviving plant for a verification period; confirm no OB 85 / OB 86 entries appear.
  10. Optionally, after a stable period (typically 30–60 days), re-open HWConfig and remove the slave for documentation consistency. This second step requires a planned download.
Termination: after the slave is powered down, the bus segment terminator must remain. If the removed slave was the bus terminator at the end of the segment, the next-to-last device must be re-terminated manually. Activate the termination resistor on the PROFIBUS connector or the active RS485 terminator block on the new last station.

7. Verification Matrix

Check Tool / Method Expected Result
CPU in RUN after removal PG → Online → Accessible Nodes Mode = RUN, no STOP transitions
No OB 85 / OB 86 triggers CPU diagnostic buffer No "Station failure" or "I/O access error" events for the surviving slaves
SFC 12 RET_VAL Watch table on the instance DB 0000h after the trigger
Bus topology intact PROFIBUS diagnostics (BT 200, SINEC NMS, or BT 870 repeater LEDs) No short circuit, no excessive reflections, both ends terminated
Process image of remaining slaves Watch table or HMI live values Update as expected
Diagnostic buffer entry CPU diagnostic buffer "Deactivation of DP slave (LADDR=...) by user"
Substitute values for removed inputs Watch table Inputs forced to configured substitute value (typically 0)

8. Edge Cases and Field-Proven Caveats

  • PROFIsafe slaves: SFC 12 returns error 80B2h if you try to deactivate a slave that participates in a PROFIsafe group. The safety layer relies on a continuous response time; removing the slave will disarm the safety function. Modify the F-CPU's PROFIsafe configuration first.
  • Y-link / DALI / IE/PB-Link behind the slave: if the slave is a DP/PA coupler (e.g., IM 157-0AA82) that bridges to PROFIBUS PA, the entire PA segment downstream is unreachable. SFC 12 with a single call disconnects the entire coupler. Recompute T_tr_max and Number of call attempts in HWConfig for the new (shorter) topology.
  • DP-V1 and DP-V2 slaves: SFC 12 is fully supported for DP-V0/V1/V2 slaves in the data area. The iSlave_LEN parameter is irrelevant for SFC 12 (the system function uses the diagnostic address only).
  • Repeater in a chain: the last segment's terminator may be on a Siemens RS 485 Repeater instead of the slave itself. Leave the repeater powered and the termination switch on; the slave is downstream of the repeater.
  • Multiple slaves with the same diagnostic address: SFC 12 will fail with 80C2h. Diagnostic addresses are CPU-side and must be unique. Re-assign via HWConfig and download before retrying.
  • Hot Swap of the S7-400 interface module: if the IF module is the DP master (e.g., a CP 443-5 Extended in a separate slot) and is itself the one being removed, SFC 12 cannot help. The CP must be physically present for the bus to operate. Removing the master is a separate change with project redesign.
  • CPU 410 with mixed S7-400 / S7-1500 functionality: SFC 12 behavior is the same; the firmware ≥ V8.x is required.
  • ET 200M with hot-swap modules: the station is not removed; SFC 12 is not appropriate. Use SFC 59 / SFB 52 for diagnostic reads of the individual ET 200M slots.

9. Troubleshooting Matrix

Symptom Likely Cause Action
CPU goes STOP immediately after slave power-down OB 85 / OB 86 missing Load empty OB 85 and OB 86, re-download blocks, restart CPU
SFC 12 returns 8090h Wrong LADDR — peripheral address used instead of diagnostic address Open HWConfig → slave properties → "Diagnostic" tab; use that address
SFC 12 returns 80B0h continuously Job not yet finished; another job in the same queue Use MODE=0 to poll status; do not re-trigger while busy
Slave reappears in the buffer after deactivation Another component is sending diagnostic frames Check the bus for unintentional masters; check terminator
Inputs from the removed slave are still updating Deactivation was not triggered or returned an error Verify RET_VAL=0; verify flag controlling the call is true
CPU diagnostic buffer shows "Station return" of the removed slave Slave is still powered (e.g., backplane supply), still answering polls Verify physical power; remove the bus connector
PROFIBUS bus is sluggish after removal Wrong terminating resistor — last station's bus terminator is off Enable terminator on the new last device
CPU STOP with "Module failure on slot 0" Process image access to a removed address; OB 121/122 not loaded Load OB 121 / OB 122; refactor code to skip removed addresses
SFC 12 deactivates wrong slave Address conflict — diagnostic address duplicated Re-check HWConfig; addresses must be unique

10. Field Commissioning Notes

Two practical habits separate a successful SFC 12 deactivation from a CPU stop:

  1. Always load OB 85 and OB 86. A 6-byte empty block in the program prevents the most common STOP cause during planned maintenance.
  2. Document the LADDR ↔ PROFIBUS address mapping in a separate watch DB, not inside the FB instance. The HMI or maintenance engineer may need to type in the address when a PG is not available. A simple WinCC text field bound to a status DB is sufficient.

For plants governed by FDA 21 CFR Part 11 or similar audit regimes, the SFC 12 path is acceptable provided the audit log captures the deactivation event with the user ID. STEP 7's audit log on the PG side records the operator's user account; the CPU's diagnostic buffer records the deactivation with a timestamp. Pair the two for traceability.

Do I have to download a new HWConfig if I only remove a slave at the end of the bus?

Not necessarily. If the slave is configured but not required for the running process, you can deactivate it at runtime using SFC 12 (D_ACT_DP) and download only the changed S7 blocks. A full HWConfig download is still required if you want the project to reflect the new as-installed state permanently.

Can I call SFC 12 in OB 100 (warm restart)?

No. SFC 12 is not permitted inside startup OBs (OB 100, OB 101, OB 102). The PROFIBUS master is still parameterizing the slaves during startup; a deactivation call would race the configuration. Move the call to a FC/FB invoked from OB 1.

Which address does SFC 12 use — the PROFIBUS address or the diagnostic address?

SFC 12 uses the diagnostic address configured in HWConfig (the slot-0 address), not the PROFIBUS address. The diagnostic address is CPU-side and must be unique. The PROFIBUS address (1–126) is bus-side.

Why does the CPU still go to STOP after the slave is removed even though I called SFC 12?

Either SFC 12 was never executed (RET_VAL ≠ 0), or the user program is still performing direct I/O access to the removed address. Load OB 121/OB 122 to mask synchronous access errors, and verify the SFC 12 call with a watch table before the physical removal.

What happens to the inputs from a deactivated DP slave?

By default, the inputs are forced to the configured substitute value (0 if not specified). Output modules stop writing to the process; any read-back via L PB on a deactivated address returns the substitute value or last valid value, depending on the CPU's parameter assignment.

Is SFC 12 supported on PROFINET IO devices for S7-400 PN/DP CPUs?

No. SFC 12 only operates on PROFIBUS DP slaves. For PROFINET IO deactivation, use the equivalent SFB / SFC functions of STEP 7 V5.5 SP2 or higher, or TIA Portal's "Deny" function on the IO device port.

Back to blog