When using both PWM channels, the number of the second channel needs to be echo'd as well:
# Enable pwmchip sysfs interface
echo 0 > /sys/class/pwm/pwmchip0/export
echo 1 > /sys/class/pwm/pwmchip0/export
Code in Ablage kopierenWith the sysfs in place, you can now use either the pwm channel(s) by adding the following piece of configuration to your printer.cfg
:
[output_pin caselight]
pin: host:pwmchip0/pwm0
pwm: True
hardware_pwm: True
cycle_time: 0.000001
[output_pin beeper]
pin: host:pwmchip0/pwm1
pwm: True
hardware_pwm: True
value: 0
shutdown_value: 0
cycle_time: 0.0005
Code in Ablage kopierenThis will add hardware pwm control to gpio12 and gpio13 on the Pi (because the overlay was configured to route pwm0 to pin=12 and pwm1 to pin=13).
PWM0 can be routed to gpio12 and gpio18, PWM1 can be routed to gpio13 and gpio19:
PWM | gpio PIN | Func |
---|---|---|
0 | 12 | 4 |
0 | 18 | 2 |
1 | 13 | 4 |
1 | 19 | 2 |