Beaglebone black PWM 2A non-functioning


I’m struggling to get PWM2A functioning on Debian bookworm with kernel 5.10.168-r76 minimal install.

If I use the command gpioinfo, the system gives me line 22: "P8_19 [ehrpwm2a]" unused output active-high so it seems like the PWM is indeed set up correctly. As I understand things, the PWM2 is set up by default when loading the linux image.

I have access to the PWM settings in /dev/bone/pwm/2/a, however, when I echo 1 > /dev/bone/pwm/2/a/enable I do not get any output.

This pwm output is hooked in to a simple piezo buzzer. I know that the buzzer is functional because if I do gpioset gpiochip0 22=1 I get a “tick” sound out of my buzzer.

My question is: what am I missing? It seems like I have a PWM set up, the pin itself is functional, but the PWM enable command doesn’t trigger an output.

Any assistance is appreciated!

1 Like

Try config-pin p8.19 pwm


Try to set up your u-boot_overlays in /boot/uEnv.txt.


The sequence I have been using is:

config-pin [pin] pwm

and then write to the dev/pwm/ehrpwm2a file locations


I believe you need to set the Period and Duty Cycle before you Enable.

For example:

echo 0 > /dev/pwm/ehrpwm2a/enable #Disable just In Case
echo 10000 > /dev/pwm/ehrpwm2a/period #period in ns
echo 1000 > /dev/pwm/ehrpwm2a/duty_cycle #again, in ns
echo 1 > /dev/pwm/ehrpwm2a/enable #turn on

Sets the period to 10us with a duty cycle of 10%

We use pin 8.45 for pwm2a though, so it’s not quite identical to your use case.

Just went to bing chat bot with this query

example of a device tree for beaglebone black, tree must have 1 pwm and 2 uart

Here is what they provided, I don’t know if this is correct or not, it looks good.


/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";
    part-number = "CustomOverlay"; // Choose a memorable name
    version = "00A0";

    // Define pins for PWM and UART
    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            pwm_pins: pinmux_pwm_pins {
                pinctrl-single,pins = <
                    0x048 0x6 /* P9_14 (PWM1A) | MODE 6 */
                    0x04c 0x6 /* P9_16 (PWM1B) | MODE 6 */

    fragment@1 {
        target = <&ocp>;
        __overlay__ {
            pwm_helper {
                pwm1a {
                    compatible = "pwm_test";
                    pinctrl-names = "default";
                    pinctrl-0 = <&pwm_pins>;
                    pwms = <&ehrpwm1 0 20000000 1>; // Module 0 at 20MHz
                    pwm-names = "STEER_P9_14";
                    enabled = <1>;
                    polarity = <0>; // Normal polarity
                    duty = <0>; // Initial duty
                    status = "okay";

                pwm1b {
                    compatible = "pwm_test";
                    pinctrl-names = "default";
                    pinctrl-0 = <&pwm_pins>;
                    pwms = <&ehrpwm1 1 20000000 1>; // Module 1 at 20MHz
                    pwm-names = "MOTOR_P9_16";
                    enabled = <1>;
                    polarity = <0>;
                    duty = <0>;
                    status = "okay";

Looks like they forgot the 2 uarts. More that I look at it, it appears all they did was scrape some website. Assumed some “magic” might be working but, not.

I fixed the problem by compiling and installing the BB-PWM2-00A0.dts overlay.

Hi, I met the same issues and could you please tell me how to installing th BB-PWM2-00A0.dts?