Basic Information:
Printer Model: Voron Switchwire
MCU / Printerboard: BTT SKR 1.4 Turbo
Host / SBC Raspberry Pi 4
klippy.log
klippy (2).zip (89.9 KB)
Klipper Host MCU: hardware_pwm: true Fails on Raspberry Pi GPIO
What Im attempting to do. Use hardware_pwm to make a passive buzzer play silly music when the print is done, an error has been cause, or filament runs out. In this case… RD2D sounds.
My other printer Im doing Zelda songs and sound effects. Cause Im a nerd.
I’ve never reported a Klipper error before, so please forgive me if I’m missing any important details. I’ve done my best to include everything requested and to provide as much detail as possible. I’m still a Klipper newbie, and I’ve never really dug this deep into any programming or software language before, so this has been half a learning experience and half a deep dive down a rabbit hole of problem-solving. Hopefully, I’ve got everything you need here, and if not, I’ll do my best to answer any questions that come up!
PROBLEM SUMMARY:
Klipper running on a Raspberry Pi fails to initialize any GPIO pin configured with hardware_pwm: true, even when the /sys/class/pwm/pwmchip0/ interface is correctly exposed by the OS and other userspace tools confirm PWM is available. This affects multiple RPi models and fresh installs of MainsailOS or Klipper on Raspberry Pi OS.
What I’ve Tested
I tested this across multiple printers, using:
-
Raspberry Pi 4 (with and without touchscreen)
-
MainsailOS
-
Latest versions of:
-
Klipper (as of July 28, 2025) (although the klipper.log file is on an older version
-
Moonraker\
-
Mainsail OS
-
Minimal working config:
[mcu rpi]
serial: /tmp/klipper_host_mcu
[output_pin r2_buzzer]
pin: rpi:gpio18
pwm: true
hardware_pwm: false #THIS WORKS
scale: 1000
When I enable hardware PWM:
[output_pin r2_buzzer]
pin: rpi:gpio18
pwm: true
hardware_pwm: true
scale: 1000
Klipper throws this error:
MCU 'rpi' shutdown: Unable to config pwm device
Confirmed Working Outside Klipper
With this /boot/config.txt:
dtoverlay=pwm-2chan
dtparam=audio=off
enable_uart=1
dtoverlay=disable-bt
Ive confirmed:
-
/sys/class/pwm/pwmchip0/pwm0exists -
raspi-gpio get 18returnsfunc=PWM0_0 -
dmesg | grep pwmshows device present -
Manually writing to
/sys/class/pwm/pwmchip0/...works fine (tone heard on passive buzzer)
GPIOs Tested
I tried the following pins with identical results:
-
GPIO18 (PWM0)
-
GPIO19 (PWM1)
-
GPIO13 (PWM1 alternative)
All fail inside Klipper when hardware_pwm: true is set.
Additional Notes
-
No other
output_pinorhardware_pwm: trueconfig exists in the Klipper setup. -
Touchscreen and HDMI do not conflict — I tested with
vc4-kms-v3dboth on and off. -
lsmodconfirms novc4module conflict. -
/sys/class/pwm/pwmchip0/is always present at boot, even before Klipper launches. -
Permissions and group ownership on
/sys/class/pwmare standard and consistent.
Request
Can someone from the Klipper team or smarter than myself help determine:
-
Why Klipper Host MCU cannot initialize PWM hardware devices even when everything else confirms they are available?
-
Is this an ordering issue, privilege issue, or sysfs path expectation mismatch?
I’m happy to provide full logs, system info, or retest specific changes.
Thanks for the awesome project and for your time.
…