Beaglebone Black Device Tree Overlay applies only first pinmux entry

Hello,

I’m trying to apply a custom device tree overlay to set header pins P8.11 and P8.16 to mode 6 (PRU). I am struggling for hours and cannot find any proper solution using the internet.

I am observing some strange behaviour.

I am running Debian 12 with Kernel version 6.12.79 on a Beaglebone Black Rev. D.

If my DTS file contains

pru_pins: pinmux_pru_pins {
    pinctrl-single,pins = <
        0x034 0x0e
        0x038 0x0e
    >;
};

It has been build compiled using dtc -@ -I dts -O dtb -b 0 -o BB-PRU-OUT-00A0.dtbo BB-PRU-OUT.dts.

cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins shows:

pin 13 (PIN13): 4a300000.pruss (GPIO UNCLAIMED) function pinmux_pru_pins group pinmux_pru_pins
pin 14 (PIN14): (MUX UNCLAIMED) (GPIO UNCLAIMED)

If i switch the pin entries as follows

pru_pins: pinmux_pru_pins {
    pinctrl-single,pins = <
        0x038 0x0e
        0x034 0x0e
    >;
};

cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins shows:

pin 13 (PIN13): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 14 (PIN14): 4a300000.pruss (GPIO UNCLAIMED) function pinmux_pru_pins group pinmux_pru_pins

Please note that I changed the order of the pins within pru_pins.

The output of pinmux-pins shows that in both settings only the first entry is set to PRU mode.

The pin addresses and mode values seem to be correct, as they can be set to PRU mode separately.

I do not see the reason why it is not possible to set both pins to PRU mode at the same time. Does anybody can explain this behaviour? How do i set pin mode correctly within the .dts file?

Thanks, Michael

BB-PRU-OUT.dts (1,0 KB)

This never hit mainline:

    fragment@2 {
        target = <&pruss>;
        __overlay__ {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&pru_pins>;
        };
    };

Which 6.12 source are you using? i usually force pru_pins thru am33xx_pinmux’s default node..

1 Like

Must admit I always use the marcos that are defined for pinmux so I have code like:

&am33xx_pinmux {
epwmss0_pins: pinmux_epwmss0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x990, PIN_OUTPUT | MUX_MODE1) /* (A13) mcasp0_aclkx.ehrpwm0A */
AM33XX_IOPAD(0x994, PIN_OUTPUT | MUX_MODE1) /* (B13) mcasp0_fsx.ehrpwm0B */
>;
};
};

So I’d check that the pinmux collection is going to the right place, I always use the alias &am33xx_pinmux for the AM335x boards. In my experience you can put as many pin muxes as you want in the collection of pin muxes - it only becomes active though when referenced by a bit of the device tree that describes which driver uses the pins and in particular setting the status to okay:

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

So I’d check that area as well. In particular if you active two drivers at the same time, that both use the same pins, but with different pin muxes - then you will find errors …

1 Like

Thank you very much for your helpful hints!

Finally I was able to set two pins to PRU mode at the same time.

Seems that i had problems with the used toolchain. I used to compile the dts manually from a local folder with the preinstalled dts command from the distribution.

dtc -@ -I dts -O dtb -b 0 -o BB-PRU-OUT-00A0.dtbo BB-PRU-OUT.dts

I renamed the file BB-PRU-OUT.dts do BB-PRU-OUT-00A0.dtso and placed it under /opt/source/dtb-6.12/src/arm/overlays/.

I added the include #include<dt-bindings/pinctrl/am33xx.h> and replaced the magic numbers with the predefined makros.

pru_pins: pinmux_pru_pins {
    pinctrl-single,pins = <
        AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLUP, MUX_MODE6)
        AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_OUTPUT, MUX_MODE6)
    >;
};

Then I compiled the .dtso file using the existing Makefile within /opt/source/dtb-6.12/ (Just changed to this folder and run make).

Finally I copied the dtbo file to the /lib/firmware directory.

sudo cp /opt/source/dtb-6.12/src/arm/overlays/BB-PRU-OUT-00A0.dtbo /lib/Firmware/

After reboot both pins are set correctly to PRU Mode.

sudo show-pins | grep -e "P8.11" -e "P8.16"
P8.11                             13 fast         6 pru 0 out 15     pruss@4a300000 (pinmux_pru_pins)
P8.16                             14 fast rx  up  6 pru 0 in 14      pruss@4a300000 (pinmux_pru_pins)
cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pingroups
...
group: pinmux_pru_pins
pin 14 (PIN14)
pin 13 (PIN13)
cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins
...
pin 13 (PIN13): 4a300000.pruss (GPIO UNCLAIMED) function pinmux_pru_pins group pinmux_pru_pins
pin 14 (PIN14): 4a300000.pruss (GPIO UNCLAIMED) function pinmux_pru_pins group pinmux_pru_pins
cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins
...
pin 13 (PIN13) 13:gpio-0-31 44e10834 0000000e pinctrl-single
pin 14 (PIN14) 14:gpio-0-31 44e10838 00000036 pinctrl-single

Thank you so much for putting me on the right track!

I’m really happy you finally made it all work.

Seems like a lot of manual work, which could have been avoided,
had you taken a look at sudo build_n_install.sh.