Problem Description
The SIMATIC S7-315-2DP CPU unexpectedly transitions to STOP mode shortly after a Profibus network configuration is downloaded. The diagnostic buffer of the affected CPU contains an entry similar to:
STOP caused by PG stop operation or by SFB 20 "STOP" — Event ID 0x4300 / OB not loaded fault.
The Bus Fault LED (BF or BF1, depending on the interface) is illuminated or flashing on the master CPU. The slave CPU (another S7-300 / S7-400 station on the same Profibus segment) shows no SF or BF, yet when the engineer places both controllers in Online > Monitor/Modify the status reports STOP on both. Searching the project tree confirms that no SFB 20 instance exists anywhere in the offline program of either PLC, which leads the engineer to suspect a missing block.
This combination of symptoms — STOP without a corresponding SFB 20 instance, BF active on the master, and a diagnostic buffer that names SFB 20 — almost always points to a Profibus configuration error rather than a missing function block.
Root Cause Analysis
The diagnostic buffer entry wording is misleading. The S7-300 firmware (CPU 31x-2 DP, firmware V2.x through V3.3) groups several possible causes under the same event text. The string "PG stop operation or by SFB 20 STOP" means the CPU received a request to enter the STOP operating state from one of two sources:
- A programming device (PG) executing PLC > Stop or sending a STOP command over the MPI/Profibus interface.
- An SFB 20 "STOP" call executed in another station on the Profibus network that targets this CPU.
Because SFB 20 is the only standard function block in the S7 Communication (S7-Functions) library that can issue an unsolicited remote STOP, the firmware logs this combined event whenever no OB is available to mask the cause. In practice, on dual-CPU Profibus projects that have never been configured with SFB 20, the entry is almost always produced by:
- A Profibus slave-side configuration error that propagates a bus fault to the master.
- A mismatch between the configured Profibus address, baud rate, or bus parameters (Tslot, Ttr, Tset, GAP factor) on the two stations.
- An OB82 / OB86 / OB122 organization block that is not loaded, so the CPU is forced to STOP on the first reported fault.
The lit or blinking BF LED on the master is the second key indicator. According to the SIMATIC S7-300 CPU 31xC and CPU 31x Operating Instructions, a steady BF means a bus fault (physical layer or configuration), while BF1 blinking at 0.5 Hz indicates that the configured slave is unreachable or that the DP master has lost logical token ownership.
What SFB 20 Actually Is
SFB 20 "STOP" is one of the S7 communication function blocks described in the Siemens S7-300/400 Communication Function Blocks manual. It is part of the integrated S7 Communication (S7-Functions) family and does not require a separate licence.
| Attribute | Value |
|---|---|
| Block number | SFB 20 |
| Symbolic name | STOP |
| Family | S7 Communication (S7-Functions) |
| Function | Sends a STOP command to a remote S7-CPU |
| Input parameters | REQ (BOOL), I_DB (ANY), STOP_SNDR (BOOL), CNTRL_NO (INT) |
| Output parameters | DONE (BOOL), ERROR (BOOL), STATUS (WORD) |
| Required OBs | OB 1, OB 100; the call is processed in OB 1 |
| Available in | S7-300 (CPU 31x), S7-400, ET 200S CPU |
| Documentation | Siemens S7 Communication Function Blocks manual (entry ID 44240604) |
SFB 20 is invoked only when an application program intentionally needs to halt another CPU. If your program never contains a CALL SFB 20 call and no other station in the project is configured as an S7-Communication client targeting your CPU with a STOP job, SFB 20 cannot be the actual cause of the event. The diagnostic buffer is naming a category, not a block present in your code.
Interpreting the Diagnostic Buffer
Open the diagnostic buffer of the affected CPU with STEP 7 V5.5 (or TIA Portal for migrated projects) and review each entry chronologically. The pattern in most reported incidents is:
| Entry | Typical Event Text | Meaning |
|---|---|---|
| 1 | Mode transition from RUN to STOP | The actual state change |
| 2 | STOP caused by PG stop or by SFB 20 | Categorical event (origin unclear) |
| 3 | Distributed I/O: station failure | Profibus slave lost |
| 4 | OB not found / OB loading error | OB 82, OB 86, or OB 122 not present |
| 5 | Parameter assignment error on DP master | HW Config inconsistency |
If entries 3–5 precede entry 2, the root cause is configuration, not a missing SFB. If the diagnostic buffer is dominated only by entry 2 with no preceding DP-related events, suspect a PG-side remote STOP command — STEP 7's PLC > Stop action from another laptop still connected via TCP/IP to the same subnet can produce this entry even hours after the engineer left the plant.
Preconditions Before Rebuilding
Before modifying the project, perform the following checks. These isolate the failure in less than ten minutes and often resolve the STOP event without further intervention:
- Verify that OB 82 (diagnostic interrupt), OB 86 (rack failure), and OB 122 (I/O access error) are present in the offline project and downloaded to the CPU. The S7-300 enters STOP if these are missing and a Profibus fault occurs.
- Open HW Config, right-click the DP master interface, and select Properties > Profibus. Confirm the master address (default 2) and operating mode DP-Master are set.
- Confirm that the slave CPU is configured with operating mode DP-Slave and that its Profibus address does not collide with the master.
- Verify the segment baud rate matches on both stations (default 1.5 Mbit/s; supported: 9.6 kbit/s up to 12 Mbit/s for S7-315-2DP).
- Confirm that the Set PG/PC Interface in SIMATIC Manager is bound to the correct network adapter. Selecting the wrong TCP/IP interface on a multi-NIC laptop is the most common reason for a downstream PG stop appearing in the buffer.
Step-by-Step: Rebuild the Profibus Configuration from a Sample
The fastest path to a clean configuration is to start from a known-good sample supplied with STEP 7 V5.5 and modify it incrementally. Do not try to repair a corrupted project tree in place.
Step 1 — Create a new S7 project
- Launch SIMATIC Manager and choose File > New Project.
- Insert two SIMATIC 300 stations: Master_CPU and Slave_CPU.
- Open HW Config on each station and load the appropriate hardware: PS 307, CPU 315-2 DP (6ES7 315-2AG10-0AB0 or higher), and the required DI/DO modules.
Step 2 — Configure the DP master interface
- In Master_CPU / HW Config, double-click the DP port of the CPU 315-2DP.
- Click Properties > New to create a Profibus subnet with address 2 and baud rate 1.5 Mbit/s.
- Set the operating mode to DP-Master.
- Click OK twice and save + compile (Station > Save and Compile).
Step 3 — Configure the DP slave interface
- Switch to Slave_CPU / HW Config.
- Double-click the DP port of the slave CPU.
- Select the same Profibus subnet and assign address 3.
- Set the operating mode to DP-Slave.
- Under Configuration > Slave Configuration, define at least one slot (e.g., 4 bytes of input / 4 bytes of output) so that the master has data to map.
Step 3a — Enable S7 Communication in the slave (only if SFB 20 is actually required)
If a future requirement exists to stop the slave from the master using SFB 20, the slave must expose an S7 connection. Right-click the CPU in HW Config of the slave and select Properties > Communication. Under S7 Communication enable Active connection establishment and create an S7 connection on the master pointing at the slave's Profibus address. Without this connection block, any SFB 20 call returns STATUS = W#16#0001 (communication error).
Step 4 — Insert required OBs
- Right-click Blocks in Master_CPU and Insert New Object > Organization Block.
- Add OB 82, OB 86, OB 100, and OB 122. Use OB 100 to perform a startup without error-clearing — this prevents the CPU from going into STOP on the first Profibus interruption during warm restart.
Step 5 — Establish data exchange
Insert a small exchange program in OB 1 of the master that reads the slave's inputs via CALL SFC 14 "DPRD_DAT" and writes outputs via CALL SFC 15 "DPWR_DAT". Do not insert SFB 20 unless the application genuinely needs to issue a remote STOP. The most common mistake is to drag the SFB 20 symbol into OB 1 from a tutorial without recognising that CALL "STOP" , DB20 is a syntax mismatch — the block is SFB 20, not FB 20, and the instance is the SDB allocated by STEP 7, not a manually created DB 20.
Step 6 — Save, compile, download
- Save both stations.
- Download Master_CPU first, then Slave_CPU. Use PLC > Download rather than the toolbar.
- After the download, perform a PLC > Cold Restart on each CPU individually rather than letting the CPU self-initialize.
Verifying the Fix
Verification is straightforward once the configuration is rebuilt:
- Observe the LEDs of both CPUs with the panel door closed for at least two minutes.
- SF (red) on both = OFF
- BF (red) on master = OFF (steady) and BF1 on the DP interface = OFF
- RUN (green) on both = ON, blinking at 2 Hz
- In SIMATIC Manager select Master_CPU > Online > Monitor/Modify. The Operating Mode field must display
RUNand not toggle. - Force a Profibus interrupt by unplugging the Profibus connector on the slave for 5 seconds. The master CPU must remain in RUN. If it falls back to STOP, OB 86 is missing from the project — return to Step 4.
- Read the diagnostic buffer again. The expected pattern is:
- Power-on event from the recent restart
- DP slave failure / return events during the connector test
- No new STOP event
- If a Profibus diagnostics repeater (6ES7 972-0AB01-0XA0) is in the segment, its front-panel LED must not show Segment Fault. Steady or cyclic segment faults indicate a cable break or a missing terminating resistor (switch must be ON at both physical ends only).
When the Diagnostic Buffer Really Does Mean SFB 20
There is one scenario where SFB 20 is the actual culprit: a multi-CPU S7-300 project where one CPU is the designated S7-Communication client and another is the server, and the client calls SFB 20 against the server. If the server's Protection level is set to Operating Mode Selector — Mode 2 or higher, the CPU rejects the remote STOP and instead records an access error. If protection is set to No protection or Write-protect, the STOP is accepted. To verify whether SFB 20 is being called:
- Search the entire project for the string
SFB 20using Options > Cross References. - Check all S7 connection partners on the Profibus subnet: in NetPro, right-click each connection and verify its Active Connection Establishment attribute.
- If a partner station actively establishes an S7 connection and calls SFB 20, decide whether the remote STOP is intentional. If not, disable the call in the partner CPU or set the target CPU's protection level to Mode 2 so the request is rejected with STATUS =
W#16#0831(protection violation).
Troubleshooting Matrix
| Symptom | Likely Cause | First Action | Reference |
|---|---|---|---|
| BF steady on master | No Profibus cable or termination | Verify cable and 220 Ω terminators at both ends | Profibus Installation Guide 6ES7 971-1AA00-0AA0 |
| BF1 blinking at 0.5 Hz | Slave address mismatch | Compare HW Config slave address with DIL switch on slave CPU | CPU 31xC Operating Instructions |
| SF lit, BF off, STOP entry | OB 82/86/122 missing | Insert OBs in HW Config / Blocks | S7-300 Programmable Controller manual |
| STOP event names SFB 20, no SFB 20 in project | PG-issued STOP command | Disconnect all PG Ethernet cables and observe buffer | Diagnostic Buffer manual entry ID 44063853 |
| STOP only after warm restart | OB 100 not loaded | Insert OB 100 with neutral content (empty BE) | S7-300 Instruction List |
| STOP cyclic at 60 s intervals | Watchdog or scan-time overrun | Check OB 1 cycle time via online diagnostics | CPU 31xC manual section 11.4 |
| STOP with STATUS = 0x0022 | Programming error in OB 1 | Open the diagnostic buffer stack | S7-300 CPU 31xC manual appendix A |
Common Pitfalls
CALL "STOP", DB20 after seeing the symbolic name. STOP is the symbolic name of SFB 20; it is not a function (FC). Calling it with a manually created DB 20 results in the type-conflict compiler error "Type conflict for STOP". Either delete the call or, if SFB 20 is genuinely needed, let STEP 7 auto-generate the instance DB by inserting the block from the library with Insert > S7 Communication > STOP.
BE instruction suppresses the STOP, but the diagnostic event remains in the buffer.
Related Function Blocks and SFCs
| Block | Name | Purpose in the SFB 20 workflow |
|---|---|---|
| SFB 8 | USEND | Uncoordinated send to remote partner |
| SFB 9 | URCV | Uncoordinated receive from remote partner |
| SFB 12 | BSEND | Block-oriented send (up to 32 KB) |
| SFB 13 | BRCV | Block-oriented receive |
| SFB 14 | GET | Read data from remote partner |
| SFB 15 | PUT | Write data to remote partner |
| SFB 20 | STOP | Place a remote CPU in STOP |
| SFC 12 | D_ACT_DP | Activate / deactivate a DP slave |
| SFC 14 | DPRD_DAT | Read consistent DP slave data |
| SFC 15 | DPWR_DAT | Write consistent DP slave data |
For most dual-CPU Profibus applications, SFC 14 and SFC 15 (DP data read/write) are sufficient. SFB 20 is reserved for explicit shutdown logic between coordinated controllers — for example, a line master forcing a downstream cell controller into STOP during a controlled line halt.
FAQ
Does the SFB 20 message in the diagnostic buffer mean the block is missing from my program?
No. The event text "STOP caused by PG stop operation or by SFB 20 STOP" is a categorical firmware entry that covers two completely different sources. If the offline project contains no CALL to SFB 20, the entry is almost always a PG-issued STOP command, or it is a category label covering a Profibus configuration fault whose detailed events were overwritten. Verify by reading the entries immediately before the STOP event in the buffer.
Why does my S7-315-2DP show BF1 blinking when both Profibus cables are connected?
BF1 blinking at 0.5 Hz on a CPU 315-2DP means the DP master has logical token ownership but cannot find one or more configured slaves. The most frequent causes are: slave address mismatch between the DIL switch on the slave CPU and HW Config, different Profibus subnet selected on each station, or a baud rate mismatch (for example, 1.5 Mbit/s on master and 500 kbit/s on slave). Verify each parameter in HW Config against the physical hardware.
Which OBs must be present to keep the CPU in RUN when a Profibus slave fails?
Insert OB 82 (diagnostic interrupt), OB 83 (insert/remove module interrupt), OB 86 (rack failure), and OB 122 (I/O access error). With all four loaded, the CPU continues running on a Profibus fault; without them, it transitions to STOP. OB 100 (warm restart) and OB 102 (cold restart) should also be present to control startup behaviour.
Can SFB 20 be called without an S7 connection configured in NetPro?
SFB 20 relies on an S7 connection that is established by the calling CPU. If no connection is configured in NetPro between the two stations on the Profibus subnet, the call returns STATUS = W#16#0001 (communication error) and the target CPU is not stopped. The standard remedy is to create an S7 connection in NetPro, assign Active connection establishment to the calling CPU, and recompile.
Is the CPU 315-2DP still supported in STEP 7 V5.5 for new projects?
Yes. The CPU 315-2DP order numbers 6ES7 315-2AG10-0AB0 (firmware V2.x) and 6ES7 315-2AH14-0AB0 (firmware V3.x) are both supported in STEP 7 V5.5 SP4 and later. For new installations Siemens recommends the CPU 315-2 PN/DP (6ES7 315-2EH14-0AB0) which integrates Profinet, but the older DP-only variants remain fully serviceable.