On Mon, Dec 09, 2013 at 01:22:02AM +0800, randy wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > The dts for my board tiny4412 is ready, in my board, the pwm 0 is > connect to a buzzer. I want to test whether it works, but I don't know > any test util. As I have a oscillograph, there is no problem for me to > measure whether the output is correct. > Thanks
You can use the sysfs interface to easily test the PWM functionality.
The documentation for that is in Documentation/pwm.txt and
Documentation/ABI/testing/sysfs-class-pwm.
Generally this should work somewhat like this:
# echo 0 > /sys/class/pwm/pwmchip0/export
# echo 50000 > /sys/class/pwm/pwmchip0/pwm0/period
# echo 25000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
Which should configure PWM 0 to run at a period of 50000 ns and a 50%
duty-cycle.
# echo 0 > /sys/class/pwm/pwmchip0/pwm0/disable
Stops the PWM signal and when you're done with all the testing you can
export the PWM (so that it can be reused):
# echo 0 > /sys/class/pwm/pwmchip0/unexport
Thierry
pgpl3JugGDoFk.pgp
Description: PGP signature
