Hi,
what is supposed to happen is that the Z axis moves in the nominated direction at the nominated homing speed UNTIL
the Z axis homing switch activates. The axis will stop. The axis will then move backwards UNTIL the Z axis switch
de-activates at which time the Z axis will stop again. At that point the machine coordinate of the Z axis is set to zero,
or the nominated Z axis homing offset, if any.
It sounds like your Z axis is moving in the correct direction and stopping as its meant to but not backing off the switch.
What kind of switch are you using?. It has been my observation that proximity switches are a poor choice because there
is vanishingly small distance between where the switch first activates and when moving backwards when it de-activates.
The amount of motion means that it is possible for flexure or vibration to cause repeated switch activations at which point
Mach gives up the ghost.
Snap action microswitches on the other hand have a well defined hysteresis and are less inclined to false trigering.
When an axis approaches a snap action home switch it activates the switch, stops and then backs off, often by as
much as 1/2mm which is visually apparent.
Craig