ehrpwm 48300200.pwm: Failed to get tbclk

Hi,

I am having trouble with BBB and using PWM. I am using Arch Linux and the following kernel “4.7.0-1-ARCH #1 Wed Jul 27 19:22:21 MDT 2016 armv7l GNU/Linux”.

When I try to enable PWM (echo “am33xx_pwm” > /sys/devices/platform/bone_capemgr/slots) I get the following error in kernel log:

[ 72.786264] ehrpwm 48300200.pwm: Failed to get tbclk
[ 72.791291] ehrpwm: probe of 48300200.pwm failed with error -2

Any idea what is wrong?

Also, configuration of the PWM is very confusing. Can someone please explain how to configure PWM? For example I would like to use P9_16 as a PWM pin. What are the steps necessary to configure and use this pin as PWM?
I assume I have to also use this overlay [1] but it seems to binds it to a “pwm_test” driver which does not exist in my kernel tree. However, even without this driver it seems like just inserting the “am33xx_pwm” overlay gives me option to “export”
the pwm0 device: “echo 0 > /sys/class/pwm/pwmchip0/export”. This gives me a folder “/sys/class/pwm/pwmchip0/pwm0/” that has nodes for duty_cycle, period, polarity, and enable…

[1] “https://github.com/beagleboard/devicetree-source/blob/master/arch/arm/boot/dts/bone_pwm_P9_16-00A0.dts

Thanks!

most people here use debian. things just seem to work. ( thanks to
Robert nelson.)
try a debian image.

https://briancode.wordpress.com/2015/01/06/working-with-pwm-on-a-beaglebone-black/

The sysfs pathing is a little different than explained on that blog( changes in kernel 4.x ), but thats how PWM is supposed to work on the BBB.

As for your error. It sounds as though the driver module is misconfigured somehow in ARCH. I would suggest using Debian, getting to know the system well, and then comparing with ARCH. Making sure whoever is responsible for that ARCH image actually did things right.

https://briancode.wordpress.com/2015/01/06/working-with-pwm-on-a-beaglebone-black/

The sysfs pathing is a little different than explained on that blog( changes in kernel 4.x ), but thats how PWM is supposed to work on the BBB.

As for your error. It sounds as though the driver module is misconfigured somehow in ARCH. I would suggest using Debian, getting to know the system well, and then comparing with ARCH. Making sure whoever is responsible for that ARCH image actually did things right.

I figured out the issue. The driver was recently renamed from .ehrpwm to <address.pwm but the corresponding DT clock entry in the kernel was not changed. The patch to fix this is not coming in until 4.8. However, picking up the patch [1] and rebuilding the kernel fixed the issue for me.

[1] https://lkml.org/lkml/2016/3/7/648

Thanks