APIs, concepts, guides, and more
DS402 Drive Based Homing

Implement drive-based homing with DS402-compliant drives, utilizing built-in homing methods, ensuring accurate and network latency-free positioning, easily configured via our API or tools.

🔹 What is DS402 Drive Based Homing?

Drive-based homing uses preloaded methods available on your drive. This allows for homing to be performed entirely in the drive without network latencies producing more accurate results. Drive-based homing is the recommended homing strategy.

DS402 is a set of profile specifications that standardize the functional behavior of controllers for servo drives, frequency inverters, and stepper motors.

It is important to follow your drive’s specific instructions on how to home. Most drive’s include documentation on homing procedures, limit switch configuration, etc.

🔹 DS402 Drive Based Homing with RapidCode

The following figure shows the relationship between the input objects and the output objects in the Homing Mode. You can specify the speeds, acceleration rate, and homing method. You can also use home offset to offset zero in the user coordinate system from the home position.




Using the NetworkNode.ServiceChannelWrite(index, subindex, byteSize, value) method from the Axis class, you can configure the following options:

Home Offset – Optional as it is normally zero.

Index 0x607C
Subindex 0x0
byteSize 4

Home Method

Index 0x6098
Subindex 0x0
byteSize 1

Home Speed (when searching switch)

Index 0x6099
Subindex 0x1
byteSize 4

Home Speed (when searching zero)

Index 0x6099
Subindex 0x2
byteSize 4

Home Acceleration

Index 0x609A
Subindex 0x0
byteSize 4

Change Mode of Operation to 6 - Homing Mode

Index 0x6060
Subindex 0x0
byteSize 1
Value 6

Ready Axis

Axis.Abort(); // Disable the Axis
Axis.ClearFaults(); // Clear any Faults
Axis.AmpEnableSer(true); // Enable the axis to trigger the home start
MotionController.NetworkOutputOverrideSet(..); // Take Control of the associated Axis’s Control Word

Ensure people and objects are clear of motion.


Start Homing by setting bit 4 of the Control Word to 1. (Control Word from 15 -> 31).

MotionController.NetworkOutputValueSet(..); // Set values to the Axis to Start Homing.

Evaluate Homing Success

You can monitor the Status Word to determine if/when homing is complete

Status Word bit 10 = 1(HIGH), if Homing is Complete..

Status Word bit 12 = 1(HIGH), if Homing Target was attained.

Status Word bit 13 = 1(HIGH), if there was a Homing error.

Clean Up

Axis.AmpEnableSer(false); // Disable the Axis
Axis.ClearFaults(); // Clear any Faults
MotionController.NetworkOutputOverrideSet(..); // Disable Output Override.

Restore the mode of operation to the control mode you want to run in.

modeOfOpIndex = 0x6060 // Mode of Operation (DS402 Standard)
modeOfOpSubindex = 0x0 // Subindex
modeOfOpByteSize = 1 // INTEGER8 (1 byte)
modeOfOpValueToDEFAULT = 8 // Hex value to determine Mode (8 = Cyclic synchronous position mode)
ServiceChannelWrite(modeOfOpIndex, modeOfOpSubindex, modeOfOpByteSize, modeOfOpValueToDEFAULT);

🔹 Drive Based DS402 Homing with RapidSetup

RapidSetup also allows you to home your DS402 EtherCAT Drive.

New RapidSetup


Home Method: A combobox which lists the DS402 Home Methods. Not all methods may be supported by a drive.

Speed to Switch: The initial speed used to find the Home Switch.

Speed to Zero: The second speed used to find the Index or Edge.

Acceleration: Acceleration used during Homing.

Home Offset: Any post Discovery Offset which you’d like used in the process.

  • Units are in Drive Units rather than User Units.

Old RapidSetup

Value: 2 - Homing with the positive limit switch and index pulse.

Old RapidSetup

🔹 Drive Based DS402 Homing Methods

Drive Based Homing uses functions defined in firmware by the drive manufacturer. Below are diagrams of the DS402 standard but exact implementation by the manufacturer may differ.

Old RapidSetup

(2) PositiveLimitSwitch LeftIndex


(3) PositiveHome LeftIndex

(4) PositiveHome RightIndex


(5) NegativeHome RightIndex

(6) NegativeHome LeftIndex


(7) RisingHome LeftIndex PositiveStart

(8) RisingHome RightIndex PositiveStart


(9) FallingHome LeftIndex PositiveStart

(10) FallingHome RightIndex PositiveStart


(11) FallingHome RightIndex NegativeStart

(12) FallingHome LeftIndex NegativeStart


(13) RisingHome RightIndex NegativeStart

(14) RisingHome LeftIndex NegativeStart


(17) NegativeLimitSwitch

(18) PositiveLimitSwitch


(19) PositiveHome NegativeMomentum

(20)PositiveHome PositiveMomentum


(21) NegativeHome PositiveMomentum

(22) NegativeHome NegativeMomentum


(23) RisingHome NegativeMomentum PositiveStart

(24) RisingHome PositiveMomentum PositiveStart


(25) FallingHome NegativeMomentum PositiveStart

(26) FallingHome PositiveMomentum PositiveStart


(27) FallingHome PositiveMomentum NegativeStart

(28) FallingHome NegativeMomentum NegativeStart


(29) RisingHome PositiveMomentum NegativeStart

(30) RisingHome NegativeMomentum NegativeStart


(33) Negative Index

(34) Positive Index


(35) Current Position


(36) Negative Hard Stop

(37) Positive Hard Stop


📜 Sample Code

  • C#

    // Constants
    const int AXIS_NUMBER = 0; // Specify which axis/motor to control.
    // Homing Offset.
    const int offsetIndex = 0x607C;
    const int offsetSubindex = 0x0;
    const int offsetByteSize = 4;
    const int offsetValue = 0;
    // Home Method
    const int methodIndex = 0x6098;
    const int methodSubindex = 0x0;
    const int methodByteSize = 1;
    const int methodValue = 24;
    // Speed To Switch
    const int targetSpeedIndex = 0x6099;
    const int targetSpeedSubindex = 0x1;
    const int targetSpeedByteSize = 4;
    const int targetSpeedValue = 2;
    // Speed to Zero
    const int originSpeedIndex = 0x6099;
    const int originSpeedSubindex = 0x2;
    const int orignSpeedByteSize = 4;
    const int originSpeedValue = 10;
    // Homing Acceleration
    const int accelerationIndex = 0x609A;
    const int accelerationSubindex = 0x0;
    const int accelerationByteSize = 4;
    const int accelerationValue = 100;
    //Desired DS402 Enabled Output.
    const int CONTROL_WORD_TO_PREP_HOMING = 15;
    const int CONTROL_WORD_TO_START_HOMING = 31;
    const int ACCEPTABLE_DELAY_IN_MS = 20;
    const int STATUS_WORD_TARGET_REACHED_BIT = 0x400; // Status Bit 10 (0x400) indicates Target Reached (Homing is Complete).
    const int STATUS_WORD_HOMING_ATTAINED_BIT = 0x1000; // Status Bit 12 (0x1000) indicates Homing Attained (Homing is Successful).
    const int STATUS_WORD_HOMING_ERROR_BIT = 0x2000; // Status Bit 13 (0x2000) indicates Homing Error (Homing ran into a problem).
    int axisControlWordIndex = (int)axis.NetworkIndexGet(RSINetworkIndexType.NetworkIndexTypeCONTROL_WORD_INDEX);
    // CONFIGURE (Writing to SDOs)
    axis.NetworkNode.ServiceChannelWrite(offsetIndex, offsetSubindex, offsetByteSize, offsetValue); // Home Offset
    axis.NetworkNode.ServiceChannelWrite(methodIndex, methodSubindex, methodByteSize, methodValue); // Home Method (Home type)
    axis.NetworkNode.ServiceChannelWrite(targetSpeedIndex, targetSpeedSubindex, targetSpeedByteSize, targetSpeedValue); // Home Speed during search for switch
    axis.NetworkNode.ServiceChannelWrite(originSpeedIndex, originSpeedSubindex, orignSpeedByteSize, originSpeedValue); // Home Speed during search for zero
    axis.NetworkNode.ServiceChannelWrite(accelerationIndex, accelerationSubindex, accelerationByteSize, accelerationValue); // Home acceleration
    axis.rsiControl.NetworkOutputOverrideValueSet(axisControlWordIndex, CONTROL_WORD_TO_PREP_HOMING); // Control Word should be 15 before Switching to Homing Mode.
    axis.rsiControl.NetworkOutputOverrideSet(axisControlWordIndex, true); // Override Control Word.
    // Delay to give transitions time -or- setup something more complex to ensure drive is in the appropriate state.
    // HOME
    axis.rsiControl.NetworkOutputOverrideValueSet(axisControlWordIndex, CONTROL_WORD_TO_START_HOMING); // Start Homing.
    controller.SampleWait(ACCEPTABLE_DELAY_IN_MS); // Delay to give transitions time -or- setup something more complex to ensure drive is in the appropriate state.
    UInt16 statusWordValue; // Takes the axis index. This will return the status word value.
    bool cancelHome = false;
    statusWordValue = axis.NetworkNode.StatusWordGet(AXIS_NUMBER);
    while ((!cancelHome) && ((statusWordValue & STATUS_WORD_TARGET_REACHED_BIT) == 0)) // When Status Word Indicates Target Reached (Success or Fail) or external evaluator (cancelHome)
    //A timeout that sets cancelHome would be a good idea for this while loop.
    statusWordValue = axis.NetworkNode.StatusWordGet(AXIS_NUMBER); //Update.
    //A short sleep or wait is appropriate so you can't spamming this call.
    if ((statusWordValue & STATUS_WORD_HOMING_ATTAINED_BIT) == 1)
    Console.WriteLine("Axis homed.");
    else if ((statusWordValue & STATUS_WORD_HOMING_ERROR_BIT) == 1)
    Console.WriteLine("Error Occured during homing.");
    //5. CLEAN UP
    axis.AmpEnableSet(false); // Disable the axis.
    axis.rsiControl.NetworkOutputOverrideSet(axisControlWordIndex, false);
    // Restore the mode of operation to the control mode you want to run in. For most, this will be RSIOperationModeCYCLIC_SYNCHRONOUS_POSITION_MODE.