Customizing ShopTurn F_HOME: Safe Y-Axis Retract on SINUMERIK

David Krause13 min read
Other TopicSiemensTechnical Reference
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

Overview: F_HOME in SINUMERIK ShopTurn

The F_HOME cycle is the standard tool-change-point approach routine that the SINUMERIK ShopTurn machining-step programming environment calls before and after every turret indexing or tool change. Its purpose is to retract the active tool to a collision-free position so the turret can rotate without striking the workpiece, the chuck, the tailstock, or any fixture. On lathes equipped with a Y-axis (typically a milling-capable turning machine such as the Siemens ShopTurn 840D sl / ONE class), the standard F_HOME shipped from Siemens does not always force a Y-axis retract to machine zero, which can result in diagonal rapids that smash a micro-boring bar or a grooving insert into the part OD.

This reference describes the file architecture behind F_HOME, the labels that the cycle exposes, the system variables that drive tool-change behavior, and a field-proven pattern for forcing G0 SUPA Y0 D0 at every event point. It also documents the simulation checksum problem in F_HEAD and the machine data switches that can be used to bypass it.

Critical: Always archive the original SPF files before editing. Siemens does not publish the source of the OEM F_HOME, so any restoration requires the original delivery image or a backup of NC data/Cycles.

Prerequisites and File Locations

Editing F_HOME requires access to the NC file system. On a SINUMERIK 840D sl / SINUMERIK ONE, the relevant directories are:

Path on CF card / NCU Purpose Edit safely?
/NC/CYCLES/USER/F_HOME.SPF User override of F_HOME. Wins precedence over the OEM version. Yes — backup first
/NC/CYCLES/MAKER/CUST_TECHCYC.SPF Manufacturer/Customizer hook for technology cycles (where Siemens, Emco, DMG-Mori, Index, etc. inject their own retractions). Yes — never delete
/NC/CYCLES/MAKER/CUST_M6.SPF M6-specific user cycle. Do not place retract logic here on a lathe. Generally not the right location
/NC/CYCLES/STD/F_HOME.SPF Siemens-delivered F_HOME. Read-only on production controls. No
/NC/CST_DIR/ Part programs (ShopTurn *.MPF and G-code). Yes

For details on the directory layout see the SINUMERIK 840D sl ShopTurn Operator's Guide. For the SinuTrain ShopTurn CL SW 2.6 SP1 HF1 offline training kit (article 6FC5870-6YC20-1YA0) the same paths apply under the installed image; see Siemens product support entry 6FC5870-6YC20-1YA0.

Required permissions: service password (Manufacturer level) or higher; read access via the HMI's Commissioning > NC files tree.

F_HOME.SPF Architecture and Label Semantics

The Siemens-delivered F_HOME is structured as a single SPF subroutine called by ShopTurn at well-defined event points. Each event enters the cycle at a numeric label of the form _Mxxx and returns via GOTOF _MEND. The seven events the integrator must handle are summarized below.

Label Event What to put here
_M110 After tool change (cycle with tool change) Y-axis retract to machine zero, then re-engage Y0 in part coordinates.
_M111 Tool change in the cycle (turret rotation point) Same as _M110. Set-frame compensation for any Par quill / steady rest.
_M112 Before tool change at the release plane Coolant OFF (M09), final Y/X retract to clearance plane.
_M113 Before cutting edge change (D change) Retract to tool-change point. The new D number is already in _F_D_NO.
_M114 After tool change cycle (no tool change, just positioning) Retract to Y0 in part coordinates.
_M116 At the tool change point Final Y0 in machine coordinates (SUPA Y0 D0).
_M117 Before tool change T (T-selection block) No motion; T is queued.

The ShopTurn cycle F_HOME is itself called from the high-level machining steps. The Siemens setup turning programming manual documents the call points: "In order to avoid collisions with the work piece the ShopTurn cycle F_HOME for the approach of the tool changing point is called up." (see A120 Setup Turning 04/05 EN). On modern controls F_HOME is generated automatically by the ShopTurn step "Approach tool change point".

CUST_TECHCYC.SPF: The Manufacturer Override Mechanism

Although the OEM F_HOME source is not exposed, machine builders (Emco, DMG-Mori, Index, Doosan/DN Solutions, Nakamura-Tome) ship a customization layer at /NC/CYCLES/MAKER/CUST_TECHCYC.SPF. This SPF runs before the user F_HOME in the call chain. It is the preferred integration point for machine-specific retraction logic, including the G0 SUPA Y0 D0 lines Siemens or the OEM inserts by default. The same labels (_M110_M117) are reused inside CUST_TECHCYC.SPF, so the integrator can place conditional retraction logic in either or both files.

Gotchas documented in field deployments:

  1. The _M110 (after tool change) section executes after the turret has rotated. Any motion added there risks collision with a tool that is still in the part.
  2. The _M111 / _M112 sections execute before the tool change. Pre-retract must be placed here, never in _M110.
  3. Neither section runs at the start of a ShopTurn program even when a T0 is in the header. Homing logic must be added to the program-start hook (see the Homing Routine section below).
  4. These callbacks are ShopTurn-only. Hand-written G-code and CAM-posted programs must call F_HOME explicitly or handle tool changes themselves.
If the OEM has commented out the G0 SUPA Y0 D0 line in CUST_TECHCYC.SPF (preceded by a ;), the integrator must first un-comment it and then verify that no Y-axis collision exists in the user's fixtures before re-enabling.

System Variables for Tool Change Logic

The system variables consumed by F_HOME and CUST_TECHCYC.SPF are part of the SINUMERIK NC variable namespace. The most useful ones for Y-axis retract logic are:

Variable Type Meaning
ISAXIS(2) Function Returns TRUE if axis 2 (Y) is configured on this machine. Use to make F_HOME portable across Y and non-Y lathes.
$P_TOOL INT Current tool number (>0 means a tool is loaded). Checked with IF($P_TOOL>0).
$P_TOOLNO INT Number of the active tool (used to index $TC_TPC2[..]).
$P_AD[1] REAL Tool type from the tool list. 731 = Par quill, 732 = Steady rest. Exclude these from auto-retract.
$P_SETFRAME[..,TR] FRAME Setable frames, translational component. Used to re-zero Y on a tailstock-mounted tool.
$P_SETFR FRAME Overall programmable frame; assign to commit the SETFRAME.
$MC_TOOL_CHANGE_MODE MD Machine data controlling M6 behavior. 1 = M6 triggers turret rotation in ShopTurn.
_E_ST_PRG BOOL TRUE while a ShopTurn step program is active. Use to gate the retract to ShopTurn context only.
_F_S_NR[1] INT Spindle number (1 = main, 2 = subspindle).
_F_D_NO INT Target D number (cutting edge) for the upcoming change.
$P_ISTEST BOOL TRUE while running in program-test / dry-run mode. Used to skip mirroring for first-pass simulation.

Implementing Safe Y-Axis Retract

The pattern below is the field-validated CUST_TECHCYC.SPF body for a Y-axis lathe. It is written to be portable: ISAXIS(2) guards every motion so the file can be deployed unchanged to a non-Y machine (typical Emco ConceptTurn 105 with the Y-axis option removed).

;_M110: ; After tool change cycle (with tool change)
IF($P_TOOL>0)
  _I=$P_AD[1]
ENDIF
IF(_I<>731) AND (_I<>732) ; not Par quill or Steady rest
  IF ISAXIS(2)
    G0 SUPA Y0 D0 ; retract Y to machine zero
  ENDIF
ENDIF
GOTOF _MEND

;_M111: ; Tool change in the cycle
IF ISAXIS(2)
  G0 SUPA Y0 D0
ENDIF
GOTOF _MEND

;_M112: ; Before tool change at release plane
IF(_E_ST_PRG)
  IF($P_TOOL>0)
    _I=$P_AD[1]
  ENDIF
  IF(_I<>731) AND (_I<>732)
    N1110 F_HOME ; built-in retract
  ENDIF
ENDIF
M09
GOTOF _MEND

;_M113: ; Before cutting edge change
IF(_E_ST_PRG)
  IF($P_TOOL>0)
    _I=$P_AD[1]
  ENDIF
  IF(_I<>731) AND (_I<>732)
    N1130 F_HOME
  ENDIF
ENDIF
GOTOF _MEND

;_M114: ; After tool change cycle (no tool change)
IF ISAXIS(2)
  G0 Y0 ; part-coordinate Y0
ENDIF
GOTOF _MEND

;_M116: ; At tool change point
IF ISAXIS(2)
  G0 SUPA Y0 D0
ENDIF
GOTOF _MEND

Key design points:

  • SUPA forces the move in machine coordinates. Combined with D0 it also clears the tool-length offset so the move is repeatable regardless of the active tool.
  • Par quills (tool type 731) and steady rests (732) must be skipped — their geometry does not allow a Y0 retract.
  • The split between _M110 (after) and _M111 (before) prevents the diagonal rapid that causes broken boring bars when the next operation begins inside a pre-drilled hole.

PLC vs NC Tool Change (M6 vs T[n])

On a SINUMERIK ShopTurn lathe, the actual turret indexing is driven by the machine builder's PLC program (typically the S7-300/1500 logic in the MCP / NCU-PLC), not by NC. The NC-side M6 command is a trigger that calls CUST_M6.SPF, which in turn signals the PLC. A bare T<n> in NC code can also index the turret on machines where the PLC is configured for "T-prepare + T-rotate" mode.

Trigger NC-side cycle called PLC-side effect
T<n> None directly (PLC may invoke F_HOME) PLC rotates turret to slot n
M6 (with $MC_TOOL_CHANGE_MODE=1) CUST_M6.SPF PLC rotates turret; F_HOME pre/post-motion runs
ShopTurn "Tool change" step F_HOME & CUST_TECHCYC.SPF PLC rotates turret; retracts per CUST_TECHCYC
Physical MCP tool-change button None PLC rotates turret; F_HOME is not called automatically

Because the physical tool-change keypress routes directly to the PLC, the Y0 retract will not run when the operator cycles through tools from the keyboard. The only complete fixes are either (a) editing the PLC to invoke F_HOME before issuing the turret-rotate command to the NCK, or (b) replacing the MCP-button handler with an NC procedure that issues G0 SUPA Y0 D0 ; T<n> M6. Refer to the Tool Management chapter of the SINUMERIK Operate Programming Manual for the PLC interface signals involved (e.g. DB72.* on classic 840D, DB990x on ONE).

Program Simulation: F_HEAD Checksum and Bypasses

ShopTurn refuses to execute a program that has not been simulated. The "has been simulated" flag is stored as the first integer argument in the F_HEAD preamble that ShopTurn writes to the top of every *.MPF:

F_HEAD(1455947775,12,0.3,,150,5,5,3.8,0,180.71417,282.77133,1,R150,R151,71,1,35535,,70,0,20,6,6,100,100,100,1,164.8,,8650751,16079,2,0,6,200,0,,-100,-80,6,100,100,100,10,10,0,0,0,200,50,720);*RO*

The first numeric token is a 32-bit hash of the program parameters (XRA, XRI, ZRA, tooling list, etc.). It is regenerated by the simulator on every successful run. Editing the program invalidates the hash, and the control prompts the user to re-simulate. This is a safety feature, but it is a productivity barrier for shops that program in a "macro-of-macros" style and call subprograms in many different Z-zero and mirror contexts.

Bypass Options

  1. Manual hash patch. Locate a previously simulated program with the same retract-relevant parameters (XRA, XRI, ZRA) and copy its first integer token. Risky if the parameters drift, and is not auditable.
  2. Disable program test via MD. Set MD51039 $MM_PROGRAM_TEST_MODE to 0. This disables the dry-run mode, but does not necessarily clear the F_HEAD hash check on ShopTurn programs — test on a simulated machine first.
  3. Conditional mirroring in the part program. Use $P_ISTEST to skip the G55 mirror on the first-pass simulation run, then let the real production run mirror correctly:
; Program header
IF($P_ISTEST) GOTOF SKIP_MIRROR
MIRROR Y0 ; G55 subspindle mirroring
SKIP_MIRROR:
;(rest of operations)

This is the most defensible workaround: the simulation path stays straight, the production path is mirrored, and no F_HEAD manipulation is required.

Subspindle Mirroring Strategy (G54 main / G55 subspindle)

On a counter-spindle lathe the part is transferred to the subspindle, picked up, and machined on the G55 frame with Y mirrored. The pattern below is the recommended subroutine structure when one physical macro is invoked in both G54 and G55 contexts:

; Master program
G54 ; main spindle frame
F_HOME ; retract
CALL "ROUGH_OUT" ; macro, G54 context
CALL "TRANSFER"  ; bar-feed + G55 mirror
G55 ; subspindle frame
IF($P_ISTEST) GOTOF SKIP_MIRROR
MIRROR Y0 ; live production: Y mirrored on G55
SKIP_MIRROR:
CALL "FINISH_OUT" ; same physical macro, interpreted in G55

The control's tool-direction check (right-hand rule) is satisfied on the first-pass simulation of the master program because the transfer macro sets the mirror state inside the simulation. The individual subprograms still fail in isolation — accept that, and call them only through the master.

Verification and Field Commissioning

After deploying a modified F_HOME or CUST_TECHCYC.SPF, perform this sequence in dry-run mode before any production cut:

  1. Power-cycle or NCK reset to ensure the new SPF is loaded into the active file system.
  2. Run a known-good ShopTurn program in Program Test with the doors open and the turret under observation.
  3. Step through T1 M6 and T2 M6 manually; confirm Y0 in the position display and that $P_SETFR is unchanged.
  4. Trigger a tool change from the MCP button. If Y0 retract does not run, the PLC path is not integrated and a separate MCP patch is required (see previous section).
  5. Inspect the NC/PLC trace for DB72.DBX0.6 (command "Tool change") to confirm the NC-to-PLC hand-off is clean.
  6. Run a full simulation of the master program. The first integer in F_HEAD should be regenerated; record it for archival.

Acceptance criteria: zero Y-axis diagonal rapids in the trace, all M6 events show SUPA Y0 D0 in the block log, and no alarm 21612 "Channel %1 axis %2 contour deviation".

Troubleshooting Matrix

Symptom Likely root cause Remedy
Turret crashes into chuck after M6 Y retract placed in _M110 (after) instead of _M111 (before). Move the G0 SUPA Y0 D0 into _M111; keep only Y0 in part coords in _M110.
Y does not move on Y-less lathe → alarm 20080 ISAXIS(2) guard missing. Wrap every Y0 in IF ISAXIS(2) … ENDIF.
Steady rest retracts and binds Retract applied to tool type 731/732. Add IF(_I<>731) AND (_I<>732) around the retract.
Diagonal rapid on first cut inside a pre-drilled hole Y0 not re-applied in part coordinates after tool change. Add G0 Y0 (no SUPA) in _M110 after the SUPA retract.
ShopTurn: "Program has not been simulated" on first run F_HEAD hash regenerated; subprogram has new parameters. Run the master program once in Program Test; do not run isolated subprograms.
Retract runs in G-code, crashes part F_HOME / CUST_TECHCYC only fire from ShopTurn steps. Add explicit F_HOME call at the head of any hand-written G-code that contains M6.
MCP button rotates turret without Y retract PLC path does not invoke F_HOME. Edit PLC to send DB72.DBX0.6 = 1 via an NC procedure or call F_HOME from the MCP handler.
Frame shifts after tool change with quill $P_SETFRAME not reset for non-quill tools. Reset $P_SETFRAME[SPI(_F_S_NR[1]),TR]=0 in the ELSE branch of the tool-type check.

FAQ

What is the difference between F_HOME.SPF and CUST_TECHCYC.SPF?

F_HOME.SPF is the cycle called by ShopTurn to approach the tool change point; it lives in /NC/CYCLES/USER/ and overrides the Siemens version. CUST_TECHCYC.SPF is the manufacturer / customizer hook at /NC/CYCLES/MAKER/ and runs alongside F_HOME. Place Y-axis retract logic in either, but never in CUST_M6.SPF on a lathe — M6 is not the dominant tool-change path on these machines.

Why does G0 SUPA Y0 D0 prevent the boring-bar crash on entry into a pre-drilled hole?

SUPA switches to machine coordinates, Y0 moves the Y axis to its mechanical zero, and D0 cancels the active tool length offset. The result is a repeatable collision-free parking position regardless of the previous tool. Without SUPA, ShopTurn issues a part-coord Y0 that may still be inside the workpiece when the next tool is engaged, causing a diagonal rapid into the hole wall.

How can I bypass the F_HEAD "not simulated" check without re-simulating?

Three options, in order of safety: (1) Use $P_ISTEST to skip a problematic first-pass mirror in the program itself; (2) set MD51039 $MM_PROGRAM_TEST_MODE to 0 to relax dry-run enforcement; (3) copy the leading integer of an already-simulated program with matching retract parameters into F_HEAD — fragile and not auditable, so use only as a last resort.

Which tool-type numbers must be excluded from the auto-retract?

Exclude tool type 731 (Par quill) and 732 (steady rest). Their geometry does not tolerate a Y0 retract. Check the type with $P_AD[1] in the CUST_TECHCYC.SPF body and gate the retract with IF(_I<>731) AND (_I<>732).

Why does the physical tool-change button on the MCP skip the F_HOME retract?

The MCP button is wired to a PLC input that the machine builder's PLC program services directly. F_HOME and CUST_TECHCYC are NC-side subprograms and are only invoked when an NC event (M6, T-selection, ShopTurn step) calls them. To make the MCP button honor the retract, edit the PLC to call F_HOME via an NC procedure or to assert the tool-change hand-shake only after an SUPA Y0 has been confirmed.

Back to blog