PRU GPIO use for Bookworm

I am trying to upgrade my SquareWave application I used with Bullseye 5.10. My kernel version is now 6.1.83. I have created a overlay that allows me to use /sys/class/gpio and export the pins I need using the command line $ echo out > /sys/class/gpio/gpio362/direction, and change the values on P8_16.

The problem that I have that this does’nt work any more for the starting the application for
/dev/remoteproc/j7-pru0_0.

The commmands are as follows:
$ sudo echo /lib/firmware/SquareWave0 > /dev/remoteproc/j7-pru0_0/firmware
$ cat /dev/remoteproc/j7-pru0_0/firmware
SquareWave0
$ sudo echo start > /dev/remoteproc/j7-pru0_0/state
-bash: echo: write error: No such file or directory
$ ls /dev/remoteproc/j7-pru0_0
coredump device firmware name power recovery state subsystem uevent
$ cat /dev/remoteproc/j7-pru0_0/state
offline

I have seen this behavior before and I have associated it with something wrong with my overlay.

Below is my overlay, My_GPIO.dts
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*

  • DT Overlay for GPIO connections within the expansion header.
  • Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/

*/

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include “ti/k3-pinctrl.h”

/*

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

&main_pmx0 {
my_gpio: my-gpio-pins{
pinctrl-single,pins = <
J721E_IOPAD(0x40, PIN_INPUT, 7) /* P8_10 (AC24) PRG1_PRU0_GPO15 (gpio0_16) MCAN6_TX /
J721E_IOPAD(0xF0, PIN_INPUT, 7) /
P8_12 (AH28) PRG0_PRU0_GPO16 (gpio0_59) PRG0_PWM0_A2 /
J721E_IOPAD(0x130, PIN_INPUT, 7) /
P8_14 (AF27) PRG0_PRU1_GPO12 (gpio0_75) PRG0_PWM1_A0 /
J721E_IOPAD(0xFC, PIN_INPUT, 7) /
P8_16 (AB28) PRG0_PRU0_GPO19 (gpio0_62) PRG0_PWM0_TZ_OUT /
J721E_IOPAD(0x0C, PIN_INPUT, 7) /
P8_17 (AF22) PRG1_PRU0_GPO2 (gpio0_3) PRG1_PWM2_A0 /
J721E_IOPAD(0xFC, PIN_INPUT, 7) /
P8_18 (AJ23) PRG1_PRU0_GPO3 (gpio0_4) PRG1_PWM3_A2 /
J721E_IOPAD(0xD0, PIN_INPUT, 7) /
P8_26 (AC27) PRG0_PRU0_GPO8 (gpio0_51) PRG0_PWM2_A1 /
J721E_IOPAD(0xB8, PIN_INPUT, 7) /
P9_12 (AE27) PRG0_PRU0_GPO2 (gpio0_45) MCASP0_ACLKR /
J721E_IOPAD(0xC0, PIN_INPUT, 7) /
P9_15 (AD25) PRG0_PRU0_GPO4 (gpio0_47) PRG0_PRU0_GPO4 /
J721E_IOPAD(0x130, PIN_INPUT, 0) /
P8_14 (AF27) PRG0_PRU1_GPO12 (gpio0_75) PRG0_PWM1_A0 /
J721E_IOPAD(0xFC, PIN_INPUT, 0) /
P8_16 (AB28) PRG0_PRU0_GPO19 (gpio0_62) PRG0_PWM0_TZ_OUT */
>;
};
};

&{/} {
gpio_pins {
pinctrl-names = “default”;
pinctrl-0 = <&my_gpio>;
compatible = “gpio-leds”;

	P8_10_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 16 GPIO_ACTIVE_HIGH>;
	};
	
	P8_12_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 59 GPIO_ACTIVE_HIGH>;
	};
	
	P8_14_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 75 GPIO_ACTIVE_HIGH>;
	};

	P8_16_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 62 GPIO_ACTIVE_HIGH>;
	};

	P8_17_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 3 GPIO_ACTIVE_HIGH>;
	};

	P8_18_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 4 GPIO_ACTIVE_HIGH>;
	};

	P8_26_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 51 GPIO_ACTIVE_HIGH>;
	};

	P9_12_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 45 GPIO_ACTIVE_HIGH>;
	};

	P9_15_default_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 47 GPIO_ACTIVE_HIGH>;
	};
	P8_14_pruout_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 75 GPIO_ACTIVE_HIGH>;
	};

	P8_16_pruout_pin {
		linux,default_trigger = "default-off";
		status = "disabled";
		gpios = <&main_gpio0 62 GPIO_ACTIVE_HIGH>;
	};
};

};

I went back to Bullseye kernel version 5.10.168-ti-arm64-r103 which worked last year and it no longer works.
$ echo SquareWave0 > /devremoteproc/j7-pru0_0/firmware
$ echo start > /dev/remoteproc/j7-pru0_0/state
-bash: echo: write error: No such device or address
$ dmesg

[ 72.370547] remoteproc remoteproc0: powering up b034000.pru
[ 72.375654] remoteproc remoteproc0: Booting fw image SquareWave0, size 96204
[ 72.375789] pru-rproc b034000.pru: IRQ vring not found
[ 72.380948] remoteproc remoteproc0: unable to get vring interrupt, status = -6
[ 72.388195] remoteproc remoteproc0: can’t start rproc b034000.pru: -6
[ 72.394703] remoteproc remoteproc0: Boot failed: -6

The newer 5.10 devices tree setup does work with your old setup. I had to replace my entire dtb-5.10-ti folder with an older one after an apt dist-update broke things.

I wish I understood why things randomly stopped working

What BBAI64 kernel version, and release are you currently using, and where can I find it. Also I have been trying kernel versions 6.1.6 and 5.10.158 What I would like to see is the source code for the ti,j721e-icssg, and ti,j721e-pru drivers and link to it using GDB.

I wonder if any one on this forum has an interest in the PRU’s or am I wasting my time with the BBAI64 and ought to focus on the BBB which seems to work great. Or should I shift to focusing on the R5.

Try basing your work off this setup

It’s basically the old setup you gave me awhile back with maybe some random changes I did. It stopped working after some update. I then changed it to bring along it’s own dtb-5.10-ti folder…which I grabbed from an AI64 I had not updated yet.

I believe this setup should work with any 5.10 kernel. It’s really sketch though

Maybe try basing your work off the TI SDK directly. Figure out a Yocto build of Debian, so on. The device tree stuff might become less complicated, you could maybe get support from TI E2E.

I will give it a try can’t find any of the old distros that work. Thanks

Should I over write the /opt/source/dtb5.10 folder with the one I pulled from git? I also see 2 other folders arm64 and include

The setup script I believe deletes the dtb5.10 folder already in place and replaces it with it’s own. It then copies in a modified arm64 and include folder. Originally the script just copied the arm64 and include folders into the dtb5.10 folder already on the system

klindsayjr
I wonder if any one on this forum has an interest in the PRU’s or am I wasting my time with the BBAI64 and ought to focus on the BBB which seems to work great. Or should I shift to focusing on the R5.

I for one have a keen interest in the BBAI64’s PRUs! I see them as essential for ad hoc synchronous serial communications links. Your efforts are not wasted!!! The community needs pioneers like you to help us understand how to use these complex SOCs. The beagle folks give us a basic starting point that boots up. We need to take it over the finish line.

Thank you so much for your original work on the device trees. Without your efforts, we would be lost.

Best regards,
Fred Eckert

1 Like

I have my SquareWave0 app working with the changes to the “ti-software-support-package” for now with 5.10.168-ti-r103. In addition I enabled the /dev/rpmsg_pru0 control for the period. I am not exactly sure why it works now. I gave up on trying to backtrack with older versions of the app. Turns out it was not a overlay problem, but more an likely stepping on some kernel memory area. It is difficult to debug with out stepping through the remoteproc driver and into my code. Future work still needs to be done through the use of CCS and the SK-AM64B_EVM using the jtag debug interface.

1 Like

Tried to get bookworm 6.1.83-ti-arm64-r63 to work with the exact same version of SquareWave0 app, and get the same error I had before see below. Something has changed, my latest device tree to work with command lines that use the /sys/class/gpio interface.
$ echo SquareWave0 > /dev/remoteproc/j7-pru0_0/firmware
$ cat /dev/remoteproc/j7-pru0_0/firmware
SquareWave0
$ echo start > /dev/remoteproc/j7-pru0_0/state
-bash: echo: write error: No such device or address
My_GPIO.dts (4.9 KB)

Got your script to work and modify the device trees to get SquareWave to work using PRU0.
Image used use is : bbai64-emmc-flasher-debian-12.2-minimal-arm64-2023-10-07-6gb.img.xz
Kernel version is: Linux BeagleBone-AI64 5.10.168-ti-arm64-r115 #1bookworm SMP Tue Jul 2 23:30:51
My SquareWave.dts file is:
SquareWave.dts (664 Bytes)

The next step is to learn how to use Code Composer Studio (CCS) with Eclipses Egit. Hopefully others will be able to use my work usin CCS and Eclipse for the work with the BBAI64 and Beaglebone Black.

PS. Give up on kernel version 6.1 spent way to much time shot gunning.

Got eGit to work with CCS 12.5. Sucessfuly pushed to this URL.
GitHub - gitklindsayjr/BBAI64_CCS_Projects: Code Composer Studio, BBAI64 Projects. Got 4 projects up and running with your soution for bookworm on the BBAI64. Posted PRU GPIO use for Bookworm - #7 by kevinacahalan

1 Like