BBB Rev D 6.12.93-bone62 PWM using python

I want to use pins P8_13, P9_14, P9_16 for PWM. I keep running into old info using config-pin, which does not exist on this board. Help a newbie.

uEnv.txt includes:

uboot_overlay_addr4=BB-SPIDEV0-00A0.dtbo
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1

and

uboot_overlay_addr5=BB-EHRPWM2-P8_13-P8_19.dtbo
uboot_overlay_addr6=BB-EHRPWM1-P9_14-P9_16.dtbo

Which provides:

root@BeagleBone:~# ls -l /dev/bone/pwm/1
total 0
lrwxrwxrwx 1 root root 29 Jul 4 23:05 a → /sys/class/pwm/pwmchip0/pwm0/
lrwxrwxrwx 1 root root 29 Jul 4 23:05 b → /sys/class/pwm/pwmchip0/pwm1/

and

root@BeagleBone:~# ls -l /dev/bone/pwm/2
total 0
lrwxrwxrwx 1 root root 29 Jul 4 23:05 a → /sys/class/pwm/pwmchip1/pwm0/
lrwxrwxrwx 1 root root 29 Jul 4 23:05 b → /sys/class/pwm/pwmchip1/pwm1/

Here is where I get confused. Can I use python at this point? Or is there bash stuff to do first? And if so, will those changes persist?

Is there a resource for this info that I haven’t found yet?

at this point, yes once /sys/class/pwm/pwmchip*/pwm* nodes exist, you are free to go in those directories, and setup the pwm period/etc values and you will see output changes in the language of your choice..

Regards

Yes - I can write to those files and get outputs using python. Thank you.
Now, how do I avoid hard coding the paths, to future-proof the code? Is there a way to read a variable, instead of my code containing:

P8_13=“/sys/class/pwm/pwmchip1/pwm1/”
P8_19=“/sys/class/pwm/pwmchip1/pwm0/”
P9_14=“/sys/class/pwm/pwmchip0/pwm0/”
P9_16=“/sys/class/pwm/pwmchip0/pwm1/”

Or should I just reference the symlinks in /dev?

P8_13=“/dev/bone/pwm/2/b/”
P8_19=“/dev/bone/pwm/2/a/”
P9_14=“/dev/bone/pwm/1/a/”
P9_16=“/dev/bone/pwm/1/b/”

Would that future-proof me?

Use these… Just remember pwmchipX is defined in order of loading..

voodoo@21-am335x-bbb:~$ realpath /sys/class/pwm/pwmchip0/device
/sys/devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48302000.target-module/48302000.epwmss/48302200.pwm
voodoo@21-am335x-bbb:~$ realpath /sys/class/pwm/pwmchip1/device
/sys/devices/platform/ocp/48000000.interconnect/48000000.interconnect:segment@300000/48304000.target-module/48304000.epwmss/48304200.pwm

These would be what you want to look for to make sure it’s always the same IP/Pins..

48302200.pwm
48304200.pwm