Skip to content

Troubleshooting

Two causes have been identified. This applies whether the buzz is continuous or only shows up for a few seconds right after a move ends:

  • Gain too high. The outer position and velocity loop gains fight the axis into oscillating around the target instead of settling. Lower pid_position_p/pid_position_i and pid_velocity_p/pid_velocity_i (see Manual tuning below).
  • Current-loop filters disabled. Set torque_filter_hz/ flux_filter_hz (see Manual tuning below).

A brief tone at some settings during a tune is a known artifact of the test moves, not motor damage. It stops on its own when the run ends and doesn’t occur during normal printing.

foci-tune can still land on a pid_position_p high enough to cause the buzzing-while-holding symptom above during regular use. If you’d prefer a different tracking-versus-quietness tradeoff, edit pid_position_p yourself at any time (see Manual tuning below): lower values settle less precisely but hold quieter.

An axis that never completed Tuning runs on gains from a single quick measurement taken during FOCI_SETUP. The same is true if you tuned the axis but did not save the result: the gains foci-tune applies are live only until the next home or restart. Check the gains in DUMP_FOCI STEPPER=<stepper> TUNING=1 against the pid_* values in printer.cfg. Tune the axis, and paste and save the result, before judging motion quality.

Open http://<pi-address>:7130. If the page does not load, check that the service is running:

Terminal window
systemctl status foci-tune
journalctl -u foci-tune -e

Start it with sudo systemctl start foci-tune. If the unit is missing or will not start, run sudo ~/foci-tune/foci-tune setup again; it is safe to repeat.

The UI states the reason. A run needs X, Y and Z homed, no print in progress, an axis that FOCI_SETUP has already run for, and an open FOCI trace device.

The UI shows the reason a run failed. For the FOCI side, enable the debug log and read klippy.log; see Reading the debug log. If foci-tune’s result does not work on your machine, set the gains by hand; see Manual tuning.

foci-tune reads the FOCI trace USB device. Setup installs a udev rule and adds the service user to plugdev. The group change applies to new logins, so log in again, or restart the service, after the installer runs. Run sudo ~/foci-tune/foci-tune setup again to repair the rule.

foci-tune stores every tune and run under the foci-results folder in Moonraker’s config root. The UI lists them under Sessions.

The pasted gains have no effect, or Klipper refuses the config

Section titled “The pasted gains have no effect, or Klipper refuses the config”

See Apply the result: the pasted block must replace the four gain keys in the [foci <stepper>] section, and the change takes effect after RESTART. Running FOCI_SETUP again replaces the pasted gains with its own. If Klipper reports that a SAVE_CONFIG value conflicts with an included value, the same option is set both inside the SAVE_CONFIG block and in printer.cfg or an included file. Edit the explicitly set value to the gain you want, then restart. Do not restart first if a SAVE_CONFIG is still pending, because a restart discards it.

The console shows a short summary. The detail behind a failure, such as the search ladder, error names and safety-fault details, goes to klippy.log only when you enable it:

[foci]
debug: True

Restart Klipper, repeat the failing command, and read the FOCI lines in klippy.log. Include them when you report a problem.

DUMP_FOCI taken while the motor is idle shows a voltage limit of 1024 (3.1%), not your configured voltage_limit. The firmware drops to this safe value when the motor is idle, and writes your voltage_limit when homing starts. To see the configured value, read printer.cfg, or run DUMP_FOCI after the axis has homed.

foci-tune finds gains for you, but every [foci <stepper>] PID field is a normal config value you can set directly. This project ran on hand-tuned values for a long time before foci-tune existed.

If foci-tune’s result does not work on your machine, write the gains yourself. Set pid_velocity_p, pid_velocity_i, pid_position_p and pid_position_i (and pid_velocity_limit if you need a different limit), then restart. FOCI_SETUP must have run first, because FOCI only runs a commissioned axis, and running it again replaces the values. FOCI_SET_GAINS is faster for experiments, but its values last only until the axis homes again. Copy what works into printer.cfg.

Only the pid_position_p “too high” row below has been confirmed on real hardware in this project. The rest is general closed-loop PID behavior, true of any such system, given as a starting point for where to look.

Field Too high Too low
pid_torque_p High-pitched whine, vibration marks on prints Overshoots on fast moves
pid_torque_i Buzzing while stationary, instability Slowly loses position under static load
pid_flux_p Audible noise, wastes current holding position Reduced top speed or torque
pid_flux_i Overshoots and oscillates, wastes current correcting it Slow to correct, wastes current on rapid moves
pid_position_p Overshoots and oscillates on stops, buzzing while holding Large position error, rounded corners, undersized prints
pid_position_i Overshoot on corners with a “hook back” correction, best left at 0 Drift accumulates over a print, offset layers
pid_velocity_p Speed oscillates at target, ringing-like print artifacts Lags behind target speed, rounded corners
pid_velocity_i Speed oscillations Slightly slower than commanded under load

Adjust one field at a time, restart Klipper, then test. Change gains roughly 10-20% per step rather than large jumps, and re-test after each change. Large jumps make it hard to tell which change actually fixed, or caused, the symptom.

These set the cutoff for each loop’s input filter, and default to disabled. A higher cutoff passes more of the raw signal through with less smoothing, so unfiltered noise can come through as buzz or squeal. A lower cutoff smooths more but adds delay to that loop’s response, which can show up as sluggishness.

Field Range Starting point
torque_filter_hz 10-10000 Hz 1000-5000 Hz
flux_filter_hz 10-10000 Hz 1000-5000 Hz
velocity_filter_hz 10-1000 Hz 100-500 Hz
position_filter_hz 10-1000 Hz 100-500 Hz

torque_filter_hz and flux_filter_hz are the two to try first.

velocity_feedforward (on/off, default off) and velocity_feedforward_gain (0.0 to 8.0, default 1.0, only used once velocity_feedforward is on) correct a structural lag in the position loop. With it off, the axis trails the commanded position during steady motion. Too low a gain, including off, leaves that lag in place. Too high a gain overshoots ahead of the target instead, most noticeable at acceleration and direction changes.