Is the sysfs pwm interface using hardware pwm?

2019-08-13 20:26发布

I followed this answer to enable PWM on my Beaglebone Black, but I wasn't sure if that method is using the PRU to do hardware PWM or if it's toggling the pin in software? I see other references to /sys/class/pwm/ehrpwm (e.g. here) which I'm more confident is hardware PWM, but I'm not sure how to enable that interface.

To summarize how I'm enabling PWM:

echo am33xx_pwm > /sys/devices/bone_capemgr.9/slots
echo cape-universal > /sys/devices/bone_capemgr.9/slots
config-pin P8.13 pwm
echo 6 > /sys/class/pwm/export
echo 1 > /sys/class/pwm/pwm6/run
echo 50000 > /sys/class/pwm/pwm6/period_ns
echo 50000 > /sys/class/pwm/pwm6/duty_ns

Thanks!

1条回答
戒情不戒烟
2楼-- · 2019-08-13 20:59

Yup, that's using the hardware PWM modules - the am33xx_pwm overlay enables all the different PWM subsystems (eHRPWM, eCAP), then the PWM kernel driver configures the corresponding PWM module for the pin being configured.

查看更多
登录 后发表回答