How enable pwm '/sys/class/pwm' on BeagleBone Black?

This is custom kernel 5.13

when we call “ls /sys/class/pwm”, there is nothing in this folder

In defconfig, we already enabled:

CONFIG_EMBEDDED=y
CONFIG_EXPERT=y
CONFIG_PWM=y
CONFIG_SYSFS=y
CONFIG_PWM_SYSFS=y
CONFIG_PWM_OMAP_DMTIMER=y
CONFIG_PWM_PCA9685=y
CONFIG_PWM_TIECAP=y
CONFIG_PWM_TIEHRPWM=y

One problem here is, when we “make savedefconfig”, the generated .config file has no

CONFIG_SYSFS
CONFIG_PWM_SYSFS

Is this reason why I don’t have PWM? if so how I added this? The depend flags are still on output config
CONFIG_EMBEDDED=y
CONFIG_EXPERT=y
CONFIG_PWM=y

So I am not sure why CONFIG_SYSFS and CONFIG_PWM_SYSFS are gone.

I use config-pin to set P9_14 to pwm already.

many thank

Did you export the pin (0 or 1) under /sys/class/pwm/*

Regards,

Hi Robert,
The problem was “/sys/class/pwm” folder is empty,

I just got pwm working.

In device tree I enable eqep, epwmss, ehrpwm status=“okay”. I didn’t know they are disable as default.

Many thanks,

Hello, can elaborate the exact steps you enabled epwmss and ehrpwm?

I followed the Overlays: BeagleBone AI-64 [PWM]. I did make menuconfig, pwm has been configured on
CONFIG_EXPERT=y
CONFIG_PWM=y
CONFIG_SYSFS=y

All I didi was I set dtb_overlay=BONE-PWM2.dtbo in uEnv.txt

Even I am pretty sure bb-symlinks was active, I enabled it anyway by:
sudo systemctl enable bb-symlinks.service

The problem is still same as in many posts in this forum: /sys/class/pwm is empty
By reading all these posts, I am still not clear what I did wrong in uEnv.txt or other steps

The follows are some of output
debian@BeagleBone:~$ config-pin p8.13 pwm
P8_13 pinmux file not found!
Pin has no cape: P8_13

Here is the output
debian@BeagleBone:~$ sudo beagle-version
eeprom:[A335BNLTEIA02016BBBK07DA]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Bookworm IoT Image 2023-10-07]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot SPL 2016.01-00001-g4eb802e (Jan 13 2016 - 11:14:31)]:[location: dd MBR]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2016.01-00001-g4eb802e]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2015.10-00001-g143c9ee (Nov 06 2015 - 15:27:19)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2015.10-00001-g143c9ee]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack.dts]
kernel:[5.10.168-ti-r77]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=PRU-GPIO-EXAMPLE-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[dtb_overlay=BONE-PWM2.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
WARNING:pkg:[bb-cape-overlays]:[NOT_INSTALLED]
pkg:[bb-customizations]:[1.20240119.0-0~bookworm+20240119]
pkg:[bb-usb-gadgets]:[1.20240704.0-0~bookworm+20240704]
pkg:[bb-wl18xx-firmware]:[1.20230703.0-0~bookworm+20240703]
pkg:[kmod]:[30+20221128-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20230210-5]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input render netdev i2c bluetooth gpio admin tisdk weston-launch cloud9ide]
cmdline:[console=ttyo0 console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet echo /sd2/boot/uEnv.txt*]
dmesg | grep remote
[ 5.377161] remoteproc remoteproc0: wkup_m3 is available
[ 21.192437] systemd[1]: Reached target remote-fs.target - Remote File Systems.
[ 48.986297] remoteproc remoteproc0: powering up wkup_m3
[ 48.986340] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[ 48.986652] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 60.886292] remoteproc remoteproc1: 4a334000.pru is available
[ 60.903679] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[ 60.886292] remoteproc remoteproc1: 4a334000.pru is available
[ 60.903679] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pinctrl-single
[ 5.065961] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
dmesg | grep wlcore
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

I am having the same problem that /sys/class/pwm is empty and looks like overlay dtbo for PWM was not loaded.

My setup:
BeagleBone Black, Linux BeagleBone 5.10.168-ti-r77 #1bookworm SMP PREEMPT Wed Feb 28 21:12:02 UTC 2024 armv7l GNU/Linux.
BONE-PWM2.dtbo was downloaded and compiled basing on
BeagleBoard-DeviceTrees/src/arm64/overlays at v5.10.x-ti-arm64 · beagleboard/BeagleBoard-DeviceTrees · GitHub
GitHub - beagleboard/bb.org-overlays: Device Tree Overlays for bb.org boards

I followed the Overlays: BeagleBone AI-64 [PWM].
I did make menuconfig, pwm has been configured on
CONFIG_EXPERT=y
CONFIG_PWM=y
CONFIG_SYSFS=y
Even I am pretty sure bb-symlinks
sudo systemctl enable bb-symlinks.service

All I did was I set dtb_overlay=BONE-PWM2.dtbo in uEnv.txt.
However, by the output from beagle-version, BONE-PWM2.dtbo was not loaded by u-boot.

By reading all these posts, I am still not clear what I did wrong in uEnv.txt or other steps.

Now the problem is still same as in many posts in this forum:
/sys/class/pwm is empty.

config-ping failed	
	debian@BeagleBone:~$ config-pin p8.13 pwm
		P8_13 pinmux file not found!
		Pin has no cape: P8_13

Here is the output from beagle-version
debian@BeagleBone:~$ sudo beagle-version
eeprom:[A335BNLTEIA02016BBBK07DA]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Bookworm IoT Image 2023-10-07]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot SPL 2016.01-00001-g4eb802e (Jan 13 2016 - 11:14:31)]:[location: dd MBR]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2016.01-00001-g4eb802e]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2015.10-00001-g143c9ee (Nov 06 2015 - 15:27:19)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2015.10-00001-g143c9ee]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack.dts]
kernel:[5.10.168-ti-r77]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=PRU-GPIO-EXAMPLE-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[dtb_overlay=BONE-PWM2.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
WARNING:pkg:[bb-cape-overlays]:[NOT_INSTALLED]
pkg:[bb-customizations]:[1.20240119.0-0~bookworm+20240119]
pkg:[bb-usb-gadgets]:[1.20240704.0-0~bookworm+20240704]
pkg:[bb-wl18xx-firmware]:[1.20230703.0-0~bookworm+20240703]
pkg:[kmod]:[30+20221128-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20230210-5]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input render netdev i2c bluetooth gpio admin tisdk weston-launch cloud9ide]
cmdline:[console=ttyo0 console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet echo /sd2/boot/uEnv.txt*]
dmesg | grep remote
[ 5.377161] remoteproc remoteproc0: wkup_m3 is available
[ 21.192437] systemd[1]: Reached target remote-fs.target - Remote File Systems.
[ 48.986297] remoteproc remoteproc0: powering up wkup_m3
[ 48.986340] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[ 48.986652] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 60.886292] remoteproc remoteproc1: 4a334000.pru is available
[ 60.903679] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[ 60.886292] remoteproc remoteproc1: 4a334000.pru is available
[ 60.903679] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pinctrl-single
[ 5.065961] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
dmesg | grep wlcore
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

Oh that is going to cause endless problems… 2015/2016 versions of u-boot on the eMMC and microSD…

This will upgrade both:

sudo /opt/u-boot/bb-u-boot-am335x-evm/install.sh

I tried it immediately, but the new u-boot seemed having troubles with older images like 3.8.13-bone. I will update my progress later. Thanks and appreciate your prompt reply. Regards.