PWM documentation and/logic for kernel 4.9.XX


I am using C blacklib to handle some i2c and spi devices. Also I have few PWM’s P9_14 and 16 let’s say.

I learned the hard way that P9_14 and P9_16 are to be found in ‘48302200’. For P9_14 for example


which is a link from


became available as pwm0 after echoing 0 to /sys/class/pwm/pwmchip3/export


root@beaglebone:/sys/class/pwm/pwmchip3/pwm0# pwd /sys/class/pwm/pwmchip3/pwm0 root@beaglebone:/sys/class/pwm/pwmchip3/pwm0# ls -l total 0 -rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 capture -rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 duty_cycle -rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 enable -rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 period -rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 polarity drwxrwxr-x 2 root pwm 0 Feb 22 03:14 power -rw-rw-r-- 1 root pwm 4096 Feb 22 03:14 uevent root@beaglebone:/sys/class/pwm/pwmchip3/pwm0#

The blacklib still doing old slot way of finding out which /sys/… files are matching for P9_14 pwm, going
from symbolic links to some hardcoded PXY->1,2,3 mapping finally to find out the /sys/class/…/pwm/period… and such…

My question is:

How do I determine which X,Y from /sys/class/pwm/pwmchipX/pwmY maps to (X,Y) of a pwm pin PX_Y

Thank you

Hi there,

I’ve just gone through this myself, and you’ve already figured out all you need to know. The pwmchipX mapping can change on boot so you can’t rely on the /sys/class/pwm structure. Figure out which address maps the epwmss device you want to use and navigate down the /sys/device tree as you have already posted. i.e. /sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchipX

See Roberts response to my question here!category-topic/beagleboard/software/uAHEiJTkE5E

FWIW I found the Technical Reference Manual for the AM335x which has all the addresses for the peripherals here - it doesn’t seem to be on the TI site anymore, at least not that I could find.

James Fitzsimons