This is not my issue but it is a bug which could explain some odd behavior by many many users. I am also creating the discussion post to meet the criteria setout by the project moderator so it can get progressed. (edit: Beacon is not affected by this bug)
Github Issues Link: [BUG] Accumulating microstep shift during probe moves related to endstop oversampling. · Issue #6711 · Klipper3d/klipper · GitHub
(edit 2:) Unfortunately the linked issue above has been closed but Arksine has posted a PR to address this issue: mcu: fix endstop probing by Arksine · Pull Request #6712 · Klipper3d/klipper · GitHub
Abbreviated issue details, refer to github issues for all details
Issue Description
During Z-axis probing operations, there’s a consistent microstep difference between the trigger position and the halt position that should not be present, depending on driver microstep settings and probing speed. This difference is added to the commanded stepper position which causes it to accumulate over multiple probe moves, resulting in inaccurate bed meshes (with probes that require movement in Z) and potentially affecting first layer consistency and printed geometry.
Reproduction Steps
- Configure Z steppers to use 64 microsteps
- Set probing speed to 3 mm/s
- Apply diff in the
relevant code
section to log the microstep difference. - Perform Z probing operations (e.g loop
PROBE
and optionallyGET_POSITION
at the same x/y position). grep "Probe move" ~/printer_data/logs/klippy.log
to show the step difference, andgrep "Setting toolhead position" ~/printer_data/logs/klippy.log
, to show the continuous drift.
Note: this may require a sufficiently high resolution z-axis or faster probe speeds to reproduce, this bug is consistently reproduced with TR8*4 leadscrews (a rotation distance of 4mm), 1.8 degree steppers, 64 microsteps and 3 mm/s of probing speed. Anything resulting in more steps generated pr sec will show the issue. The microstep shift scales with steps per second.
Observed Behavior
- A consistent microstep shift occurs between trigger and halt positions during probing
- The shift accumulates with each probe move, moving the nozzle closer to the bed
- Bed mesh results are shifted, with error scaling with point count and probe samples
Expected Behavior
Trigger and halt positions should align without a consistent shift during probing operations. Unsure about multi-mcu setups, but the issue would be present there as well.
Additional Observations
- The issue is specific to probing; homing exhibits the same shift but doesn’t have major real-world impact as the position is reset, so no accumulation.
- Reducing microsteps to 16 eliminates the issue when probing at 3 mm/s.
- Driver interpolation does not affect the outcome.
- Setting ENDSTOP_SAMPLE_COUNT to 1 eliminates the issue at the cost of disabling noise filtering (which seems unnecessary on modern printer hardware)
- Increasing ENDSTOP_SAMPLE_COUNT exacerbates the problem (e.g., 32 samples increases error to 4-5 microsteps per probe move in our case)
- The issue has been reproduced on several machines with different stepper drivers (TMC2209, TMC5160)
- Some setups exhibit larger errors than others despite using the same stepper and driver configurations
- Increased probing speeds may increase the error.
- There are possible edge cases where X and Y axes may drift as well.