Resolving DB Consistency Error During STEP 7 to TIA Portal

David Krause11 min read
SiemensTIA PortalTroubleshooting
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

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)
Compatibility rule: The TIA Portal version used for migration must support every component present in the STEP 7 V5.x project. If any device is not supported by the chosen TIA version, the migration tool aborts before S7 program blocks are imported.

Why the Error Is Raised

The migration tool imports the S7 program in two stages:

  1. Transfer the STEP 7 V5.x program container (S7 program / S7-300 / S7-400 station) into the TIA project tree.
  2. 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:

  1. 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.
  2. 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.
  3. 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 DB20 and 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:

  1. Open the project in STEP 7 V5.6 SP5 with administrator rights.
  2. For each SINAMICS G120 in the hardware configuration:
    1. Right-click the drive in HW Config.
    2. Choose Object Properties → Drive → Disconnect from target system (if online) and remove the PROFIBUS / PROFINET connection.
    3. Delete the G120 station. This is required because the message "impossible to migrate G120" halts the migration of the entire S7 station.
  3. 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).
  4. Run File → Save As → Save with reorganization (slow). This rebuilds the *.s7p container and often removes orphaned symbols.
  5. Close the project and run File → Archive to create a single *.zip source for the migration tool.
Source URL: Migration of STEP 7 projects (S7-300, S7-400) – TIA Portal V20 documentation. The integrated migration of *.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

  1. Export DB20 in STEP 7 V5.6 SP5
    1. Open the project, navigate to S7 Program → Blocks → DB20.
    2. Right-click DB20 → Generate Source → STL Source (or SCL Source if DB was originally SCL).
    3. Name the source file DB20_migrate.scl.
    4. Select Insert → Generated Blocks so that all members of DB20 are written into the source.
    5. Save and close the source editor.
  2. Locate the source file in the project directory. It is stored under <project>\S7Program\Sources\DB20_migrate.scl.
  3. Run the TIA migration for the remainder of the project (excluding DB20 if the tool offers a selection; otherwise migrate the whole project).
  4. Re-import the SCL source in TIA Portal
    1. Open the migrated project in TIA Portal V13 SP1 Update 9 (or V14 SP1).
    2. Expand the target S7 station in the project tree.
    3. Right-click External Source Files → Add New External File.
    4. Browse to DB20_migrate.scl and confirm.
    5. Right-click the imported source file → Compile → Software (only).
  5. Verify that DB20 now appears under Program Blocks with the same structure as in STEP 7 V5.6.
Encoding tip: If the SCL file contains German umlauts or comments in non-ASCII, open the file in Notepad++ and convert to UTF-8 without BOM before importing into TIA. The default ANSI/Windows-1252 encoding occasionally causes the TIA compiler to flag the file as not parseable, which can be mistaken for the original consistency error.

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.

  1. In the TIA project tree, navigate to Program Blocks → Add New Block → Data Block.
  2. Name the new DB DB20 and disable Optimized block access (matching the V5.6 setting unless SIMOTION requires optimised access).
  3. 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
  1. Compile the block (Right-click → Compile).
  2. 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:

  1. Install TIA Portal V13 SP1 without any update.
  2. Migrate the project to V13 SP1.
  3. 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:

  1. Project consistency – Project tree → right-click PLC → Compile → Software (rebuild all). Expected: 0 errors, 0 warnings.
  2. 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.
  3. SIMOTION handshake – Download the TIA project to the S7 CPU and verify that DB20.Heartbeat increments. The SIMOTION controller will then read the new DB20 layout without restart.
  4. 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.
  5. 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+
Long-term maintenance: If the project is expected to outlive TIA V19, plan a two-step migration: STEP 7 V5.6 → TIA V16 (or V17) → TIA V20. The SCL export/import workaround described above should be applied at the first step only; subsequent upgrades within TIA Portal use the standard project upgrade tool and do not re-trigger the DB20 error.

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 UNLINKED sections. If DB20 is used for direct peripheral access via PEW/PAW aliases, 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 to DB20 by 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 DB20 must 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.

Back to blog