Reducing SFB14 GET Error Detection Time on S7-400 to ET200S

David Krause14 min read
S7-400SiemensTroubleshooting
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

Reducing SFB14 GET Error Detection Time on S7-400 to ET200S IM151-F Partners

An S7-400 CPU acting as the S7 communication initiator using SFB14 "GET" and SFB15 "PUT" to read/write the process image of distributed ET 200S IM151-F stations will typically report a partner failure within 8 to 12 seconds after the remote station is de-energized. For most process applications this is acceptable, but for safety-related shutdowns, high-speed interlocking, and machine tooling with hard stop times under one second, the 10 s default is unusable.

This reference explains the layered timeout stack that produces the 10 s delay, decodes the SFB14/SFB15 STATUS word, and provides four independent methods to reduce detection time down to 1 s or below. All methods can be applied independently or combined.

Field reading first: before changing any S7 connection parameters, capture the current STATUS word at the moment the IM151-F is de-energized. The exact 16-bit code is the single most useful piece of information when reviewing the configuration with Siemens support.

1. System Topology and Components

The standard configuration that produces the 10 s symptom is:

  • Initiator: SIMATIC S7-400 (CPU 414, 416, 417, or 418), with firmware V5.x or V6.x. The CPU's integrated PROFINET interface or a CP 443-1 / CP 443-1 Advanced handles the Ethernet connection.
  • Partner: ET 200S station with IM 151-1 STANDARD, IM 151-1 HF, or IM 151-F (fail-safe) interface module and an S7-CPU as the head of the station.
  • Connection type: S7 connection (configured in NetPro or TIA Portal Devices & Networks), ISO-on-TCP (port 102, RFC1006) on Industrial Ethernet / PROFINET.
  • Function blocks: SFB14 "GET" (read partner data) and SFB15 "PUT" (write partner data) called cyclically from OB1. Both blocks are part of the standard library and have been documented since STEP 7 V5.x. See the SFB14/FB14 GET function description in the Siemens Industry Online Support.

1.1 Why a powered-off partner is a special case

When the IM151-F is de-energized, the link does not go down gracefully. The station stops transmitting immediately, but the electrical link (port LEDs, switch fabric) on the partner side may remain lit for several seconds until the PHY detects loss of carrier. The TCP connection at the initiator's CP is therefore in an unconfirmed state, not a closed state. The initiator must use a timeout to declare the connection broken.

2. Root Cause: The 10 s Delay Is the TCP Retransmission Sequence

The 10 s is not a single timer; it is the sum of three layers:

Layer Mechanism Default value Where configured
Application SFB14 call interval (cycle of OB1) OB1 cycle, e.g. 50 ms User program
S7 protocol S7 connection monitoring time (Tmon) 30 s (S7 default) - 1 s (shortest) NetPro / TIA Portal connection properties
Transport (TCP) Retransmission timeout (RTO) and max retransmissions Initial RTO 1 s, exponential backoff x2, abort after 8-10 s CP / OS TCP stack
Link / PHY Link-down detection 2-5 s after port loses signal Hardware

The observed 10 s typically matches the TCP retransmission sequence. When the initiator CP sends an S7 PDU and receives no acknowledgment (because the partner is off), RFC 6298 governs the retransmission timer:

  1. First retransmit after RTO = 1 s.
  2. Second retransmit at 2 s.
  3. Third retransmit at 4 s.
  4. Fourth retransmit at 8 s.
  5. TCP gives up after 4-5 retransmissions, connection declared broken.

The S7 protocol layer above TCP then sets the connection to DOWN, the CP clears the connection resources, and only then does the next call to SFB14 return ERROR=1 with a non-zero STATUS. The SFB itself does not contain an internal watchdog - it relies entirely on the underlying connection state.

Math check: 1 s + 2 s + 4 s + 8 s = 15 s of waiting between retransmits, but retransmission attempts overlap with new application requests, so the wall-clock detection time is the sum of the last backoff window (8 s) plus the SFB execution jitter (~1-2 s) = 8-10 s. This matches the field observation exactly.

3. SFB14 / SFB15 STATUS Word Decoding

When ERROR=1, the STATUS output is one of the values listed below. The first two bytes are the SFB-internal error class; the second two bytes identify the specific cause.

STATUS (hex) Meaning Typical cause Detection layer
W#16#0001 Communication error (e.g. connection not established, partner unreachable) Partner CPU in STOP, partner off, network partition S7 protocol
W#16#0002 Negative acknowledgment from partner Partner rejects request (e.g. wrong data area, protection level) Application
W#16#0003 DP/PN partner failure PROFINET IO device failure, not a pure S7 issue PROFINET
W#16#0004 Data error / inconsistent length SD_1 / RD_1 / ADDR_1 / LEN parameter mismatch Application
W#16#7000 No communication in progress REQ=0 or no call active SFB internal
W#16#7001 First call with REQ=1, request initiated Normal handshake start SFB internal
W#16#7002 Subsequent call, request in progress Normal handshake continue SFB internal
W#16#0008 Partner resource exhausted Partner S7 connection resources full S7 protocol

For the powered-off partner case, the dominant value is W#16#0001. Capture the lower byte sequence in OB82 (diagnostic interrupt) and OB87 (communication error) for full diagnostics. The Siemens Communication with S7-300/400 manual contains the full STATUS table including the sub-codes for transport-level errors.

4. Method 1 — Reduce the S7 Connection Monitoring Time

This is the simplest change and produces the largest improvement. The S7 connection itself supports a "monitoring time" (Tmon) parameter that is independent of the TCP retransmission. When Tmon elapses without any successful S7 PDU exchange, the S7 layer on the CP forcibly tears down the connection and signals the application.

4.1 STEP 7 V5.x (NetPro)

  1. Open the S7 project in SIMATIC Manager.
  2. Open NetPro (Options > Configure Network).
  3. Select the S7 connection from the S7-400 CPU to the IM151-F CPU.
  4. Open Properties > Special Connection Properties.
  5. Under "Establishment and monitoring of the connection", set Monitoring time = 1 s (minimum is 1 s; below 1 s is not allowed by NetPro).
  6. Save, compile, and download HW Config + NetPro to the S7-400 CPU.

4.2 TIA Portal

  1. Open Devices & Networks.
  2. Select the S7 connection in the network view.
  3. Open Properties > General > Connection mechanisms (or Keep-alive function on newer TIA versions).
  4. Set Monitoring time = 1000 ms.
  5. Compile and download.
Field limit: the S7 monitoring time is enforced by the S7 layer on the CP/CPU. Below 1 s the CP rejects the value during download. If you need sub-second detection, you must combine this setting with one of the application-level watchdogs in section 7, or use a faster protocol (PROFINET IO instead of S7 communication).

5. Method 2 — TCP Keep-Alive Interval Tuning

The TCP keep-alive mechanism is a separate, optional timer. It is normally disabled for S7 communication because Siemens designed the S7 monitoring time to handle the failure case. If you enable it with a short interval, the CP will send an empty TCP ACK probe every N seconds. If no response is received, TCP declares the connection broken after a small number of probes and frees the socket.

5.1 CP 443-1 Advanced Configuration (STEP 7 V5.x)

  1. Open HW Config for the S7-400 station.
  2. Open the CP 443-1 properties > Options tab > Keep-alive.
  3. Set Send keep-alive packets every = 5 s and Maximum number of retries = 3.
  4. This produces worst-case detection in 5 + 5 + 5 = 15 s, which is actually slower than the default. For a faster result, set 2 s / 2 retries = 4-6 s detection. Below 2 s the CP rejects the value.

5.2 Why TCP keep-alive is usually the wrong tool

TCP keep-alive adds extra traffic and does not speed detection much because the timeouts are conservative. Use it only when the S7 monitoring time cannot be shortened (e.g. legacy connection that other systems depend on) and the keep-alive packets can be tolerated on the network.

6. Method 3 — Application-Level Watchdog on SFB14

This is the most flexible approach and the only one that gives sub-second detection. The watchdog tracks the timestamp of the last successful SFB14 call; if the elapsed time exceeds a configurable threshold, the watchdog declares the partner unreachable regardless of what the SFB says.

6.1 SCL implementation (TIA Portal / S7-400)

FUNCTION_BLOCK "FB_PartnerWatchdog"
{ S7_Optimized_Access := 'FALSE' }
VERSION : 0.1
   VAR_INPUT
      i_Enable       : BOOL;    // TRUE while SFB14 is being called
      i_SFB14_Done   : BOOL;    // NDR from SFB14
      i_SFB14_Error  : BOOL;    // ERROR from SFB14
      i_StatusOK     : WORD;    // STATUS = W#16#0000 (success)
      i_Timeout      : TIME;    // e.g. T#1s
      i_CycleTime    : TIME;    // OB1 cycle, e.g. T#50ms
   END_VAR
   VAR_OUTPUT
      q_PartnerOK    : BOOL;    // TRUE if partner has answered within i_Timeout
      q_TimeoutFlag  : BOOL;    // TRUE one cycle after timeout
      q_Elapsed      : TIME;    // time since last successful response
   END_VAR
   VAR
      s_Elapsed      : TIME;
      s_TOF          : BOOL;
   END_VAR
BEGIN
   IF i_Enable THEN
      // Reset on successful response
      IF i_SFB14_Done AND (i_StatusOK = W#16#0000) THEN
         s_Elapsed := T#0s;
         s_TOF     := FALSE;
      ELSE
         s_Elapsed := s_Elapsed + i_CycleTime;
      END_IF;

      // Timeout detection with TOF for one-cycle pulse
      q_Elapsed     := s_Elapsed;
      q_TimeoutFlag := s_Elapsed > i_Timeout;
      q_PartnerOK   := (s_Elapsed <= i_Timeout) AND (NOT i_SFB14_Error);
   ELSE
      q_PartnerOK   := FALSE;
      q_TimeoutFlag := FALSE;
      q_Elapsed     := T#0s;
      s_Elapsed     := T#0s;
   END_IF;
END_FUNCTION_BLOCK;

6.2 STL equivalent (STEP 7 V5.x)

// Instance DB must contain s_Elapsed as TIME and s_TOF as BOOL
      L     #i_Enable
      JC    WDON
      // Disable branch
      T     #q_PartnerOK     // FALSE
      R     #q_TimeoutFlag
      L     #t#0s
      T     #s_Elapsed
      JU    WDEND
WDON: L     #i_SFB14_Done
      L     #i_StatusOK
      <>I                      // SUCCESS = DONE and STATUS=0
      JCN   WDEL
      L     #t#0s              // reset on success
      T     #s_Elapsed
      R     #s_TOF
      JU    WDCHK
WDEL: L     #s_Elapsed
      L     #i_CycleTime
      +D
      T     #s_Elapsed
WDCHK:L     #s_Elapsed
      L     #i_Timeout
      >D
      =     #q_TimeoutFlag
      NOT
      AN    #i_SFB14_Error
      =     #q_PartnerOK
WDEND: NOP   0

6.3 Wiring in OB1

CALL  SFB14, DB14   // GET - existing call
 REQ  := TRUE
 ID   := W#16#1     // connection ID from NetPro
 LEN  := 20
 DONE := NDR14
 BUSY := BUSY14
 ERROR:= ERR14
 STATUS:= STAT14
 RD_I  := P#DB20.DBX0.0 BYTE 20

// Watchdog instance
CALL  FB_PartnerWatchdog, DB100
 i_Enable      := TRUE
 i_SFB14_Done  := NDR14
 i_SFB14_Error := ERR14
 i_StatusOK    := STAT14
 i_Timeout     := T#1s
 i_CycleTime   := T#50ms
 q_PartnerOK   := "DB_Auto".PartnerOK
 q_TimeoutFlag := "DB_Auto".PartnerLostPulse
 q_Elapsed     := "DB_Auto".Elapsed

With the watchdog set to 1 s and OB1 at 50 ms, the application will declare the IM151-F unreachable after approximately 20 OB1 cycles have passed without a successful SFB14 NDR. The detection is bounded by i_Timeout, independent of the TCP retransmission sequence.

7. Method 4 — Replace SFB14/15 with SFB12 BSEND / SFB13 BRCV

The SFB12 "BSEND" and SFB13 "BRCV" blocks perform a different kind of S7 communication: they send and receive segmented, acknowledged data blocks. Crucially, the application can configure the send/receive timeout independently of the S7 monitoring time.

Block Purpose Configurable timeout Typical use
SFB14 GET Read data without partner program Inherits S7 monitoring time Simple polling
SFB15 PUT Write data without partner program Inherits S7 monitoring time Simple setpoints
SFB12 BSEND Send up to 32 KB to partner BRCV Send timeout (R_TC) per call Larger data + custom timeout
SFB13 BRCV Receive segmented data from partner BSEND Receive timeout (R_TC) per call Pair with BSEND

BSEND/BRCV require a partner program on the IM151-F CPU and do not access its process image directly, so they are not a drop-in replacement. They are useful when the S7 monitoring time is the limiting factor and you need detection faster than 1 s.

8. Choosing a Method

Target detection time Recommended method Effort Trade-off
5-10 s (default) No change None Stock behavior
1-3 s Method 1 (S7 monitoring time = 1 s) 15 minutes Lowest risk, no code change
1-5 s Method 1 + Method 3 (watchdog) 1 hour Robust against transient errors
0.5-1 s Method 3 only with i_Timeout = T#500ms 2 hours Risk of false positives during network jitter
<0.5 s Re-architect to PROFINET IO with IRT, or add a hardware watchdog signal Days Major change

9. Verification — Confirm the New Detection Time

After applying the changes, verify the new detection time on a live system with a controlled power-off of the IM151-F.

  1. Connect STEP 7 / TIA to the S7-400 online.
  2. Open the SFB14 instance DB in the watch table (VAT) and add columns for NDR, ERROR, STATUS, and a sweep timestamp.
  3. Set the watch table trigger to Continuous and 200 ms update.
  4. Add the watchdog instance outputs to the same table.
  5. Press record (Start Logging).
  6. Power off the IM151-F station at the 24 V supply (do not unplug the PROFINET cable; that tests a different fault).
  7. Note the wall-clock time between power-off and the first cycle where q_TimeoutFlag rises (or, without the watchdog, the first cycle where ERROR=1 with STATUS=W#16#0001).
  8. Repeat three times and average. Target detection time should be at or below the chosen i_Timeout value (or 1 s if only Method 1 was applied).

9.1 Test cases to include in the same session

  • Power-off IM151-F with 24 V removed. Tests the original symptom.
  • Pull the PROFINET cable from the IM151-F port. Tests link-down detection only (typically 2-3 s, faster than power-off).
  • Stop the IM151-F CPU (MRES or STOP switch). Tests graceful shutdown - detection is much faster, ~50-200 ms, because the CPU sends a STOP announcement.
  • Disconnect the Ethernet switch upstream of the S7-400 CP. Tests network partition - SFB14 detection will be similar to power-off, ~10 s without the watchdog.

10. Troubleshooting Matrix

Symptom Likely cause First action
SFB14 reports ERROR=1, STATUS=0001 after ~10 s TCP retransmission sequence completed Apply Method 1 (S7 monitoring time)
SFB14 reports ERROR=1, STATUS=7000 always REQ=0, no request issued; or connection not configured Check ID parameter and NetPro connection
SFB14 reports ERROR=1, STATUS=0002 Partner rejected (protection, wrong data area) Verify partner access level in CPU properties
SFB14 reports ERROR=1, STATUS=0004 Parameter mismatch (ADDR_1 / RD_1 / LEN) Check ADDR_1 spelling and LEN size
SFB14 reports ERROR=1, STATUS=0008 Partner S7 connection resources exhausted Check partner CPU connection count; max is 16 for IM151-CPU
Detection still 10 s after applying Method 1 HW Config not downloaded; CP running old firmware Re-download HW Config; check CP firmware
Watchdog false-positives during network jitter i_Timeout set too low for normal latency Increase i_Timeout to 2-3x max normal response time
Watchdog never triggers even with partner off i_SFB14_Done being set by DONE bit, not NDR Use NDR (and-or DONE per docs), not BUSY

11. Safety Considerations for IM151-F Stations

If the partner is an IM 151-F with F-CPU functionality, the 10 s SFB14 detection is not the safety-relevant detection path. The fail-safe PROFIsafe communication runs on a separate channel with its own watchdog, typically 100-500 ms. SFB14 over the S7 connection is a non-safety read path. Do not replace PROFIsafe with S7 GET, even with sub-second detection. The SFB14 watchdog should be used for process interlocks, not for SIL-rated safety functions.

12. Document References

Why does SFB14 take 10 seconds to detect a powered-off IM151-F partner?

Detection is dominated by the TCP retransmission sequence on the CP. After the partner goes silent, the CP retransmits the S7 PDU after 1 s, 2 s, 4 s, and 8 s before declaring the connection broken. The S7 monitoring time (30 s default) and SFB14 itself do not add to this. The 10 s wall-clock is the TCP backoff window plus one SFB execution cycle.

What is the fastest possible S7 connection monitoring time on S7-400?

The minimum S7 monitoring time configurable in NetPro and TIA Portal is 1 second (1000 ms). The CP rejects values below 1 s during download. For sub-second detection, use the application-level watchdog (Method 3) on top of the 1 s S7 setting, giving combined detection in 1-2 s with very high reliability.

Can TCP keep-alive reduce the SFB14 detection time below 10 s?

Yes, but only marginally. With a 2 s keep-alive interval and 2 retries, detection is 4-6 s - faster than the 10 s default but still slow. The S7 monitoring time (Method 1) is always a better first choice because it produces 1 s detection with no extra network traffic. Keep-alive is useful only when the S7 monitoring time cannot be changed.

Does lowering the S7 monitoring time to 1 s cause false positives on a slow network?

In practice no, because the S7 monitoring time is only checked when the S7 layer detects a problem with the connection. Normal S7 PDU exchanges reset the timer on every successful PDU. False positives only occur if the network is so congested that an entire second passes without any S7 PDU exchange, which indicates a real fault regardless of partner state.

Should I use SFB14/15 or PROFINET IO for sub-second partner failure detection on ET200S?

For partner-failure detection specifically, PROFINET IO with IRT and a configured watchdog time of 1-3 ms is the correct architecture. SFB14/SFB15 over S7 communication is designed for non-critical, slower process data exchange. If sub-second detection is required, migrate the IM151-F data to PROFINET IO and use the PNIO diagnostic interrupts (OB82) instead of SFB14. Keep SFB14 only for non-time-critical partner data such as parameter sets, configuration, or diagnostics.

Back to blog