1. Problem Statement
A machine architecture built around the SIMATIC S7-1200 CPU and two SIMOTION D drive controllers exhibits a reproducible homing failure after every main power cycle. The servo motors never return to the home position automatically on power-up. The current operator workaround is to place the CPU in STOP from the programming device (PG), then start it again. After this manual STOP to RUN transition, the homing sequence executes correctly and the machine is ready to run. Because the operator is not allowed to use the PG on the production floor, this workaround is operationally unacceptable and the root cause must be removed from the application program.
This failure pattern is well documented on S7-1200 motion control applications where the homing routine depends on internal technology object state, on the actual drive readiness, and on first-scan logic executed in OB100. The problem can be classified into one of three families: (a) the technology object is not re-initialized after a hard power-on, (b) the homing command is issued before the SIMOTION D or SINAMICS drive is in the "Operation enabled" state, or (c) the encoder configuration or homing mode does not match the connected hardware. Each family has its own diagnostic signature and its own fix.
2. Why the CPU STOP to RUN Works but POWER ON to POWER ON Fails
Placing the CPU in STOP from the PG is fundamentally different from a hard power-off to power-on cycle, even though both transitions eventually lead to OB100 execution. The two paths differ in the value of the process image, the bit memory, the data blocks marked as retentive, and the internal state of the motion control technology objects.
| Memory area | STOP (from PG) | POWER OFF to POWER ON |
|---|---|---|
| Process image inputs (PII) | Retained at last scanned value | Zero until first read of inputs |
| Process image outputs (PIQ) | Retained if outputs configured as retentive, else zero | Zero |
| Bit memory (M) — retentive range | Retained from last value | Retained if backed up; else zero |
| Bit memory (M) — non-retentive range | Zero | Zero |
| Instance DBs — retentive markers | Retained from last value | Retained if configured, else zero |
| Motion TO — internal state | Partial reset on RUN; some flags preserved | Full reset to "Not homed, axis disabled" |
| Drive status bits read back | Latched from last scan, may show Ready | Zero until drive completes power-up |
The motion control technology object on the S7-1200 holds its own internal state machine that tracks whether the axis is enabled, whether the encoder is calibrated, and whether the home position has been captured. On a STOP to RUN transition, the technology object executes a partial reset that often restores the "Homed" flag if it was set before the stop. On a hard power cycle, the technology object initializes to a clean "Not homed, axis disabled" condition.
3. OB100 First-Scan Logic — Required Initializations
OB100 is the startup organization block of the S7-1200. It runs once when the CPU transitions from STOP to RUN, after the operating system has cleared or restored memory according to the retentive settings. Every motion control instruction that uses an edge-triggered Execute input must have its input tag initialized in OB100, otherwise the instruction never re-fires after a power cycle. This is because the previous edge of the Execute tag is lost with the memory and the new RUN cycle starts with the tag in its default FALSE state.
The minimum OB100 logic for an axis controlled by a SIMOTION D or SINAMICS drive is:
- Reset all motion control command tags (MC_Power.Enable, MC_Reset.Execute, MC_Home.Execute) to FALSE.
- Reset all motion control status mirrors that are used as permissive contacts (AxisHomed, AxisEnabled, AxisError, AxisStandstill) to FALSE.
- Load the homing mode, the homing position, the approach velocity, and the homing velocity into the technology object configuration DB or instance DB.
- Set the "PowerOnComplete" flag to FALSE so the main OB can gate the homing sequence on actual drive readiness.
- Initialize a TON (on-delay timer) preset to 1.5 times the longest drive ready time observed in the cabinet.
- Clear the one-shot trigger that raises MC_Home.Execute, so a fresh edge can be generated on the first OB1 scan after the timer elapses.
The TIA Portal version determines the exact instruction set in the "Instructions" task card under "Technology" and "Motion Control". The technology object itself is configured under Project tree to PLC to Technology objects to Axis to Configuration. The Homing tab in the technology object configuration sets the encoder mode, the approach direction, the reference cam, the zero marker behavior, and the position to assign at the home point. These values are baked into the project at download time and are not modified by the application program.
For the latest documentation on homing with the S7-1200 motion control technology object, refer to the official TIA Portal help: Homing (S7-1200) — Motion Control. The Siemens support portal at support.industry.siemens.com provides the S7-1200 system manual (entry ID 109751596) and the S7-1200 Motion Control function manual (entry ID 109772640) for additional reference.
4. SIMOTION D and SINAMICS Drive Readiness Sequence
The SIMOTION D controller is a SINAMICS-based motion control platform. After power-on, the controller, the SINAMICS infeed (Line Module), and the connected Motor Module each go through a defined state machine. The relevant transitions, in order, are:
- Power-on delay: Internal contactor closes, DC link pre-charge begins. Typical 200 to 800 ms.
- Init: SIMOTION runtime boots, the SIMOTION D Control Unit (CU) initializes the DRIVE-CLiQ topology. Typical 2 to 4 s.
- Switch-on inhibited to Ready to switch on: Infeed reports no fault, DC link is pre-charged, epcos and IGBTs are healthy.
- Ready to switch on to Ready: Infeed is running, drive object (DO) is configured, encoder has signaled initial data.
- Ready to Operation enabled: All DO enable signals are present, STO is released, encoder has referenced, brake released. Typical 1 to 2 s after step 4.
The total time from "machine main power on" to "Operation enabled" is typically 5 to 10 seconds for a SIMOTION D with a SINAMICS S120 smart line module, and can extend to 12 to 15 seconds for machines with multiple line modules in parallel and large DC link capacities. The MC_Home command must not be issued before the axis reaches "Operation enabled" or the motion control will return ErrorID 0x000A (drive did not reach Operation enabled).
As a rule of thumb used in the field, the homing trigger should be issued no earlier than 1.5 × t_pwr_ready, where t_pwr_ready is the measured time from "main power on" to the first time the drive reports "Operation enabled" (ZSW1 bit 0 = 1 and ZSW1 bit 2 = 0 in the SINAMICS status word). On a stable system, a preset of 10 s is a safe starting value. On a cold cabinet (ambient below 5 °C), extend the preset by 3 to 5 s to allow the pre-charge resistor to reach its nominal resistance.
5. MC_Home Configuration Block
The MC_Home instruction is the only way the S7-1200 motion control technology object is told that the current axis position is valid, or that a homing sequence must be executed. The instruction is in the "Instructions" task card under "Technology" and "Motion Control" in TIA Portal and is instantiated as a function block (FB) with a background data block (DB). The interface of the MC_Home block is consistent across TIA Portal V15 through V21.
| Port | Direction | Type | Description |
|---|---|---|---|
| Axis | IN | VARIANT (TO_Axis) | Reference to the technology object axis |
| Execute | IN | BOOL | Start the homing on a rising edge |
| Position | IN | LREAL | Absolute position to assign to the home point (Mode 0 only) |
| Mode | IN | BYTE / INT | 0 = absolute set, 1 = relative set, 2 = passive, 3 = active |
| Done | OUT | BOOL | TRUE on successful completion |
| Busy | OUT | BOOL | TRUE while the instruction is active |
| CommandAborted | OUT | BOOL | TRUE if superseded by another command |
| Error | OUT | BOOL | TRUE on error |
| ErrorID | OUT | WORD | Fault code (see Table 4) |
For a SIMOTION D-controlled axis wired to a SINAMICS S120 drive over PROFINET IRT, the typical sequence in the main OB (OB1) is:
- Call MC_Power with Enable = TRUE; wait for Status = TRUE and StatusDrive = TRUE.
- Call MC_Reset if a fault is pending (Error = TRUE on any prior block).
- Wait for the power-on delay timer to elapse (PowerOnTimer.Q = TRUE).
- Call MC_Home with Mode = 3 (active homing) and Execute = a single rising edge of a one-shot flag.
- Wait for MC_Home.Done = TRUE or handle MC_Home.Error.
5.1 Sample SCL code for the main OB
// Power-on delay — preset = 1.5 × t_pwr_ready, cold-cabinet +3 s
IF "FirstScan" OR "PowerOnLatch" THEN
"PowerOnDelayPreset" := 10000; // ms, adjust to cabinet
"PowerOnTimer".(IN) := FALSE;
"PowerOnTimer".(PT) := T#10s;
"PowerOnLatch" := TRUE;
END_IF;
IF "PowerOnLatch" AND NOT "PowerOnTimer".(Q) THEN
"PowerOnTimer".(IN) := TRUE;
END_IF;
// Axis 1 — power, reset, home
"Ax1_PowerDB"("Axis" := "TO_Axis_1",
"Enable" := TRUE,
"Status" => "Ax1_PowerStatus",
"StatusDrive" => "Ax1_PowerStatusDrive",
"Error" => "Ax1_PowerError",
"ErrorID" => "Ax1_PowerErrorID");
IF "Ax1_PowerError" THEN
"Ax1_ResetDB"("Axis" := "TO_Axis_1",
"Execute" := TRUE,
"Done" => "Ax1_ResetDone");
END_IF;
// Gate homing on drive readiness and timer
"Ax1_DriveReady" := "Ax1_PowerStatusDrive" AND "PowerOnTimer".(Q);
IF "Ax1_DriveReady" AND "Ax1_HomeTrigger" AND NOT "Ax1_HomeBusy" THEN
"Ax1_HomeDB"("Axis" := "TO_Axis_1",
"Execute" := TRUE,
"Position" := 0.0,
"Mode" := 3, // active homing
"Done" => "Ax1_HomeDone",
"Busy" => "Ax1_HomeBusy",
"Error" => "Ax1_HomeError",
"ErrorID" => "Ax1_HomeErrorID");
END_IF;
5.2 Ladder equivalent of the homing gate
| Ax1_PowerStatusDrive PowerOnTimer.Q Ax1_HomeTrigger NOT Ax1_HomeBusy |
|-----|----------------------|----------------|------------------|-----------------|
| | MC_Home_1 |
| | Axis: TO_Axis_1 |
| | Execute: TRUE |
| | Mode: 3 |
| | Position: 0.0 |
| +-----------|
6. Encoder Configuration and Technology Object Alignment
If the SINAMICS drive reports the encoder as "Not referenced" after every power cycle, the homing mode of the technology object must be inspected. The S7-1200 motion control technology object supports two homing paradigms:
- Active homing (Mode = 3): The axis executes a defined motion profile to find a reference cam, a zero marker, or a positive stop. The encoder is then re-referenced and the axis position is set to the value at "Position".
- Passive homing (Mode = 2): The axis is homed while it is already moving under a separate MC_Move command, when an external reference event occurs (typically a probe input on the SIMOTION D or a digital input on the SINAMICS).
For incremental encoders, active homing must be executed after every power cycle, because the encoder counter starts from zero and the technology object has no memory of its previous position. For absolute encoders (EnDat 2.1, EnDat 2.2, SSI, PROFIsafe encoders), the technology object can read the absolute position across power cycles if the encoder is configured as a single-turn or multi-turn absolute encoder. In this case, MC_Home with Mode = 0 (absolute set) only needs to be called once at commissioning.
| Encoder type | Position retained across power-off? | Required homing mode | Homing command on every power-on? |
|---|---|---|---|
| Incremental TTL (HTL) | No | Active (Mode 3) or Passive (Mode 2) | Yes |
| Incremental sin/cos (1 Vpp) | No | Active (Mode 3) or Passive (Mode 2) | Yes |
| Absolute EnDat 2.1 / 2.2 | Yes (multi-turn battery-backed) | Mode 0 only on commissioning | No |
| Absolute SSI | Yes | Mode 0 only on commissioning | No |
| PROFINET encoder (PN encoder) | Yes (PN encoder parameter) | Mode 0 only on commissioning | No |
To check the configured encoder type in TIA Portal, open the technology object and navigate to the "Encoder" tab. The "Encoder type" field must be set to "Incremental" or "Absolute" and the resolution must match the encoder data sheet. A mismatch between the technology object configuration and the SIMOTION D or SINAMICS S120 parameter p0407 (Encoder type) is a common cause of the encoder being re-initialized on every cycle.
7. Step-by-Step Recovery Procedure
Follow this procedure to add a robust first-scan and drive-ready homing sequence to the application. The procedure assumes the SIMOTION D controller is wired to a SINAMICS S120 line module and motor module over DRIVE-CLiQ, and the S7-1200 communicates with the SIMOTION D over PROFINET IRT.
- Open the project in TIA Portal and connect online to the S7-1200 CPU. Use the "Go online" button in the toolbar or the Ctrl+K shortcut.
- Create OB100 if it does not exist. From the project tree, right-click "Program blocks", then "Add new block", then "Organization block", then "Startup" (OB100). Choose SCL or LAD based on the rest of the project.
- Add the reset logic in OB100: every MC_Power.Enable, MC_Reset.Execute, MC_Home.Execute tag set to FALSE. The HomeTrigger one-shot flag must be cleared. The PowerOnLatch must be set TRUE. The PowerOnTimer must be reset.
-
Determine the drive-ready time by powering the cabinet from cold and timing from "main power on" to "Operation enabled" on the SINAMICS Starter or Startdrive trace. Record the maximum observed value
t_pwr_ready_maxover at least three cold starts. -
Set the PowerOnTimer preset to
1.5 × t_pwr_ready_max, with a 2 s floor and a 20 s ceiling. 10 s is a typical engineering default for SIMOTION D with SINAMICS S120 line modules. - Open the technology object for the failing axis. Under "Homing" and "Homing mode", confirm "Active homing" is selected and the reference cam, zero marker, and positive stop parameters match the mechanical layout of the machine.
- Configure the encoder in the technology object. Set the encoder type, resolution, and direction inversion to match the SINAMICS parameter p0407, p0410, and p0411. The number of increments per motor revolution must match the encoder nameplate.
- Add the gate logic in OB1: the MC_Home.Execute is only raised when (PowerOnTimer.Q AND MC_Power.Status AND MC_Power.StatusDrive AND NOT MC_Home.Busy). The trigger must be a one-shot, generated by a positive edge detector on the home permission condition.
- Compile and download the project to the S7-1200 in STOP mode. The download dialog must show "Startup OB100 will run on next RUN transition". Confirm by clicking "Finish".
- Power the cabinet off and back on. Watch the SINAMICS trace and the S7-1200 watch table for the PowerOnTimer, the MC_Power status, and the MC_Home Done output. The MC_Home Done should rise within the configured homing timeout (default 30 s).
- Verify the homing command completes within the expected time and the axis position stabilizes at the configured home coordinate. Read the technology object status word to confirm the "Homed" bit is TRUE.
8. Verification Checklist
After the procedure is implemented, the following checks confirm the homing sequence is now resilient to power cycles:
- MC_Power.Status = TRUE within 500 ms of CPU RUN.
- MC_Power.StatusDrive = TRUE within 1.5 × t_pwr_ready_max of CPU RUN.
- MC_Home.Execute rises exactly once per CPU RUN transition, verified in the watch table or the trace.
- MC_Home.Busy transitions to FALSE within the configured homing timeout (typical 30 s).
- MC_Home.Done = TRUE on completion, and the technology object status word shows "Homed" = TRUE.
- The axis accepts MC_MoveAbsolute and MC_MoveRelative commands immediately after MC_Home.Done = TRUE.
- Repeating the power cycle ten times in succession produces identical homing behavior, with no operator intervention required.
- The SINAMICS fault buffer shows no F1611, F30002, or F07412 entries after a full power cycle and homing sequence.
9. Fault Code Reference Table
The S7-1200 motion control technology object raises the following ErrorID values in MC_Power, MC_Reset, and MC_Home when the homing sequence is aborted. The table is derived from the TIA Portal online help for motion control and applies to TIA Portal versions V15 through V21.
| ErrorID (hex) | Meaning | Likely cause | Remediation |
|---|---|---|---|
| 0001 | Axis is disabled | MC_Power not called or Enable = FALSE | Enable axis and wait for Status |
| 0002 | Homing already running | MC_Home.Execute re-triggered before Done | Re-trigger only after Busy = FALSE |
| 0004 | Home switch not found | Wiring, homing cam position, or direction | Verify cam wiring and direction |
| 0008 | Encoder overrun during homing | Velocity too high, soft limit too close | Reduce homing velocity, increase travel range |
| 000A | Drive did not reach Operation enabled | Drive fault, safety chain open, line module not ready | Check SINAMICS fault buffer, STO/SS1 wiring |
| 000D | Configuration error in TO | Encoder or mechanics misconfigured | Re-check TO parameters, recompile project |
| 0010 | External stop during homing | MC_Stop or hardware limit triggered | Investigate stop source and clear limits |
| 0011 | TO is in error state | Prior fault not cleared | Call MC_Reset and verify Error = FALSE |
10. Diagnostic Matrix for Persistent Homing Failures
| Symptom | Most likely root cause | Diagnostic action | Fix |
|---|---|---|---|
| Homing fails on every cold start, succeeds on STOP to RUN | OB100 missing or incomplete | Watch MC_Home.Execute across the first scan | Add complete OB100 initialization |
| Homing fails only on the first start of the day | Drive not yet at Operation enabled | Trace MC_Power.StatusDrive and ZSW1 | Add power-on delay timer |
| Homing fails after a power dip of more than 200 ms | DC link undervoltage, encoder lost reference | Check SINAMICS fault buffer for F30002 | Add UPS, configure TO "Restart" behavior |
| Homing runs but axis settles at the wrong coordinate | Encoder direction inversion or gear ratio misconfigured | Compare commanded position with actual after homing | Flip "Invert direction" or correct gear ratio |
| Homing runs once after download, fails on every subsequent cycle | Retentive tag holds the "Homed" flag, MC_Home not re-fired | Inspect retentive M and DB bits | Make the "Homed" flag non-retentive |
| MC_Home returns ErrorID 0x000A | Safety circuit open, drive in STO | Read ZSW1 bit 6 (status STO) | Close safety chain, check SS1 timing |
| MC_Home returns ErrorID 0x000D | TO parameters inconsistent with drive | Compile project, compare to online | Re-download project and restart CPU |
| MC_Home returns ErrorID 0x0004 | Reference cam not detected | Force the cam input in the watch table | Check cam wiring and proximity switch |
11. Extended Considerations
11.1 Retentive behavior of the mirrored "Homed" flag
The S7-1200 motion control technology object maintains a status word that contains the "Homed" bit. The status word is internal to the technology object and is not user-controlled, but many applications mirror it to a data block tag for use in permissive logic. If the mirrored tag is declared retentive, the application will believe the axis is homed after a power cycle even though the technology object has been reset. This causes motion commands to be accepted but the position reference is invalid, with all subsequent moves showing an offset equal to the slip between the encoder zero and the mechanical home. The mirrored "Homed" tag must be declared non-retentive in the DB properties, and the "AxisHomed" must be re-derived from the technology object status word on every OB1 scan, not from a sticky bit in a retentive DB.
11.2 PROFINET IRT and SIMOTION D sync timing
SIMOTION D controllers must be assigned to a PROFINET IO IRT sync domain. The S7-1200 must be the sync master and the SIMOTION D must be the sync slave. If the sync domain is misconfigured, the PROFINET AR (Application Relationship) may not establish before the MC_Power instruction is called, leading to a delayed drive ready state and a homing timeout. The configuration is in TIA Portal under "Devices & Networks" to PROFINET to "Sync domains". The send clock must be set to 1 ms for SIMOTION D, and the reduction ratio must be 1:1 for axes that use the SIMOTION isochronous mode.
11.3 SINAMICS Safety Integrated
If Safety Integrated is enabled on the SIMOTION D or SINAMICS axis, the axis cannot be homed while STO is active. The MC_Home instruction will return ErrorID 0x000A and the SINAMICS will report F1611 with cause "STO active". The safety circuit must be closed, the SS1 timer must elapse, and the drive must report "Safety Integrated active" in r9776 before MC_Home is allowed to fire. For PROFIsafe, the S7-1200 F-CPU must also be passing the PROFIsafe telegram to the drive, with the S_CRC in the PROFIsafe frame within tolerance.
11.4 Migration to S7-1500 and SIMOTION Scout TIA
Migrating the application to a SIMOTION Scout TIA project (TIA Portal V17 or later with the SIMOTION Scout TIA add-in) gives access to the full motion control functionality of the SIMOTION D runtime, including axis-level homing configuration, drive trace, and fault diagnostics. The S7-1200 is then reduced to a pure PROFINET IO controller, and the SIMOTION D owns the homing sequence. This architecture is preferred for new machines and eliminates the S7-1200 first-scan timing sensitivity entirely, because the homing sequence is initiated by the SIMOTION D runtime, not by the PLC scan.
11.5 Cold cabinet warm-up procedure
On machines installed in unheated cabinets or outdoor enclosures, the DC link pre-charge time can extend by 3 to 5 s on a cold start (cabinet internal temperature below 5 °C). The PowerOnTimer preset should account for the cold condition. A simple mitigation is to set the preset to 1.5 × t_pwr_ready_cold instead of 1.5 × t_pwr_ready_warm. The cold-cabinet time can be measured by leaving the cabinet powered off overnight and timing the first start of the day.
11.6 Identifying the drive model in the field
To determine whether the machine is wired to a SIMOTION D, a standalone SINAMICS D410, a SINAMICS S120 CU320-2, or a SINAMICS G120 with PROFINET, read the device name from the PROFINET device discovery. In TIA Portal, open "Devices & Networks", right-click the PROFINET subnet, and select "PROFINET device diagnosis". The device name, the order number (MLFB), and the firmware version of the PROFINET device are listed in the diagnostics pane. SIMOTION D controllers report their SIMOTION runtime version; SINAMICS drives report their SINAMICS firmware version. This single check resolves the most common "which product is it" question raised on the Siemens support forum.
12. Frequently Asked Questions
Why does STOP to RUN from the PG fix the homing, but a power cycle does not?
On a STOP to RUN, the S7-1200 motion control technology object preserves parts of its internal state, and any non-retentive tags you may have re-initialized in a prior OB100 are still at their default values. On a hard power cycle, the technology object is fully reset to "Not homed, axis disabled" and every motion control tag that depends on a rising edge of Execute must be re-triggered. If the application program does not re-trigger MC_Home in OB100 or in the first part of OB1, the axis stays in the "Not homed" state.
What is the minimum OB100 logic for two SIMOTION D axes?
OB100 must reset MC_Power.Enable, MC_Reset.Execute, MC_Home.Execute, and any one-shot trigger flags for both axes to FALSE. It must also clear mirrored "Homed", "Enabled", and "Error" status tags, and prime the power-on delay timer. Without this reset, the motion control instructions either never re-fire or fire on a stale edge from a previous RUN session.
How long should the power-on delay timer be set?
Use 1.5 times the measured time from "main power on" to "Operation enabled" of the slowest drive on the cabinet, with a 2 s floor and a 20 s ceiling. 10 s is a safe engineering default for SIMOTION D with SINAMICS S120 line modules. On cold cabinets or machines with large DC link capacities, extend the preset by 3 to 5 s.
Can I use an absolute encoder to skip homing on every power cycle?
Yes. With an EnDat 2.1 or 2.2, SSI, or PROFINET absolute encoder configured in the technology object, the S7-1200 reads the absolute position across power cycles and the "Homed" bit is set automatically. MC_Home with Mode = 0 (absolute set) only needs to be executed once at commissioning to align the absolute position to the machine coordinate system. Incremental encoders always require active or passive homing on every power cycle.
What does SINAMICS fault F1611 mean during homing?
F1611 indicates a referencing error in the drive. It is raised when the drive receives a homing command from the controller but cannot complete it, typically because the safety circuit is open (STO active), the encoder is not yet referenced, the reference cam is not detected, or the drive is in a fault state. Clear the SINAMICS fault buffer with the appropriate acknowledge, close the safety chain, and verify the encoder wiring before re-attempting MC_Home.
How do I tell whether I have a SIMOTION D or a standalone SINAMICS drive?
Open TIA Portal and run "PROFINET device diagnosis" on the subnet. The device name, order number (MLFB), and firmware version are listed. SIMOTION D controllers report their SIMOTION runtime version in addition to the SINAMICS firmware; standalone SINAMICS drives report only the SINAMICS firmware. SIMOTION D MLFBs start with 6AU1 or 6DD1; standalone SINAMICS S120 CU320-2 MLFBs start with 6SL3; SINAMICS G120 Control Units start with 6SL3 as well, with a different firmware family.