Fixing STEP 7 Rewire Failures with Protected FBs (FB63/FB65)

David Krause14 min read
HMI ProgrammingSiemensTroubleshooting
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

Engineers running STEP 7 V5.4 (specifically V5.4+SP1+HF1 and similar service packs) encounter a recurring failure when the SIMATIC Manager Rewire function is invoked against blocks protected with KNOW_HOW_PROTECT. The symptom is consistent: after selecting an FB-number replacement (for example, renaming FB63 to FB3 and FB65 to FB5), the rewiring step closes without a clear error dialog, but the call references inside the protected source remain unchanged in subsequent cross-references. In some installations the operation appears to succeed on the first invocation and then silently fails on repeat invocations against the same protected block.

The issue is especially disruptive on programs that use the standard S7 communication library — FB63 TCON (open ISO-on-TCP/TCP/UDP connection establishment), FB65 TSEND (send data), and the related blocks FB64 TRCV and FB66 TDISCON — because their absolute FB numbers are not stable across SIMATIC installations. Many shops enforce an internal numbering policy (for example, user FBs only between FB1 and FB100) and reserve FB63 through FB66 strictly for the Siemens library. The Rewire function is precisely the tool that performs that mass rename, but it does not deliver on protected FBs in the documented manner.

This reference captures the workarounds that have been validated in the SIMATIC Manager environment, including the chwinfo.txt protocol that records the actual outcome of the rewiring step, and provides a troubleshooting matrix that maps the failure signature to a remediation path.

Operational impact: The failure is not a corruption of the block; the protection attribute KNOW_HOW_PROTECT survives the failed rewire, and the program is still fully executable on the target CPU. The damage is limited to the project source — cross-references and symbol table entries do not match the actual block calls, which can break documentation tools, source comparisons, and any rebuild workflow that depends on consistent FB numbering.

Affected Software, Firmware, and Libraries

Component Identifier Role in Failure
STEP 7 V5.4 + SP1 + HF1 (also reproduced on V5.4 + SP5) Hosts the Rewire function and the chwinfo.txt log
SIMATIC Manager All builds bundled with STEP 7 V5.4 / V5.5 UI entry point for Rewire under Options → Rewire
Block protection KNOW_HOW_PROTECT attribute on the FB Triggers the silent-no-op behaviour
Standard library SIMATIC_NET_CP / Communication Blocks (FB63-FB66, FC62-FC69) The blocks typically being rewired
Target CPU family S7-300, S7-400, WinAC, ET 200S Library blocks originate in this family; failure is independent of target

The standard S7 communication blocks referenced in the failure signature are summarised below. These are the blocks most often targeted by a Rewire campaign because they are the only blocks in a typical user program that use the high FB numbers reserved by Siemens.

FB / FC Symbolic Name Function
FB63 TCON Establish a configured connection (ISO-on-TCP / TCP / UDP)
FB64 TRCV Receive data over a configured connection
FB65 TSEND Send data over a configured connection
FB66 TDISCON Terminate a configured connection
FC62 C_CNTRL Query connection status from the CP

Root Cause Analysis

The Rewire function operates by scanning every call site of the source block number and rewriting the absolute FB call to the target FB number. For a block compiled with the KNOW_HOW_PROTECT attribute, STEP 7 does not expose the call statements in the source view (the code section is hidden behind the lock screen). The Rewire function is therefore forced to operate on the compiled block interface only, and the substitution is only successful if the source and target FBs share an identical interface signature (input/output/inout declarations, STAT declarations, TEMP size, and block version).

The TCON / TSEND library blocks are versioned: a project that imports them from a particular service pack of STEP 7 gets a block version (e.g., V2.5 for TCON at the time of STEP 7 V5.4 + SP1). If the project's copy of the library and the version of FB63 / FB65 being rewired against differ in version, or if the target FB number is occupied by a user block with a different interface, the rewire will be silently refused. The decision is written to chwinfo.txt rather than surfaced in a dialog.

The intermittent "worked once, then failed" symptom is explained by Rewire's idempotence: on the first pass, the source FB is renamed and the target FB is created or updated. On the second pass, the source FB number no longer exists in the project, so the substitution set is empty and nothing is done. The chwinfo.txt log differentiates the two cases if the engineer reads it.

Reading the chwinfo.txt Protocol

The Rewire function writes a textual log to chwinfo.txt in the project directory (the same folder that contains the S7 project file, typically STEP7\S7Proj\<projectname>\). The log is overwritten on each invocation. The relevant excerpts for a failed rewire on a protected block look like the following:


01.12.2024 10:14:22   Rewire started
01.12.2024 10:14:22   Old block: FB63   TCON   Version 2.5
01.12.2024 10:14:22   New block: FB3    TCON   Version 2.5
01.12.2024 10:14:23   Block FB100 (KNOW_HOW_PROTECT): substitution skipped
01.12.2024 10:14:23   Reason: language ID mismatch in call interface
01.12.2024 10:14:23   Substitution completed: 0 of 1 calls updated

Two markers to look for in the log:

  • "substitution skipped" — the Rewire engine found the call but refused to rewrite it. The accompanying Reason line is the actual diagnostic.
  • "language ID mismatch" — the most common reason on a protected FB. The block was compiled with one language locale and the project source has another, or the source FB and target FB were compiled under different locale IDs.

Other reasons recorded in the log include interface signature differs, target block not found, block is write-protected, and rewire depth exceeded. Each of these implies a different remediation path.

Workaround 1 — Symbol-Priority Addressing

If the goal of the Rewire operation is to get a consistent symbolic name throughout the project (for example, every TCON call should refer to the same instance DB by symbolic name), the path of least resistance is to enable symbol-priority addressing and then rename the symbolic identifier in the symbol table. This works even when the underlying FB is KNOW_HOW_PROTECT because STEP 7 only needs to update the symbol table entry, not the call statement.

  1. In SIMATIC Manager, right-click the project node (top of the tree) and select Properties.
  2. Open the Addressing Priority tab.
  3. Set the priority to Symbol priority and confirm with OK.
  4. Open the Symbol Table (S7 Program → Symbols).
  5. Locate the entry for the source block (e.g., FB63 with the symbolic name TCON).
  6. Reassign the symbolic name to the target block number, e.g., change the absolute address from FB 63 to FB 5 for the symbol TSEND.
  7. Save and compile (Program → Compile All).

From this point on, every reference to the symbolic name TSEND resolves to the new FB number, regardless of the absolute call statements inside the protected block. The cross-reference (Reference Data → Display) will still show the absolute number that the protected block calls, but the compiler and the symbol browser will treat the call as a reference to the renamed block.

Caveat: Symbol-priority addressing only works for blocks that the calling code resolves symbolically. If the protected FB itself contains an absolute call to FB63 (i.e., the call statement was written with the absolute number, not the symbolic name), STEP 7 cannot rewrite it from the symbol table. The call is locked inside the protected source and must be addressed by a different method.

Workaround 2 — Source Re-import from the Original Library

The root cause of the language ID mismatch failure is almost always a version drift between the FBs as they were originally imported into the project and the FBs that the Rewire function expects to substitute. The resolution is to re-import the library FBs from the source media that shipped with the version of STEP 7 you are actually running:

  1. Close SIMATIC Manager.
  2. In Windows Explorer, navigate to the STEP 7 installation folder (default C:\Program Files\Siemens\Automation\STEP7\S7LIB\ or the ...\S7libs folder of your installation media).
  3. Open the Comm_Net library (or SIMATIC_NET_CP, depending on your installation) in the SIMATIC Manager by File → Open → Library.
  4. Copy the current version of FB63 TCON and FB65 TSEND into your S7 program container (Blocks folder) using drag-and-drop. Accept the overwrite prompt.
  5. Open your project, then immediately re-run the Rewire function with the same source/target mapping. The language IDs will now match and the protected calls will be substituted.

This procedure does not require removing the KNOW_HOW_PROTECT attribute from any block; the substitute operation is performed by the Rewire engine on the compiled representation of the call, not on the visible source.

Workaround 3 — Stub-and-Substitute with a Local Wrapper FB

For projects where the rewire must absolutely be performed and the language-ID mismatch persists even after re-importing the library, the most reliable fallback is to introduce a thin wrapper FB that does know the correct interface and to route all calls through it. The wrapper is a user FB without KNOW_HOW_PROTECT, which makes it visible to the Rewire function.

  1. Create a new FB (e.g., FB901) in your program container. Declare its IN/OUT/INOUT/STAT interface to be a byte-for-byte copy of the protected FB63 TCON interface. The interface can be found in the STEP 7 online help: Standard S7 communication blocks — entry ID 21045038.
  2. Inside FB901, call the real FB63 TCON by absolute number. Pass the wrapper's inputs to the library block, and the library block's outputs back to the wrapper's outputs.
  3. In every call site (including inside the previously protected FB, if the wrapper itself is also protected), replace the call to FB63 with a call to FB901. Because FB901 is not protected, the Rewire function can substitute it freely.
  4. Re-run Rewire to map FB901 to the target FB number (e.g., FB3).

The runtime cost is one extra call per cycle on the wrapper FB, which is negligible for communication blocks that execute on a millisecond-scale trigger. The maintenance cost is one wrapper per library block that has to be rewired.

Workaround 4 — Manual Edit of the S7 Source File (Advanced)

The STEP 7 source file format (.awl for STL, .scl for SCL) stores block calls as CALL FB <number> statements. These are plain text and can be edited with any editor that respects the encoding (Latin-1 / Windows-1252). For protected blocks, the source view is hidden, but the underlying file still contains the call statement. Engineers with a working knowledge of the file layout can edit the file directly, but only after disabling KNOW_HOW_PROTECT on the block.

  1. Open the protected FB in the LAD/FBD/STL editor.
  2. Use the menu path File → Properties and clear the KNOW_HOW_PROTECT checkbox. The block password (if any) will be requested.
  3. Save the block (this regenerates the source file without the lock).
  4. Open the generated .awl or .scl file in a text editor, locate the CALL FB 63 or CALL FB 65 statement, and replace the number with the target value (e.g., CALL FB 3).
  5. Re-compile the source by right-clicking the Sources folder and selecting Compile.
  6. Re-enable KNOW_HOW_PROTECT in the block properties if desired.
Warning: Manual source edits bypass the consistency checks that the Rewire function performs. After recompiling, verify the block interface against every call site by opening Reference Data → Display and confirming that the input/output wiring matches the new FB. A mismatch will surface at download as a block-consistency error from the CPU.

Verifying the Fix

After applying any of the workarounds above, perform the following verification sequence before downloading the modified program to the target CPU.

  1. Cross-reference check. In SIMATIC Manager, open Options → Reference Data → Display and refresh. Locate the target FB number (e.g., FB3) and confirm that it shows the expected number of call sites. Compare against the count you noted before the operation. The numbers should match.
  2. Symbol table check. Open the Symbol Table and confirm that the symbolic name resolves to the new absolute number. Right-click the symbol and choose Go To → Application — SIMATIC Manager should jump to the (renamed) block.
  3. chwinfo.txt re-read. Run the Rewire function a second time with the same mapping. The chwinfo.txt log should now read Substitution completed: N of N calls updated with the same N as the call-site count. If the count is 0, the substitution set was empty (idempotent re-run) and the fix is still valid.
  4. Consistency check. Open Program → Compile All and confirm that the compile completes without warnings about block interface mismatches. The output window should be empty or contain only style notes.
  5. Download dry-run. Use PLC → Download with the Skip all option for non-relevant blocks. The CPU should accept the modified FB without raising SF (system fault). The diagnostic buffer should remain free of Block interface error entries.

Troubleshooting Matrix

Symptom chwinfo.txt Marker Most Likely Cause Recommended Fix
Rewire completes, no change to calls language ID mismatch in call interface Library version drift between STEP 7 install and project FBs Re-import TCON/TSEND from installation library (Workaround 2)
First rewire succeeds, second fails Old block: not found Idempotent re-run; first pass already renamed the source No fix required; verify cross-reference and proceed
Protected FB still shows old FB number in cross-reference substitution skipped Call inside protected FB was made with absolute number, not symbolic Enable symbol-priority addressing (Workaround 1) or introduce wrapper FB (Workaround 3)
Compile error after Rewire: Block interface differs (no entry; compile output) Target FB has different interface signature than source Verify target FB is a byte-for-byte copy of the library version; recompile from source
CPU SF light after download; diagnostic buffer: Block interface error / OB122 (CPU diagnostic buffer) Substituted FB has different version than instance DB expects Re-compile the instance DBs for the substituted blocks; re-download all
Rewire dialog offers fewer matches than cross-reference suggests (no log entry) Protected FB is excluded from the dialog's scan by design Use Workaround 3 (wrapper) or Workaround 4 (manual edit)
Symbol table rename is silently reverted on compile (no log entry) Addressing priority is set to Absolute priority Switch to Symbol priority in project properties

Best-Practice Notes for Long-Term Maintenance

Three structural decisions reduce the chance of hitting the rewire/protected-FB problem on future projects.

  • Number the library blocks last. Allocate FB1 through FB900 to user code, then import the Siemens communication library into the FB900+ range. The number collisions disappear, and the Rewire function is no longer needed for the library FBs.
  • Wrap every library call in a user FB. All calls to TCON, TSEND, TRCV, and TDISCON go through user-owned wrapper FBs. The wrappers carry the project naming convention and can be rewritten, versioned, and protected as the project requires.
  • Use symbolic calls only. Configure symbol-priority addressing at project creation. Every call statement reads CALL "TSEND" / DB<inst> in the cross-reference. The Rewire function operates on the symbolic name and never touches the protected call site.

Related Block Interface Reference

For verification of interface signatures during the workaround steps, the relevant block interfaces are documented in the STEP 7 online help under Standard Library → Communication Blocks. The interface for FB63 TCON at version 2.5 is:


VAR_INPUT
  REQ             : BOOL;        // Start connection establishment
  ID              : INT;         // Connection ID (1..16)
  CONNECT_ID      : WORD;        // Connection reference from NetPro
  CONNECT_TYPE    : BYTE;        // 0x11=TCP, 0x12=ISO-on-TCP, 0x13=UDP
  LOCAL_DEVICE_ID : BYTE;        // For routing through CPs
END_VAR
VAR_OUTPUT
  DONE            : BOOL;        // Establishment complete
  BUSY            : BOOL;        // Operation in progress
  ERROR           : BOOL;        // Error flag
  STATUS          : WORD;        // Error/status code
END_VAR
VAR_IN_OUT
  CONNECT         : UDT_65;      // Connection parameters (UDT65)
END_VAR

If your target FB does not declare a UDT_65 CONNECT parameter, the rewire will fail with interface signature differs regardless of which workaround you apply. Confirm the interface before running Rewire.

FAQ

Why does the STEP 7 Rewire function fail silently on a KNOW_HOW_PROTECT block?

The Rewire function rewrites call statements, but the source view of a KNOW_HOW_PROTECT block is hidden. The engine only succeeds if the compiled call interface of the source FB and target FB match exactly (input, output, inout, STAT, TEMP size, and language ID). When they do not match — most commonly because the library FB was imported from a different STEP 7 service pack than the project copy — the rewire is silently skipped and a substitution skipped entry is written to chwinfo.txt.

Where is the chwinfo.txt log file located?

It is written to the project directory, typically STEP7\S7Proj\<projectname>\chwinfo.txt. The file is overwritten on every Rewire invocation. The last Reason line under each substitution skipped entry is the actionable diagnostic.

Can I use symbol-priority addressing to substitute a call inside a protected FB?

Only if the call inside the protected FB was written with the symbolic name, not the absolute FB number. If the call is CALL "TCON" / DB<inst>, the symbol table rename will route it correctly. If the call is CALL FB 63 / DB<inst>, the symbol table cannot reach it; you must rewire the absolute number or use a wrapper FB.

Is the rewire failure also present in TIA Portal?

No. TIA Portal renames FBs through the project tree's Rename function, which updates all call sites symbolically in a single pass. The Rewire function is a SIMATIC Manager (STEP 7 V5.x) feature and does not exist in the TIA Portal environment, so the issue is specific to STEP 7 V5.4 / V5.5.

Does re-importing the Siemens communication library break the existing project?

No, as long as you overwrite with the same block version. STEP 7 will prompt for confirmation; accepting it replaces the FB in the program container without changing the instance DBs. If the version differs (e.g., the project uses TCON V2.0 and you re-import V2.5), the instance DBs must be recompiled before download to match the new block interface.

Back to blog