Enabling PWM on boot

Hi,

I am trying to get the PWM enabled on boot up. I have added the BB-PWM1 and BB-PWM2 dtbo’s in the uEnv.txt as shown below.

debian@beaglebone:/opt/scripts/tools$ sudo ./version.sh
git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7]
eeprom:[A335BNLTBWA51712EW002601]
model:[TI_AM335x_BeagleBone_Black_Wireless]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.71-ti-r80]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr2=/lib/firmware/BB-UART3-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr3=/lib/firmware/BB-UART4-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-UART5-00A0.dtbo ]
uboot_overlay_options:[uboot_overlay_addr5=/lib/firmware/BB-I2C2-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr6=/lib/firmware/BB-BONE-AUDI-02-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr7=/lib/firmware/BB-ADC-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[dtb_overlay=/lib/firmware/BB-PWM1-00A0.dtbo]
uboot_overlay_options:[dtb_overlay=/lib/firmware/BB-PWM2-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.4.20180928.0-0rcnee0~stretch+20180928]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.126856] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.138722] gpio-of-helper ocp:cape-universal: ready
END

Now I try to generate PWM pulses on P9_14 which is EHRPWM1A. On checking the PWM directory, I see the following:

debian@beaglebone:/sys/class/pwm$ ls -l
total 0
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 pwmchip0 → …/…/devices/platform/ocp/48300000.epwmss/48300100.ecap/pwm/pwmchip0
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 pwmchip1 → …/…/devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip1
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 pwmchip3 → …/…/devices/platform/ocp/48302000.epwmss/48302100.ecap/pwm/pwmchip3
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 pwmchip4 → …/…/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip4
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 pwmchip6 → …/…/devices/platform/ocp/48304000.epwmss/48304100.ecap/pwm/pwmchip6
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 pwmchip7 → …/…/devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip7

From the above, the P9_14 seems to be mapped to pwmchip4 i.e. pwmchip4 → …/…/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip4. Now I do the below to export the pin.

debian@beaglebone:/sys/class/pwm/pwmchip4$ echo 0 > export
debian@beaglebone:/sys/class/pwm/pwmchip4$ ls -l
total 0
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 device → …/…/…/48302200.pwm
-rw-rw---- 1 root pwm 4096 Nov 10 21:50 export
-rw-rw-r-- 1 root pwm 4096 Nov 10 21:37 npwm
drwxrwxr-x 2 root pwm 0 Nov 10 21:37 power
drwxrwxr-x 3 root pwm 0 Nov 10 21:50 pwm-4:0
lrwxrwxrwx 1 root pwm 0 Nov 10 21:38 subsystem → …/…/…/…/…/…/…/class/pwm
-rw-rw-r-- 1 root pwm 4096 Nov 10 21:37 uevent
-rw-rw---- 1 root pwm 4096 Nov 10 21:37 unexport

Now, I tried to generate the PWM as follows.

debian@beaglebone:/sys/class/pwm/pwmchip4$ cd pwm-4:0/
debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ ls
capture device duty_cycle enable period polarity power subsystem uevent
debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ echo 1000000000 > period
debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ echo 800000000 > duty_cycle
debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ echo 1 > enable

But I don’t see any output on the scope. Then I configured the P9_14 to PWM mode following this thread.

debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ sudo config-pin -q P9.14
P9_14 Mode: default Direction: in Value: 0
debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ sudo config-pin P9.14 pwm
debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ sudo config-pin -q P9.14
P9_14 Mode: pwm

After manually configuring the P9_14 to PWM mode, I see the PWM output on the pin.

Question: I have added the PWM dtbo’s and expect the pins to be configured to PWM mode during boot. Why is this not working and requiring a manual configuration?

Kernel version: debian@beaglebone:/sys/class/pwm/pwmchip4/pwm-4:0$ uname -a
Linux beaglebone 4.14.71-ti-r80 #1 SMP PREEMPT Fri Oct 5 23:50:11 UTC 2018 armv7l GNU/Linux

Any help appreciated. Thanks.