BeagleBone PWM diagnostic tool


while playing with PWM on BeagleBone I created Python script for tests. It can handle 6 PWM channels on 8 pins (no eCap). Hope it’ll be useful.

You can download it from

usage: bbpwm [-h] [-f FREQUENCY] [-d DUTY] [–version] [–stop] [-v]

BeagleBone PWM diagnostic utility.

positional arguments:
{1,2,3,4,5,6,60,50} PWM channel

optional arguments:
-h, --help show this help message and exit
Frequency [Hz]
-d DUTY, --duty DUTY Duty cycle [%]
–version show program’s version number and exit
–stop Stop PWM. To start again PWM specify frequency or/and
duty cycle.
-v, --verbose Display more messages.
–no-timer-set Do not set timer mode for PWM. Use only if kernel
already set the timer.

bbpwm -d 50 -f 10000 1
Sets 10 kHz and 50% duty cycle for channel 1.

bbpwm -v -d 80 4
Sets only duty cycle for channel 4 and display more messages.

bbpwm --stop 2
Stop PWM on channel 2.

Supported BeagleBone PWM pins:
1 P9.14 gpmc_a2 EHRPWM1A /sys/class/pwm/ehrpwm.1:0
2 P9.16 gpmc_a3 EHRPWM1B /sys/class/pwm/ehrpwm.1:1
3 P8.19 gpmc_ad8 EHRPWM2A /sys/class/pwm/ehrpwm.2:0
4 P8.13 gpmc_ad9 EHRPWM2B /sys/class/pwm/ehrpwm.2:1
5 P9.31 mcasp0_fsx EHRPWM0A /sys/class/pwm/ehrpwm.0:0
6 P9.29 mcasp0_aclkx EHRPWM0B /sys/class/pwm/ehrpwm.0:1
50 P9.22 spi0_sclk EHRPWM0A /sys/class/pwm/ehrpwm.0:0
60 P9.21 spi0_d0 EHRPWM0B /sys/class/pwm/ehrpwm.0:1
PWM amplitude is 3.3V.
eCAP 2 additional PWM channels not supported.
PIN is MODE 0 name, NOT BeagleBone System Reference Manual signal name.

I’m trying to use the ehrpwm.2: 0 and ehrpwm.2.1 that are assigned to P8.19 and P8.13 respectively Pines, I have sent to Mode 4 without problems.

The problem is that when I go to /sys/class/pwm only there are ehrpwm.0:0 ehrpwm.0:1 ehrpwm.1:0 ehrpwm.1:1 NOT EXIST ehrpwm.2:X , then there is no such set the parameters of the pwm like duy_percent, run, stop, etc.

Can you help me please???

What I have to do???