PWM subdirectories dissapeared after Debian update

Hello all.
I have been working on a C++ library to work with the Beaglebone Black and interface with LEDs, sensors, and motors: https://github.com/wgaonar/BeagleCPP. This was working fine with the Debian Buster 10 image from https://beagleboard.org/latest-images.

But after updating Debian, the subdirectories in the route: /sys/class/pwm/ have disappeared.

Here are some console outputs, before updating Debian:
Screen Shot 2022-02-19 at 9.03.18

Here is the output from version.sh:
Screen Shot 2022-02-19 at 9.04.37

And here, after updating Debian:
Screen Shot 2022-02-19 at 16.13.33

Here is the output from version.sh after the update:
Screen Shot 2022-02-19 at 16.14.33

Any help will become.

1 Like

Hello,

Let me make sure I understand this correctly.

It worked, you updated, and now /sys/class/pwm and /dev/pwm no longer work? Okay, how did you update again?

I think if you just used the apt update/upgrade, this could have worked or maybe not. I noticed there has been a lot of development on new images from beagleboard.org.

I can figure out exactly what you did and retry it. Then, I can say “yes” it is true. Or, “no” this is not happening on my system.

Just for the record, nice lib. Also, I say use one of the newer images available on this forum located here: Debian 10.x/11.x Kernel Updates .

Seth

P.S. I rarely use the older image from the bbb.io/latest-images site online for the am335x, i.e. BBB and so on.

If you would like me to understand more, this is okay. I can make more attempts at trying to make sense of it but the older image is just that currently…an older image.

And…yes sir. I have had this disappearance of my /sys/class/pwm dir/files being noticed before this reply. I think maybe, but let me check first, the newer image may just be a good image for PWM functionality. I will return service in a bit.

Okay…so it seems /dev/pwm is not available on my image you were discussing:

debian@beaglebone:~$ uname -a Linux beaglebone 4.19.94-ti-r68 #1buster SMP PREEMPT Thu Sep 16 15:32:31 UTC 2021 armv7l GNU/Linux debian@beaglebone:~$ ls -l /sys/class/pwm/pwmchip* lrwxrwxrwx 1 root root 0 Feb 19 19:12 /sys/class/pwm/pwmchip0 -> ../../devices/platform/ocp/48300000.epwmss/48300100.ecap/pwm/pwmchip0 lrwxrwxrwx 1 root root 0 Feb 19 19:12 /sys/class/pwm/pwmchip1 -> ../../devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip1 lrwxrwxrwx 1 root root 0 Feb 19 19:12 /sys/class/pwm/pwmchip3 -> ../../devices/platform/ocp/48302000.epwmss/48302100.ecap/pwm/pwmchip3 lrwxrwxrwx 1 root root 0 Feb 19 19:12 /sys/class/pwm/pwmchip4 -> ../../devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip4 lrwxrwxrwx 1 root root 0 Feb 19 19:12 /sys/class/pwm/pwmchip6 -> ../../devices/platform/ocp/48304000.epwmss/48304100.ecap/pwm/pwmchip6 lrwxrwxrwx 1 root root 0 Feb 19 19:12 /sys/class/pwm/pwmchip7 -> ../../devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip7

and…

BeagleBoard.org Debian Buster IoT Image 2020-04-06

Although this is a bit of a stinker for traditional images, the 2020-04-06 image, I will be about an hour or less w/ the newer image and how PWM is installed on the machine in question, i.e. BBB!

and…here is the updated image from one of the picks from that link I showed you:

Linux beaglebone 4.19.94-ti-r71 #1buster SMP PREEMPT Sun Feb 6 00:19:46 UTC 2022 armv7l GNU/Linux

and…

BeagleBoard.org Debian Buster IoT Image 2022-02-03

Here is what I currently have in /dev/pwm and /sys/class/pwm.

debian@beaglebone:/sys/class/pwm$ ls
pwmchip0 pwmchip1 pwmchip3 pwmchip4 pwmchip6 pwmchip7
debian@beaglebone:/sys/class/pwm$

There is no pwm dir/file in /dev/!

Now, if I go into one of the pwmchip* directories, I see this, for instance at 0, currently.

ls
device export npwm power subsystem uevent unexport

And then…if I wanted to provide a chip on selection: echo 1 > export? I tried it and this is ls on /sys/class/pwm/pwmchip1/ after the export of 1:

debian@beaglebone:/sys/class/pwm/pwmchip1$ echo 1 > export
debian@beaglebone:/sys/class/pwm/pwmchip1$ ls
device export npwm power pwm-1:1 subsystem uevent unexport

One more thing:

Once you or anyone wants to get their /dev/pwm/<NAME OF THE PWM>/ for use, just try the /sys/class/pwm/pwmchip* echo 1 > export commands. Then, /dev/pwm/* will show. `

So many many thanks for your broad and complete answer. You give me new ideas to try.

The way that I had updated my BBB was running: sudo apt-get update and sudo apt-get upgrade. And the PWM subdirectories disappeared.

I installed a more recent version of Debian buster from here: https://forum.beagleboard.org/t/debian-10-x-buster-monthly-snapshots/31203 and update the kernel to the same kernel that you: 4.19.94-ti-r71, but I experienced the same problem.

Now I am going to have to restore my BBB with the old version of Debian from https://beagleboard.org/latest-images while I can find the solution.

1 Like

Hello @wgaonar ,

Seth here again. Oh. Was the exporting of /sys/class/pwm/pwmchip(n)/ not worth the hassle? It then shows up in /dev/pwm/(n) as the correct PWM peripheral to use.

Anyway, I cannot wait to use your lib. I will let you know if I come across any issues.

Seth

Thanks. I will be on the lookout. Any feedback about the lib is welcome.

The udev rule for this got disabled, as it broke any lcd screen with a pwm backlight…

/etc/udev/rules.d/81-pwm-noroot.rules

Un comment these two lines…

Regards,

2 Likes

If you want to be notified when this issue is fixed, subscribe to this github issue: pwm export broken in bb-customizations 20210225 · Issue #82 · beagleboard/Latest-Images · GitHub

1 Like