G28, G29, and G30 Reference Point Return: A Practical Homing Guide
Master CNC homing with G28, G29, and G30 reference return commands. Compare Fanuc, Siemens, and Mitsubishi parameter setups to avoid turret collisions.
Homing Commands and Volatile Coordinate Memory
A critical threat in automated CNC operations is a physical machine collision caused by volatile coordinate memory loss. If an operator restarts a machine tool and immediately issues a G29 command to depart from a reference point without first establishing the intermediate waypoint via G28 or G30, the CNC system will abruptly halt execution and trigger a PS0305 or P430 alarm. In even more severe scenarios, if the axis mirroring function remains active from a previous operation, the tool will travel in the exact opposite direction of its intended intermediate point, driving the tool turret straight into a rotating chuck or vise jaw. This structural crash results in a shattered cutter, a ruined scrap workpiece, and expensive spindle alignment damage. Understanding the precise syntax and parameters governing G28, G29, and G30 commands is the only way to safeguard machine geometry and prevent catastrophic tooling failures during high-speed transitions.
Technical Summary
| Specification | Details |
|---|---|
| G-Code Commands | G28 (Primary Reference Return), G29 (Return from Reference), G30 (Secondary Reference Return) |
| Modality Group | Group 00 (Non-modal) |
| Compatible Controllers | Fanuc, Siemens, Mitsubishi |
| Critical Parameters | Fanuc: 16205 bit 0 (SZR), 1015 bit 4 (ZRL); Siemens: MD34100, SD43340; Mitsubishi: #1279 ext15/bit6, #2025, #2026 |
| Main Kinematic Constraint | Requires prior G28/G30 execution to record the intermediate waypoint before G29 is permitted. Active mirroring and coordinate system rotations must be canceled to prevent path inversion. |
Quick Read
- Always run a G28 homing routine immediately after power-up to establish intermediate point coordinates in volatile memory and prevent immediate G29 execution alarms.
- Explicitly cancel tool radius offsets using G40 and length compensations using G49 before calling reference returns to avoid unpredictable shifts when hitting intermediate waypoints.
- Deactivate all active coordinate rotations and axis mirroring functions to eliminate the danger of inverted axis movements that crash the spindle into workholding.
- Tweak Fanuc parameter 1015 bit 4 (ZRL) to force linear interpolation instead of rapid dog-leg motion when toolpaths must clear tight fixture clamps.
- Enable Mitsubishi parameter #1279 ext15/bit6 to execute a single block stop at the intermediate waypoint, allowing manual clearance verification by the operator.
- Operate Siemens controls in ISO Dialect Mode by programming G291 to access standard G28, G30, and G27 commands, or switch to Native Siemens Mode using G290 to utilize G74 referencing.
Core Homing Concepts and Intermediate Waypoints
Homing commands serve to safely navigate the machine axes to fixed, physically established zero grid points or secondary tool change positions. The primary mechanism of G28 and G30 involves a two-phase motion sequence. First, the control commands all specified axes to move at rapid traverse to a designated intermediate waypoint. Once this intermediate point is reached, the control calculates the path to the hardcoded machine reference position and moves the axes to this target.
This dual-stage movement is crucial because a straight-line move from the active tooling position to the home point could easily intersect with high-profile fixtures. The intermediate coordinate acts as a kinematic bend, steering the tool around obstruction zones. However, this relies entirely on active volatile memory. When a machine is powered off, these saved waypoint coordinates are wiped clean. Attempting a G29 departure command without a preceding G28 or G30 sequence to record a new intermediate point forces the control to immediately halt to prevent random motion.
Command Structure and Syntax
The syntax structure of reference return commands relies on a combination of G-codes, target axis coordinate addresses, and optional position registers. Programmers must understand that the coordinates designated in a G28 or G30 block do not define the final home position itself. Instead, they define the exact intermediate waypoint that the tool must traverse before homing.
To execute departures from the home position, the G29 command is invoked. The control reads the recorded intermediate coordinates from its active register, commands a rapid traverse back to that waypoint, and then continues on to the final target coordinates programmed in the G29 block. This ensures that the tool exits the homing position along the exact same safe path it used to enter it.
Syntax variations by brand:
- Fanuc:
G28 IP_;(Homing via intermediate point IP),G30 P_ IP_;(Secondary return via IP, P selector P2-P4),G29 IP_;(Departure to target IP via recorded waypoint) - Siemens (G291 ISO Dialect):
G28 X... Y... Z... C...;(1st reference return via waypoint),G30 Pn X... Y... Z...;(Secondary return via waypoint, Pn selector 2-4),G27 X... Y... Z...;(Referencing check) - Mitsubishi:
G28 X_ Y_ Z_ a_;(1st reference return via waypoint),G30 P_ X_ Y_ Z_ a_;(Secondary return via waypoint, P selector 2-4),G29 X_ Y_ Z_ a_;(Departure via waypoint)
| Address / Parameter | Functional Role | Brand Specifics |
|---|---|---|
IP_ / X, Y, Z, a, C | Specifies the intermediate waypoint coordinates in absolute or incremental mode. | Universal |
P_ / Pn | Selects the secondary reference point register (2, 3, or 4). | Fanuc, Siemens, Mitsubishi (Default is P2 if omitted) |
,F | Temporarily assigns a rapid feedrate for the homing return. | Mitsubishi exclusive override |
Brand-Specific Application Configurations
Fanuc
Within the Fanuc ecosystem, reference point returns are highly customizable through dedicated system parameters. Parameter 16205 bit 0 (SZR) allows operators to determine if the G28 and G30 commands must pass through the intermediate waypoint or bypass it. Parameter 1015 bit 4 (ZRL) dictates whether the path from the intermediate waypoint to the reference point uses linear or non-linear interpolation.
Example G-code implementation: G28 X100.0 Y50.0; commands a return to the primary zero grid marker by traversing through the intermediate waypoint at X100.0, Y50.0.
- Parameter 16205 bit 0 (SZR): 1 = Forces axis to pass through intermediate point; 0 = Bypasses waypoint to travel directly.
- Parameter 1015 bit 4 (ZRL): 0 = Non-linear "dog-leg" rapid positioning; 1 = Forces linear interpolation.
- Parameter 3001 bit 7 (ZPO): 0 = Signal on calculation completion; 1 = Signal delayed until physical axis settling.
- Parameter 1005 bit 0 (ZRNx): 0 = Issues alarm if movement commanded before power-up homing; 1 = Suppresses alarm.
- Alarm PS0305: Triggered when a G29 is executed after power-up without a preceding G28 or G30 sequence.
- Alarm PS0090: Reference return incomplete because the axis starts too close to the home switch or velocity is too low.
- Alarm PS0304: G28 commanded before absolute zero has been established.
- Legacy Difference: FS15-MA controls utilize a unique
Paddress syntax for positioning rather than standard coordinate inputs.
Warning: Ensure that absolute zero has been fully established before calling G28. Failing to do so will result in a PS0304 alarm and halt automatic operations.
Siemens
Siemens handles ISO reference returns in dialect mode by routing commands through internal cycles. The machine data parameter MD34100 defining system reference positions controls coordinate values in incremental systems. Setting data parameter SD43340 dictates coordinates for G30.1 command positioning within the CYCLE328Cycle cycle shell.
Example G-code implementation: G28 G91 X0 Y0 Z0; triggers a rapid zero-return cycle under G291 Dialect mode, referencing the primary machine coordinate axes.
- Parameter MD34100 $MA_REFP_SET_POS[0...3]: Defines actual coordinate values of the four incremental system reference points.
- Parameter SD43340 $SC_EXTERN_REF_POSITION_G30_1: Establishes coordinate values for G30.1 reference commands.
- Alarm 61816 "Axes not on reference point": Generated if a G27 check determines axes are not positioned on their exact reference coordinates.
- Alarm 61804 "Programmed position exceeds home position": Occurs if intermediate coordinates lie beyond physical machine limits.
- Alarm 61805 "Value programmed as absolute and incremental": Triggered by conflicting absolute and incremental calls in the same command block.
- Mode Differences: G27, G28, and G30 require ISO Dialect Mode (G291); Native Siemens mode (G290) reserves G74 for homing.
Warning: Always disable active axis mirroring and kinematic transformations prior to homing. If left active, coordinate mirroring will invert the toolpath, driving the tool into structural machine barriers.
Mitsubishi
Mitsubishi controllers provide highly dynamic control by allowing feedrate overrides directly inside homing blocks. Parameter #2025 (G28rap) sets the default rapid rate for dog-type returns. Parameter #1279 bit 6 (ext15) enables an active pause exactly at the intermediate waypoint.
Example G-code implementation: G28 X100.0 Z50.0 ,F1000; executes a homing sequence through the designated intermediate waypoint while overriding the speed to 1000 mm/min.
- Parameter #2037 to #2040: Sets coordinates of reference points 1 to 4 relative to basic machine zero.
- Parameter #2025 G28rap: Defines the maximum rapid traverse rate for dog-type reference point returns.
- Parameter #2026 G28crp: Sets the decelerated approach speed to the zero marker after dog switch activation.
- Parameter #1279 ext15/bit6: 0 = Standard return; 1 = Enables single block stop at the intermediate point.
- Alarm M01 0009: Triggered when a G30 return is attempted before the 1st reference return has been completed.
- Alarm P931: Program error when a reference command is issued with active tool length compensation in the axis direction.
- Version Differences: Machining Center (M) systems support up to G30.6 and return Z then X/Y, while Lathe (L) systems support up to G30.5 and return X only.
Warning: Tool length compensation must be explicitly canceled with G49 before executing a homing return. Active compensation shifts the waypoint and triggers a P931 alarm.
Controller Brand Comparison
| Feature Category | Fanuc | Siemens (G291 ISO Dialect) | Mitsubishi |
|---|---|---|---|
| Command Set Support | G28, G29, G30 (standard commands) | G28, G30 (G29 is not defined; G27 is used instead) | G28, G29, G30 (standard commands) |
| Execution Backend | Hardcoded firmware with parameter-based custom configurations | Editable internal SINUMERIK cycles (CYCLE328 and CYCLE330) | Hardcoded firmware with specialized machine parameters |
| Waypoint Homing Pause | — (no source) | — (no source) | Parameter #1279 ext15/bit6 enables single block stop at intermediate point |
| Approach Speed Override | Bypasses manual feedrate; uses fixed parameters | Bypasses manual feedrate; uses rapid traverse rate | Allows inline ,F feedrate coordinate override in G28/G30 |
Analytical Comparison of Brand Architectures
Siemens SINUMERIK systems distinguish themselves from both Fanuc and Mitsubishi controls through their high-level cycle execution backend. While Fanuc and Mitsubishi execute G28, G29, and G30 commands as hardcoded, low-level firmware instructions, Siemens routes these commands dynamically through editable cycle shells named CYCLE328 and CYCLE330. This software-based layer enables Siemens to automatically execute safety verification checks on active coordinate systems, deactivating conflicting kinematic transformations on the fly and ensuring the intermediate waypoint does not exceed physical axis limits before a physical movement is even sent to the servo motors.
In terms of real-time operator control at the machine, Mitsubishi stands out by providing features like waypoint pauses and override feedrates. Under Mitsubishi parameter #1279 bit 6, operators can configure the control to perform an active single block stop directly at the intermediate waypoint. This gives the operator a manual safety window to visually verify that the tool has cleared the vise jaws or fixtures before it retracts back to the zero point. Additionally, Mitsubishi is the only control that permits an inline ,F feedrate command in a G28 or G30 block, overriding the default #2025 G28rap parameter rapid traverse. This manual speed control is vital for suppressing heavy structural vibrations on massive gantry machines or older ball screw drives.
Fanuc, by contrast, relies on a deep set of machine parameters to adjust homing behavior globally. For instance, rather than offering cycle-level adjustments, Fanuc utilizes Parameter 16205 (SZR) to completely eliminate intermediate point traversal, allowing the machine to travel directly to zero to minimize cycle times in open work envelopes. To ensure axis stability, Fanuc features a unique settling confirmation delay via Parameter 3001 (ZPO), which holds the homing completion signal until physical axis encoders have fully settled, providing absolute positioning safety before automatic loaders or pallet changers are authorized to cycle.
Practical Program Examples
To illustrate the practical differences between these three control systems, the following examples demonstrate how G28, G29, and G30 commands are programmed in production.
Fanuc Homing and Departure Sequence
O0001 (FANUC HOMING EXAMPLE) ;
G90 G21 G40 G49 (Safety block: absolute, mm, cancel offsets) ;
G28 X100.0 Y50.0 (Return to 1st reference point via intermediate waypoint) ;
G30 P2 Z0.0 (Return to 2nd reference point via Z0.0 waypoint for tool change) ;
T02 M06 (Execute tool change) ;
G29 X25.0 Y25.0 (Depart from reference point to target via recorded waypoint) ;
M30 ;
Dry Run Analysis:
- The machine reads the safety block, canceling active tool offsets and setting the coordinate format to millimeters.
- When executing
G28 X100.0 Y50.0, the X and Y axes traverse at rapid feedrate to the intermediate waypoint coordinates of X100.0 and Y50.0. - Upon arriving at the intermediate point, the machine automatically moves both axes in rapid traverse to the primary machine zero grid.
- Next,
G30 P2 Z0.0is called. The Z-axis retracts to the intermediate Z0.0 coordinate and then proceeds directly to the hardcoded secondary reference point P2 (tool change position). - After the tool changer completes tool number two, the
G29 X25.0 Y25.0command is parsed. The control reads the intermediate coordinates recorded during the G28 command (X100.0, Y50.0) from volatile memory, rapid-traverses the tool back to that waypoint, and then proceeds to the programmed end coordinate target at X25.0, Y25.0.
Siemens Dialect Mode Homing Sequence
; SINUMERIK ISO DIALECT MODE HOMING
G291 (Switch to ISO Dialect Mode G291) ;
G91 X0 Y0 Z0 (Set incremental mode for waypoint) ;
G28 X0 Y0 Z0 (Return to 1st reference point via current position as waypoint) ;
G30 P3 X30. Y50. (Return to 3rd reference point via incremental waypoint) ;
G27 X100. Z50. (Execute referencing check on specified axes) ;
G290 (Switch back to native Siemens mode) ;
M30 ;
Dry Run Analysis:
- The control interprets G291 and switches from native Sinumerik mode to ISO Dialect mode.
- In incremental mode (
G91),G28 X0 Y0 Z0specifies the current tool coordinates as the intermediate waypoint. The machine bypasses a physical intermediate shift and rapid-traverses straight to the primary machine zero point. - The next block,
G30 P3 X30. Y50., commands the X and Y axes to move incrementally by 30mm and 50mm respectively to establish the waypoint before rapid-traversing to the third incremental reference point defined by machine data MD34100. - Finally,
G27 X100. Z50.executes a referencing check. The axes traverse to the expected home position coordinates; if the control registers any deviation from the physical home grid, it triggers Alarm 61816 to halt execution.
Mitsubishi Rapid Override Homing Sequence
% (MITSUBISHI HOMING EXAMPLE)
G90 G21 G40 G49 (Standard cancellation block) ;
G28 X100.0 Z50.0 ,F1000 (1st reference return via waypoint with overridden rapid speed) ;
G30 P2 X50. Y50. Z0. (2nd reference return via intermediate coordinates) ;
G29 X20. Z20. (Start position return to final target via recorded waypoint) ;
M30 ;
%
Dry Run Analysis:
- The control reads the initial safety coordinates, canceling active radius and length offsets.
- The G28 block instructs the X and Z axes to move to the intermediate waypoint at X100.0 and Z50.0. The
,F1000command overrides the#2025 G28rapparameter, restricting the traverse feedrate to exactly 1000 mm/min to prevent vibrations. - If Parameter #1279 bit 6 (ext15) is active, the machine pauses in a single block stop at the intermediate point. The operator verifies tool clearance, then presses cycle start.
- The control automatically rapid-traverses the tool to the primary machine reference point.
- The subsequent
G30 P2command rapid-traverses the tool through the intermediate waypoint of X50.0, Y50.0, Z0.0 to the secondary home register P2. - The
G29departure reads the latest intermediate waypoint coordinates from G28 (X100.0, Z50.0), rapid-traverses back to that waypoint, and then drives the tool to its programmed destination at X20.0, Z20.0.
Homing and Departure Error Analysis
| Brand | Alarm Code | Trigger Condition | Operator Symptom | Root Cause & Correction |
|---|---|---|---|---|
| Fanuc | PS0305 | G29 command executed immediately after power-up without a preceding G28 or G30 reference return. | The cycle halts instantly, and a flashing red alarm screen displays "INTERMEDIATE POSITION IS NOT ASSIGNED." | The volatile coordinate memory has no waypoint data saved. Program and execute a G28 homing routine first to store the waypoint before invoking G29. |
| Fanuc | PS0090 | Axis is physically positioned too close to the home limit switch or travel speed is too slow during G28. | The controller hangs, showing "REFERENCE RETURN INCOMPLETE" on the CRT display. | The axis lacks the physical deceleration distance needed to detect the zero grid marker. Move the axis away manually and ensure feedrate is sufficient to trigger the dog. |
| Siemens | Alarm 61816 | G27 referencing check determines that one or more axes are not on their physical machine reference point. | Automatic mode is instantly interrupted, flashing "Axes not on reference point." | There is a physical axis coordinate drift or homing switch failure. Re-reference the axes manually or adjust coordinates in parameter MD34100. |
| Siemens | Alarm 61804 | The programmed intermediate waypoint coordinate exceeds the maximum physical home limits. | The cycle aborts immediately, and the display flashes "Programmed position exceeds home position." | The programmed intermediate target is physically unreachable. Modify the coordinate values in the program block to stay within safe machine envelopes. |
| Mitsubishi | P430 | G29 start position return executed after power ON without a prior G28 reference return. | The machine drops active feed, halts movement, and throws a "Program error" on the diagnostic page. | Volatile waypoint registers are empty. You must execute an automatic G28 reference return block prior to issuing any G29 coordinate departure commands. |
| Mitsubishi | P931 | A G27 to G30 command is issued while tool axis length compensation is still active. | The controller locks execution, showing a "Program error" fault on the status panel. | Homing with active compensations is forbidden as it shifts coordinate calculations. Program a G49 code to cancel tool length offset before executing homing. |
Critical Safety Application Note
Executing a reference return command while an active coordinate conversion, rotation, or axis mirroring function is left enabled represents one of the most destructive programming errors in CNC machining. When an operator fails to program a G50.1 or G69 cancellation code before executing G28 or G30, the control continues to calculate coordinate trajectories using the active transformation matrix. On Siemens and Mitsubishi controls, this failure is severe because the mirroring transformation will remain active for the movement from the starting location to the intermediate waypoint. The physical consequence is immediate and devastating: the tool axis moves in the exact opposite direction of the intended waypoint, driving the tool turret or spindle directly into a rotating machine chuck, a high-profile fixture clamp, or a vise jaw. The operator is met with a massive, high-decibel hard collision that shatters the carbide tooling, warps the precision ball screws, and destroys the workpiece into a scrapped part. To ensure absolute process safety, programmers must adopt a strict policy of cancelling all compensations and clearing active transformations prior to any homing blocks, and physically verify the trajectory using the CNC's 3D graphical trace screens on the first setup.
Related Homing and Reference Commands
To program reference returns effectively, operators must understand the broader network of coordinate and check commands that interact with zero return routines.
- G27 (Reference Position Check): Utilized on Fanuc and Mitsubishi (and in Siemens G291 mode) to verify if the axes have successfully reached their home coordinates, triggering an alarm if deviation is detected.
- G30.1 (Floating Reference Position Return): Allows the tool to return to a floating reference coordinate that is dynamically calculated via parameters like SD43340 in Siemens, bypassing the fixed physical zero switch.
- G53 (Machine Coordinate System Selection): Moves the tool directly to absolute machine coordinates relative to basic machine zero without recording intermediate waypoints in volatile memory.
- G74 (Native Reference Point Approach): The native Siemens (G290) command for referencing machine axes, serving as the direct functional equivalent to G28 in legacy dialect modes.
- G75 (Native Fixed Point Approach): The native Siemens command used to retract the spindle directly to fixed positions like tool change zones, acting as the native replacement for G30.
- G00 (Rapid Traverse): Used to position the axes at high speed to initial coordinate points prior to homing returns.
- G17, G18, G19 (Plane Selection): Establishes the active plane for circular interpolation and coordinate scaling during homing approaches.
- G20, G21 (Unit Selection): Scales the baseline coordinate values between inch and metric systems, impacting intermediate point coordinates.
Practical Homing Strategy for Operators
Minimizing production downtime and avoiding expensive spindle rebuilds requires a disciplined, structured approach to reference returns. Programmers should establish a standard G-code safety template that cancels all coordinate rotations, mirroring functions, and tool compensations immediately before calling G28 or G30. By enforcing manual zero returns after every power-up and double-checking intermediate waypoint coordinates using 3D trace screens, operators can ensure that axes navigate the critical "kinematic bend" safely, keeping the tool far away from fixtures and preventing catastrophic workholding collisions.
Frequently Asked Questions
Why does my CNC throw an alarm when I execute a G29 command after starting the machine?
When the machine is powered ON, the volatile memory registers that store the intermediate waypoint coordinates are completely empty. If you execute a G29 command to depart from home without first executing a G28 or G30 to record an intermediate position, the control has no reference coordinate to travel through and immediately halts, triggering a PS0305 alarm on Fanuc or a P430 program error on Mitsubishi. To fix this, always program and execute a G28 zero return before commanding a G29 departure.
Can I perform a reference point return with tool length compensation active?
No, executing reference returns with active tool offsets is highly dangerous and explicitly blocked on some controls. On Mitsubishi, executing a G28 or G30 command with active tool axis length compensation will instantly trigger a P931 program error and halt axis travel. On other systems, the offset will shift the calculated intermediate waypoint, risking a severe collision with a vise jaw or fixture clamp. Always program a G49 code to cancel tool length compensation before commanding any reference return.
How do I prevent the default non-linear "dog-leg" rapid movement during a G28 return?
By default, CNC controls rapid-traverse all axes simultaneously to the reference point, resulting in a diagonal "dog-leg" path that can easily clip high fixtures. On Fanuc systems, you can force the control to use straight-line linear interpolation from the intermediate point to the reference point by changing Parameter 1015 bit 4 (ZRL) to 1. This forces a controlled, linear toolpath that is far easier to predict and clear of obstructions.
Still not resolved?
Ask our AI assistant about this topic in natural language. Grounded in verified sources, no hallucinations.

- CNC CARE Co-Founder (May 2025 - Present)
- Mitsubishi Electric NC Sales & Service Section Manager (2008 - 2025)
- Reis CNC Service Engineer (2003 - 2005)
- Ören Kalıp CNC Mold Line Team Leader (1999 - 2002)
With over 25 years of experience working in all areas of the CNC machine industry, I continue my activities as a co-founder of CNC CARE, where we offer brand-independent consulting, engineering, and original spare parts services.
Related Articles
Other articles on this topic
Siemens CYCLE800 G-Code: Swivel Planes & Tool Alignment
Master Siemens CYCLE800 for 3+2 axis machining. Learn plane swiveling, tool alignment, parameter setup, and how to troubleshoot Alarm 61190 and 61153.
Siemens CYCLE72 Contour Milling: Guide to Sinumerik Path Milling
Master Siemens CYCLE72 for contour milling on Sinumerik CNC controls. Learn parameter setup, avoid simulation alarm 61123, and prevent machine collisions.
Siemens CYCLE952 Contour Turning Cycle Programming Guide
Master Siemens CYCLE952 contour turning on Sinumerik CNC controls. Learn parameter lists, resolve Alarm 61051, and configure balance cutting.
Siemens SLOT1 and SLOT2 Slot Milling Cycles Programming Guide
Master slot milling on Siemens Sinumerik controls using SLOT1 and SLOT2 cycles. Learn parameter configurations, alarm 61000 prevention, and optimal tool paths.