PWM in beagle bone black


I am recently working on Beagle bone black, i need to use PWM module in the beagle bone black.

i followed the bellow steps for configuration :

  1. cd /sys/class/pwm
  2. ls → here i found pwmchip0, pwmchip1, pwmchip2, pwmchip3…pwmchip7.
  3. cd pwmchip0
  4. ls → here i found : device export npwm power subsystem uevent unexport.
  5. echo 0 > export i added pwm0
  6. ls → i can see pwm is added.
  7. cd ./pwm0 → here i can see the duty cycle , period and other information.

i want to add the pinmux for pwm

debian@beaglebone:/sys/class/pwm$ config-pin -l P9.22
default gpio gpio_pu gpio_pd gpio_input spi_sclk uart i2c pwm pru_uart
debian@beaglebone:/sys/class/pwm$ config-pin P9.22 pwm
P9_22 pinmux file not found!
sudo: no askpass program specified, try setting SUDO_ASKPASS
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_22_pinmux/state

but it is showing error for adding P9.22 pin as pwm.

please help me to resolve it

In other hand if i try to add some more pwm means it is showing the error like this

debian@beaglebone:/sys/class/pwm$ cd pwmchip0
debian@beaglebone:/sys/class/pwm/pwmchip0$ ls
device export npwm power pwm-0:0 subsystem uevent unexport
debian@beaglebone:/sys/class/pwm/pwmchip0$ echo 3 > export
-bash: echo: write error: No such device

i am not able to add other pwm module… why it is showing the error.

please resolve it…

Insiders tip welcome?

Check out libpruio for easy and powerful PWM (and pinmuxing) features.



can anybody suggest me c programing example on the pwm in beagle-bone black.


using pwm i am doing some configuartions in the beaglebone black…

in /sys/class/pwm/pwmchip1


using pwm i am doing some configurations in the beagle bone black…

in /sys/class/pwm/pwmchip1

echo 0 > export
echo 1 > export

i can see the 2 pwm are added pwm1:0 , pwm1: 1

using cd pwm1:0 i am assigning the duty cycle , period and enable

if i rebooted the BBB means this configurations are erasing, why i am not getting??

using config-pin -l P9.14

config-pin P9.14 pwm

i am setting pin for pwm as p9.14

in hardware wise i am connecting 1 external led providing 1 connection from P9.14 and other end to ground.

but led should glow based on pwm duty-cycle, but here the LED not all glowing ???

please suggest me where i am missing??

Hi ,

i am using kernel version of slots file and bone -capemgr are disabled in V4.14 of kernel in the favor of U-boot overlay.

my uEnv.txt file look like this.

debian@beaglebone:/boot$ cat uEnv.txt


###U-Boot Overlays###
###Master Enable

Isn't this just a permission error? Does it work with sudo?


I got why that error is coming . already i used those pins to UART , so i can’t use that pins again to PWM.

i am using P9.14 for pwm, but still also it is not working for me…

i am feeling something i need to add in to uEnv.txt, but i am not getting …

please suggest me??

Hi Megha,

I recomend you to use adafruit python library to check your uEnv.tx configuration and pin choice. It is a very easy to use lib and helped me a lot to test GPIO stuff.

Here is a link to a simple tutorial:

Hi Luis!