librpip-pwm-init is a startup script to enable and configure the pwm device(s). There are two methods to start the PWM clock – first is to send some audio out of the analogue out, second is to start the clock directly. Both are implemented in the script with starting the clock directly being the default. The source for the ‘pwmclk’ binary is in the librpip distribution in src/pwmclk
This script should be called from /etc/rc.local to ensure the PWM’s are configured at each bootup.
It runs the following commands:
#!/bin/sh #start the PWM clock with our binary /usr/local/bin/librpip-util/pwmclk #start the PWM clock by sending some audio :-/ #speaker-test -Dhw:CARD=ALSA,DEV=0 -f300 -c1 -p100 -P2 -l1 > /dev/null 2>&1 #enable the PWM(s). Try both in leu of parsing config.txt. echo "0" > /sys/class/pwm/pwmchip0/export echo "1" > /sys/class/pwm/pwmchip0/export #configure the PWM(s) chgrp pwm /sys/class/pwm/pwmchip0/pwm?/* chmod 660 /sys/class/pwm/pwmchip0/pwm?/*