Hard time getting pwm running on bbw on P8-45 P8_46 on Debian13

I am trying to get from Debian10 to Debian13, and it seems the simple config-pin thing has been replaced by compiling your own dts.

One of the things I have to do is create a DTS for PWM2A and PWM2B on Pin P8_45 and P845, on Mode 3 on these pins.

This is the code I made after looking at ../../../include/dt-bindings/pinctrl/am33xx.h

I named it BB-EHRPWM2-P8_45-P8_46.dtso, and compiled it with build_n_install.sh in /opt/source/dtb-6.16.x/

I added

dtb_overlay=BB-EHRPWM2-P8_45-P8_46.dtbo to /boot/uEnv.txt

Another comparable overlays did indeed show that pwm1a and pwm2b work, but this one does not show up in show-pins or in /sys/class/pwm/. Why is that?

// SPDX-License-Identifier: GPL-2.0-only
/\*

* Copyright (C) 2025 Robert Nelson <robertcnelson@gmail.com>
  \*/

/dts-v1/;
/plugin/;

#include <dt-bindings/pinctrl/am33xx.h>

/\*

* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
  \*/
  &{/chosen} {
  overlays {
  BB-EHRPWM2-P8_45-P8_46.kernel = **TIMESTAMP**;
  };
  };

&ocp {
P8_45_pinmux { status = “disabled”; };  /\* P8_45: lcd_data0.gpio2_6 */
P8_46_pinmux { status = “disabled”; };  /* P8_46: lcd_data1.gpio2_7 \*/
};

&am33xx_pinmux {
epwmss2_pins: pinmux_epwmss2_pins {
pinctrl-single,pins = <
AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE3) /\* P8_45 (R1) lcd_data0.ehrpwm2A */
AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE3) /* P8_46 (R2) lcd_data1.ehrpwm2B \*/

> ;
> };
> };

&epwmss2 {
status = “okay”;
};

&ehrpwm2 {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&epwmss2_pins>;
};

BB-EHRPWM2-P8_45-P8_46.dtso (905 Bytes)

Found the culprit.

In /boot/uEnv.txt I used

dtb_overlay=BB-EHRPWM1-P8_34-P8_36.dtbo
dtb_overlay=BB-EHRPWM2-P8_45-P8_46.dtbo

When I used

uboot_overlay_addr4=BB-EHRPWM1-P8_34-P8_36.dtbo

uboot_overlay_addr5=BB-EHRPWM2-P8_45-P8_46.dtbo

It worked. duh…

1 Like

But still some strange things:

P8_45 is on of the PWM channels, which shows in show-pins, but when I use gpioinfo to have a look, It get this:

gpiochip1 - 32 lines:
line 0: “P9_15B” input
line 1: “P8_18” input
line 2: “P8_7” input
line 3: “P8_8” input
line 4: “P8_10” input
line 5: “P8_9” output consumer=“GPIO69”
line 6: “P8_45 [hdmi]” output consumer=“GPIO68”
line 7: “P8_46 [hdmi]” input

show-pins:

P8.10 38 fast down 7 gpio 2.04 leds (pinmux_bb_gpio_relay_pins)
P8.09 39 fast down 7 gpio 2.05 leds (pinmux_bb_gpio_relay_pins)
P8.45 / hdmi / sysboot 0 40 fast 3 pwm 2 out A pwm@48304200 (pinmux_epwmss2_pins)
P8.46 / hdmi / sysboot 1 41 fast 3 pwm 2 out B pwm@48304200 (pinmux_epwmss2_pins)
P8.43 / hdmi / sysboot 2 42 fast down 7 gpio 2.08 leds (pinmux_bb_gpio_relay_pins)
P8.44 / hdmi / sysboot 3 43 fast down 7 gpio 2.09 leds (pinmux_bb_gpio_relay_pins)

What am I to believe?

@Johan_Henselmans ,

Hey sir, did you check to see what actually happens on specific header pins yet? I know something, sort of.

I am not using Trixie/Debian 13 a lot on the am335x supported BBBW but…

  1. /dev/bone/pwm was once a thing
  2. Inputs can be changed to Outputs
    1. So, even if the I/O says Input, source code can change that fact
  3. I can hook up later and test

I will reply later or in a bit. I have not decided.

Seth

P.S. Overlays should be used I guess. Let me hook up and I will reply. This way, we are on the same page. I will post my image and kernel shortly. In the meantime, what kernel are you on? 5.10.x or 6.1.x and/or etc?

update

I am waiting now for the board to boot. I do not know how you got your BBBW to boot with kernel 6.15.x so far. I tried the bb-imager-gui application and still nothing. No booting. I will try some more later.

update TWO!

I booted. The board works! Unless you had this issue, I never would have known kernel 6.16.x works on an am335x supported BBBW! Thank you, sir. Outside of that now, back to figuring it out…

Okay.

update Three!

debian@BeagleBone:/opt/source/dtb-6.16.x/src/arm/ti/omap$

For now, I think we have to wait. the dtb–6.16-bone is not around. I did find two sets of two PWM peripherals in the /boot/dtbs/6.16.12-bone20/overlays.

Anyway, in the above /opt/ files for /ti under /omap, I found all the good files with all the data.

6.16.x, but also tried 6.12.x. I am using these kernels because my final goals is to use the pwm-pgio kernel module, that makes every pin capable of running PWM without a lot of overhead.

I am unfamiliar with it for now. I tried your DTS file and am getting errors so far.

So, something is off on my source file or the bone-busses styled .dtsi file calls something different.

I am just trying P8.45 so far. I tried to compile locally and then locally again in /opt/sources/dtb-6.16.x/ with build_and_install.sh.

It seems ; is the problem or pinctrl-single,pins = < is the issue. DTS states errors on line eight.

So far, I cannot tell what line eight corresponds to.

Seth

P.S. Steadily working towards a solution is key. I will read up on pwm-gpio too. Have you looked in /usr/lib/linux-image-6.16.12-bone20/ where /linux-image-6.16.12-bone20/ is the location for some .dtbo files? Anyway, off to slumber. I will try more soon.

Have you downloaded the file included? It might be that the code in the message is mangled.

Go tp /opt/source/dtb-6.16.x/src/arm/overlays to see the stuff that is used to create overlays.

No, I have not downloaded the file.

I will try it later. Thank you. Can you just post it here with formatting?

triple backticks like this?

and right about the overlay section on the fs, it is located in /opt/source/.

There is openbeagle.org too and github (read only) for beagleboard.org. Anyway, I will back out now. I see technical skills are required.

For some external data here…

Kernel 6.16.x is EOL and there are no entries for PWM. I noticed you typed out something about pwm-gpio but I am not familiar with this tech.

I will need to read more.

am33xx-clocks.dtsi « omap « ti « dts « boot « arm « arch - kernel/git/stable/linux.git - Linux kernel stable tree

That line will show you glory! Good luck… and another idea:

/*
// This is by rcn-ee and I have made small mark-ups...

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>

/*
 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
 */
&{/chosen} {
	overlays {
		BBBW_PWM.kernel = __TIMESTAMP__;
	};
};

/*
 * Free up the pins used by the cape from the pinmux helpers.
 */
&ocp {
	P8_45_pinmux { status = "disabled"; };

	ehrpwm0_pins: pinmux-ehrpwm0-pins {
		pinctrl-single,pins = <
			AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE1)	/* (A13) mcasp0_aclkx.ehrpwm0A */
		>;
	};

	ehrpwm1_pins: pinmux-ehrpwm1-pins {
		pinctrl-single,pins = <
			AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT_PULLDOWN, MUX_MODE6)	/* (U14) gpmc_a2.ehrpwm1A */
		>;
	};
...

Note:

Change the kernel versioning and see more-more-more on that link above. I am always surprised to see commonality amongst the am335x builds.

We, you and I, can build it here or just move our separate ways. Your choice. I can make time during building kernels and trying new ideas for DTS.

Also, part of the above scripting for PWM is done for the am335x on the Pocket Beagle, i.e. NOT the Pocket Beagle 2. Who knows? Anyway. I think they both (BBBW and Pocket Beagle) have very similar OSD packages for the am335x.

Also: HDMI is taken up by the P8.45 pin on the headers. Try to disable it.

Note Two:

I am only finding timers now instead of raw PWM instances in kernels that are newer.

Note Three:

Okay. So, it seems only arm, not aarch64, is available for PWM if you have a Pi. At least this is what I read and am seeing here: pwm « dt-bindings « include - kernel/git/stable/linux.git - Linux kernel stable tree and this is for kernel 6.16.x (EOL).

I read this via Debian pages on their Wiki a while back. Maybe there is something I am missing…

Like how to efficiently port PWM to the BBBW when Debian distros only allow arm for Pi is a conclusion.

I do not know whatever beagleboard.org personnel know. Obviously. So. I am out. Sorry. I cannot handle it any longer. It is in the kernel but not for Debian/GNU Linux on arm (32-bit). I think what they are going for now is a fan port.

Last note and I promise:

and…

I will test and report back, i.e. as I should have done from the start.

Ah, made a mistake while uploading. Wrong version.

// SPDX-License-Identifier: GPL-2.0-only
/*

/dts-v1/;
/plugin/;

#include <dt-bindings/pinctrl/am33xx.h>

/*

  • Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
    */
    &{/chosen} {
    overlays {
    BB-EHRPWM2-P8_45-P8_46.kernel = TIMESTAMP;
    };
    };

&am33xx_pinmux {
epwmss2_pins: pinmux_epwmss2_pins {
pinctrl-single,pins = <
AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE3) /* P8_45 (R1) lcd_data0.ehrpwm2A /
AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE3) /
P8_46 (R2) lcd_data1.ehrpwm2B */

;
};
};

&epwmss2 {
status = “okay”;
};

&ehrpwm2 {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&epwmss2_pins>;
};

BB-EHRPWM2-P8_45-P8_46.dtso (753 Bytes)

Hey,

I am glad you replied. So, I found pwm-gpio.ko and pwm-pca9685.ko.

I am working now to install them to use them.

Seth

@Johan_Henselmans , so. I cannot use gpio-pwm at all. I cannot even find it after using insmod.

Also, I saw where uEnv.txt did not have the commented section of being able to disable HDMI. This will be a good one to solve.

Also, without the PWM support eHRPWM, compiling the kernel may be the only way to get it.

I updated the BBBW to a new -BONE kernel and installed linux-headers. This seemed to break my system. So, I need to flash it again with a different kernel to test. I will report back once I cancel out the HDMI in DTS and build a kernel from openbeagle.org. They have Linux on their repos. Also, with menuconfig, I will create the support for eHRPWM. I really do not know of another way for now.

@Johan_Henselmans ,

Hey sir, do you know what this means:

<level/flags> filename:line function “format” ?

Is that all it takes? I am just trying to understand how to use it too. Right now, sysfs holds the native module but I cannot make it usable yet. So, we need DTS and clocks!

Without the dts file and the clock section in the dts, it will not work. off to test more… So, I think we need an output on Mode 4 in DTS for P8.45 along with the correct clock.

There is short mention of the clocks in the datasheet. I have not opened the TRM yet. Okay…

I opened the TRM. It is needing compilation for ehrpwm within the kernel or the PWMSS is having reserved bits. Anyway, off to mowing. Yay!

update

Done for working for the time being. Um, uEnv.txt on kernel 6.16.12-Bone does not have the entries for HDMI but kernel 6.16.5-Bone has a more familiar feel and that pwm_gpio driver/module can be loaded via modprobe.

filename:       /lib/modules/6.16.5-bone16/kernel/drivers/pwm/pwm-gpio.ko.xz
license:        GPL
author:         Vincent Whitchurch
description:    PWM GPIO driver
import_ns:      PWM
alias:          of:N*T*Cpwm-gpioC*
alias:          of:N*T*Cpwm-gpio
depends:
intree:         Y
name:           pwm_gpio
vermagic:       6.16.5-bone16 preempt mod_unload modversions ARMv7 thumb2 p2v8

I am not finding anything associated with it for now online. I will keep reading. And…

dmesg returns nothing for this driver.

update

Okay, so. I figured out the issue or an issue so far. Kernel 6.16.x is no good.

If you need pwm peripheral access, try to uncomment the line for u-boot-overlays=1.

Also, use kernel 6.12.x with Trixie. I think kernel 6.12.x was meant to be used with that version of Debian. At least, I am having less issues now compared to earlier with I was mouthing off on subject matter.