Both Software PWM and Hardware PWM are implemented on the MCU. In both cases, the host just configures the actions the MCU should perform.
The difference is, hardware PWM uses a âhardware blockâ on the MCU dedicated to performing PWM, while software PWM is implemented by toggling the output pin using Klipperâs regular software timer mechanism.
The main advantage to Software PWM:
Any pin can be used.
The cycle and duty times are very precise.
The disadvantages of Software PWM:
The toggling of the output is done in the MCU software, which can result in some scheduling jitter. Iâd guess this jitter would max out at ~20us for AVR and ~5us for ARM.
Again, since the toggling is done in the mcu software, very high toggling rates can increase the mcu cpu load.
The main advantages of hardware PWM:
It can toggle at very high rates without jitter and without addition mcu cpu load.
The disadvantage of hardware PWM is:
Not all pins can be used for hardware PWM (the pins that can be used depend on the type of each micro-controller).
The actual cycle and duty times that are implemented may only be a coarse representation of the requested values. Available cycle times vary between micro-controller types, and there are also limitations should multiple pins on the same MCU be used for hardware PWM.
In summary, on Klipper, use hardware PWM if you need to approximate a DAC (that is, approximating a voltage varying output, typically via an RC circuit). In this case, hardware PWM can obtain the necessary high-speed update rates. In other cases, software PWM is preferable.
Hardware pwm for host (raspberry) is behaving âfunnyâ.
(Preamble: I have a fan â[controller_fan octopus_fan]â configured with âshutdown_speed: 1.0â)
Result is always the same âMCU âmcuâ shutdown: Unable to config pwm deviceâ which goes away after a firmware_restart.
BUT
If I boot the raspberry from âoffâ state I simply get the error but the fan STAYS OFF
If I reboot the raspberry, on top of the error the fan GOES ON (expected behaviour)
Below I paste the log after:
Raspberry off â on â firmware_restart â raspberry reboot â firmware_restart
Ps @koconnor , man, I do miss a simple âbugâ report on github, I didnât know I could drop a file here to upload it as an attachment. I tried to paste it and⌠windows green screen