Problem Overview
Migration of a STEP 7 V5.6 SP5 project (*.s7p) into TIA Portal fails with the message "The classic project is not consistent. 'DB20' needs to be recompiled." The error is raised by the migration tool even when the source project compiles cleanly under STEP 7 V5.6 SP5 with 0 warnings and 0 errors, and even after a Save with Reorganization (slow) pass. The same error persists when the source is migrated directly to TIA Portal V14 SP1 instead of V13 SP1 Update 9. The affected DB20 is a shared data block used to exchange data between the SIMATIC S7 PLC and a SIMOTION controller in a multi-component project that also contains a WinCC flexible 2008 HMI, an ET 200S safety station IM151-8F, and SINAMICS G120 drives.
Affected Software Versions
| Component | Source Version | Target Version (Reported) | Notes |
|---|---|---|---|
| STEP 7 | V5.6 SP5 | n/a (source) | Service Pack 5 required for migration to TIA V13/V14 |
| SIMOTION SCOUT | V4.4 / V4.5 | Same as source | Must be installed before TIA migration |
| WinCC flexible | 2008 SP5 | WinCC Comfort/Advanced in TIA | Convert panel project separately |
| TIA Portal | n/a | V13 SP1 Update 9, V14 SP1 | Both versions reproduce the error |
| SINAMICS G120 | STARTER / Drive ES | Startdrive in TIA | Must be removed prior to S7 migration (see below) |
Why the Error Is Raised
The migration tool imports the S7 program in two stages:
- Transfer the STEP 7 V5.x program container (S7 program / S7-300 / S7-400 station) into the TIA project tree.
- Compile the imported blocks to verify that the symbolic / instance / DB structure is internally consistent before any code generation.
During step 2, the TIA compiler checks each block against the current TIA Portal type model. If a block references a type, UDT, or system attribute that has been renamed, restructured, or retired between STEP 7 V5.6 and the TIA Portal version, the block is flagged as not consistent. The reported message is generic; the real cause is the structure of DB20 itself, not the source file.
Three root causes are commonly observed for DB20 in mixed PLC + SIMOTION projects:
-
Hidden attributes from SIMOTION coupling. DBs that are mapped to SIMOTION contain
NON_RETAIN, axis-reference stubs, or system attributes (S7_m_c,S7_pom_c) that TIA V13 does not fully recognise. - Optimised vs. non-optimised access mismatch. DBs originally generated as non-optimised with symbolic-only members cause the TIA compiler to demand a recompile to attach the new attribute set.
-
Residual G120 / Drive ES references. If a G120 device was not deleted from the source project before migration, its parameter DB shadows may be imported as
DB20and trigger the consistency check.
Pre-Migration Cleanup (Mandatory)
Perform the following cleanup on the STEP 7 V5.6 SP5 project before opening the TIA Portal migration tool:
- Open the project in STEP 7 V5.6 SP5 with administrator rights.
- For each SINAMICS G120 in the hardware configuration:
- Right-click the drive in HW Config.
- Choose Object Properties → Drive → Disconnect from target system (if online) and remove the PROFIBUS / PROFINET connection.
- Delete the G120 station. This is required because the message "impossible to migrate G120" halts the migration of the entire S7 station.
- Re-compile HW Config and the S7 program. Verify 0 errors, 0 warnings in the Check Block Consistency dialog (menu Edit → Check Block Consistency → All).
- Run File → Save As → Save with reorganization (slow). This rebuilds the
*.s7pcontainer and often removes orphaned symbols. - Close the project and run File → Archive to create a single
*.zipsource for the migration tool.
*.s7p files is no longer supported as of TIA Portal V20; from V20 onward, projects must first be migrated to an intermediate TIA version and then upgraded.
Root-Cause Verification Matrix
| Symptom in TIA Portal | Likely Root Cause | Diagnostic Action | Resolution |
|---|---|---|---|
| Migration stops with "DB20 needs to be recompiled" | Stale block container from Drive ES / SIMOTION coupling | Open DB20 in STEP 7 V5.6, select File → Save As → STL/SCL source | Re-import DB20 as external SCL source in TIA |
| Same message for multiple DBs (DB20, DB21…) | Symbolic-only DB generated by SIMOTION SCOUT | Check Block → Special Object Properties → Created by | Re-create DB manually in TIA with same structure |
| DB20 marked "not consistent" but compiles locally | Instance-of reference to retired FB | Cross-reference View → Cross References in STEP 7 | Update FB or remove instance reference before migration |
| G120 "impossible to migrate" appears first | Drive ES coupling still present in HW Config | Inspect Station → Drive nodes in HW Config | Delete G120 device from HW Config (see Pre-Migration Cleanup) |
| IM151-8F safety block import fails | F-library version mismatch (Failsafe V5.2 vs V6.x) | Check installed F-library Options → F-Libraries | Update F-library to version matching TIA target |
Solution 1 – SCL Export / Re-Import Workaround (Recommended)
The most reliable workaround bypasses the broken block-container path by exporting the affected DB to a textual SCL source and re-importing it in TIA Portal after the rest of the project has been migrated.
Step-by-Step Procedure
-
Export DB20 in STEP 7 V5.6 SP5
- Open the project, navigate to S7 Program → Blocks → DB20.
- Right-click DB20 → Generate Source → STL Source (or SCL Source if DB was originally SCL).
- Name the source file
DB20_migrate.scl. - Select Insert → Generated Blocks so that all members of DB20 are written into the source.
- Save and close the source editor.
-
Locate the source file in the project directory. It is stored under
<project>\S7Program\Sources\DB20_migrate.scl. - Run the TIA migration for the remainder of the project (excluding DB20 if the tool offers a selection; otherwise migrate the whole project).
-
Re-import the SCL source in TIA Portal
- Open the migrated project in TIA Portal V13 SP1 Update 9 (or V14 SP1).
- Expand the target S7 station in the project tree.
- Right-click External Source Files → Add New External File.
- Browse to
DB20_migrate.scland confirm. - Right-click the imported source file → Compile → Software (only).
-
Verify that
DB20now appears under Program Blocks with the same structure as in STEP 7 V5.6.
Solution 2 – Manually Recreate the DB in TIA Portal
If the SCL export still triggers the consistency error (typical when DB20 contains an array of PLC data types that TIA V13 cannot parse), recreate the block directly in TIA Portal.
- In the TIA project tree, navigate to Program Blocks → Add New Block → Data Block.
- Name the new DB
DB20and disable Optimized block access (matching the V5.6 setting unless SIMOTION requires optimised access). - Add the structure from the STEP 7 V5.6 source. The following example shows a typical SIMOTION–PLC exchange DB:
DATA_BLOCK "DB20"
TITLE = 'PLC_SIMOTION_Interface'
{ S7_access := 'DB'; S7_m_c := 'true' }
VERSION : 0.1
NON_RETAIN
BEGIN
AxisCommands : ARRAY[1..16] OF WORD; // 16 axes, 2-byte command word each
AxisStatus : ARRAY[1..16] OF WORD; // 16 axes, 2-byte status word each
HmiWord : WORD; // HMI handshake
Heartbeat : DWORD; // 100 ms counter, written by PLC
END_DATA_BLOCK
- Compile the block (Right-click → Compile).
- Re-run the project consistency check (Project tree → right-click PLC → Compile → Software (rebuild all)). The error must disappear.
Solution 3 – Intermediate Migration Through TIA V13 (No Update)
If the project was originally developed under STEP 7 V5.5 and the V5.6 SP5 update has not been installed on the target engineering PC, the migration tool can silently carry forward inconsistencies that are then surfaced by SP1 Update 9. In that case:
- Install TIA Portal V13 SP1 without any update.
- Migrate the project to V13 SP1.
- Apply Update 9 only after a successful first compile of the migrated project.
This sequence prevents the update installer from locking the project file before the migration tool has finished its consistency pass.
Verification Procedure
After applying Solution 1 or 2, perform the following checks:
- Project consistency – Project tree → right-click PLC → Compile → Software (rebuild all). Expected: 0 errors, 0 warnings.
-
Cross-reference test – In TIA Portal, open Tools → Cross References, filter for
DB20. Every reference shown in the V5.6 cross-reference list must be present. -
SIMOTION handshake – Download the TIA project to the S7 CPU and verify that
DB20.Heartbeatincrements. The SIMOTION controller will then read the new DB20 layout without restart. -
WinCC flexible / TIA HMI mapping – If the WinCC flexible 2008 panel uses tags mapped to
DB20, re-export the tag list from TIA Portal and import it into the converted Comfort Panel project. - IM151-8F F-signature – In TIA Portal, open the F-program of the ET 200S safety station and re-accept the F-signature. The migration tool does not preserve the F-collection signature from V5.6.
Migration Version Roadmap (for Future Planning)
| TIA Portal Version | STEP 7 V5.x Migration | Notes |
|---|---|---|
| V13 SP1 Update 9 | Supported (integrated) | Used as target in the reported case |
| V14 SP1 | Supported (integrated) | Direct migration reproduces the same DB20 error |
| V15 / V15.1 / V16 | Supported (integrated) | Recommended interim target for older projects |
| V17 / V18 / V19 | Supported (integrated) | Use Startdrive for G120 / S120 from here onward |
| V20 and newer | Not supported (integrated) | Use the TIA Migration Tool to a V19 or earlier intermediate, then upgrade to V20+ |
Known Edge Cases and Field Notes
- Multi-instance DB20 – If DB20 is a multi-instance data block (instance of an FB), the SCL export writes the FB call as well. Re-compile the FB in TIA first, then import the source.
-
DB20 referenced as PI/PQ area – TIA V13 marks any DB with
UNLINKEDsections. If DB20 is used for direct peripheral access viaPEW/PAWaliases, recreate those as PLC tags in the TIA default tag table instead of trying to keep the legacy alias. -
Drive ES G120 blocks – After deleting the G120 device, verify that the associated DBs (typically
DB1000–DB1099) are also removed. Orphaned DBs may be renumbered toDB20by the migration tool if the project uses auto-numbering. - WinCC flexible 2008 panel – The HMI migration to TIA runs as a separate wizard. If the panel project references DB20 tags, the TIA HMI conversion will still fail until the S7 program is consistent. Always migrate the S7 program first, then the HMI.
-
SIMOTION Scout coupling – SIMOTION-side variables mapped to
DB20must be re-assigned to the new DB20 in SCOUT using the Address Space Configuration editor. The TIA migration does not update SCOUT's mapping table.
Summary of the Fix
The "DB20 needs to be recompiled" message during STEP 7 V5.6 → TIA Portal migration is a stale-block-container issue, not a real compile error. The definitive fix is to export DB20 as an SCL source in STEP 7 V5.6, run the TIA migration on the rest of the project, and re-import the SCL file via the External Source Files node of the TIA project tree. After the manual re-import, the consistency check passes and the project compiles cleanly. The same procedure is valid for any other DB that shows identical symptoms (DB21, DB22, etc.).
Why does TIA Portal report "DB20 needs to be recompiled" even when STEP 7 V5.6 shows 0 errors?
The TIA migration tool runs its own consistency check against the TIA type model. Hidden system attributes from SIMOTION coupling, G120 Drive ES stubs, or pre-V5.6 block containers can pass the V5.6 compiler but fail the TIA pass. The check is not a re-run of the V5.6 compiler.
Can I migrate a STEP 7 V5.6 project containing a G120 directly to TIA Portal?
No. The migration tool aborts with "impossible to migrate G120" if the drive is still in HW Config. Delete the G120 from HW Config, recompile, save with reorganization, and re-migrate. The drive can then be re-added in TIA via Startdrive or the SINAMICS Startdrive commissioning tool.
Does the SCL export/import workaround change the DB structure?
No, if you select Insert → Generated Blocks when generating the source. The SCL file contains the exact data type, initial value, and attribute set of DB20. The TIA Portal compiler reads the same structure and produces a bit-identical block.
Will the IM151-8F safety signature survive the migration?
No. The F-collection signature, F-CRC, and F-runtime group are not preserved by the migration tool. Re-accept the signature in TIA Portal after the migration and before downloading to the safety station.
What is the highest TIA Portal version that still supports integrated STEP 7 V5.x migration?
As of TIA Portal V20, the integrated migration of *.s7p files is no longer supported. Use TIA V19 (or earlier) as the migration target, then upgrade the resulting TIA project to V20+ using the standard project upgrade path. Refer to the official TIA Portal V20 migration documentation for the supported target versions.