BeagleBone PWM

I’m looking into running some servos/ESC’s from a new BeagleBone Black Rev C. I’ve been all over the internet and have not found any updated info about the BBB running Debian.

Here is what I’ve got so far:

  1. /boot/uboot/uEnv.txt

  2. Add optargs=capemgr.enable_partno=am33xx_pwm

  3. shutdown -r time now

  4. more /sys/devices/bone_capemgr.9/slots

root@beaglebone:/# more /sys/devices/bone_capemgr.9/slots

0: 54:PF—

1: 55:PF—

2: 56:PF—

3: 57:PF—

4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G

5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI

7: ff:P-O-L Override Board Name,00A0,Override Manuf,am33xx_pwm

  1. PWM is now configured on bootup.

I can now view the PWM hardware devices using this command:

root@beaglebone:/# more /sys/kernel/debug/pwm
platform/48304100.ecap, 1 PWM device

pwm-0 ((null) ):

platform/48304200.ehrpwm, 2 PWM devices
pwm-0 ((null) ):

pwm-1 ((null) ):

platform/48302200.ehrpwm, 2 PWM devices
pwm-0 ((null) ):

pwm-1 ((null) ):

platform/48300100.ecap, 1 PWM device
pwm-0 ((null) ):

platform/48300200.ehrpwm, 2 PWM devices
pwm-0 (sysfs ): requested enabled sysfs_exported

pwm-1 (sysfs ): requested enabled sysfs_exported

I’ve enabled 2 PWM outputs using these commands:

echo 0 > /sys/class/pwm/export
echo 1 > /sys/class/pwm/export

I can now view the PWM settings:

root@beaglebone:/sys/class/pwm/pwm0# dir
device duty_ns period_ns polarity power run subsystem uevent
root@beaglebone:/sys/class/pwm/pwm0# echo 20000000 > period_ns // set period to 20ms
root@beaglebone:/sys/class/pwm/pwm0# echo 1000000 > duty_ns // set duty cycle to 1ms
root@beaglebone:/sys/class/pwm/pwm0# echo 1 > run // run the pwm

When I check the pins with my O-scope I get nothing. I think I am really close but I can’t figure out why they aren’t outputting.

I’ve been reading a bunch of stuff about pin muxing, device tree overlays, clock enabling… but I’m not sure what is up to date for BBB running Debian 3.8.13 kernel

Anybody have any ideas?



Reviewing the device overlay you loaded, there is no pin multiplexing
going on, so you are turning on the hardware PWM, but it's not actually
reaching the I/O pins.

I'd recommend either using an overly that includes pin multiplexing like
the bone_pwm_P[89]_?? dts files, or something like my universal cape
overlay that turns on most useful hardware (PWM, UARTS, etc), and allows
you to control pin multiplexing at runtime with the config-pin utility
(already installed on your 'bone if you're using a recent Debian image
from RCN).