pruout on pin 9_41 and 9_42

Hi All!

I am trying to update a BBB project to a more recent operating system (was using a 2015 image). I have been using pins 9_41 and 9_42 (among others) with a custom daughter board. I can change all of the rest of the pins with
config-pin PX_XX pru(in or out)

But pins 9_41 and 9_42 do not respond.

config-pin P9_41 pruout
ERROR: write() to /sys/devices/platform/ocp/ocp:P9_41_pinmux/state failed, No such device

[592329.717480] bone-pinmux-helper ocp:P9_41_pinmux: Failed to find state pruout
[592329.740243] bone-pinmux-helper ocp:P9_42_pinmux: Failed to find state pruout

I can see that these pins have two different row entries in Derek Molloy’s pin listing.

For the original project, I had compiled a custom device tree overlay, but I don’t remember even realizing that those two pins were a unique situation, I just listed every pin I wanted to use.

Is the solution that I need a custom device tree overlay again?

Best Regards,
Alan

P.S. The details of this build are:
uname -a
Linux BeagleBone 5.15.73-bone-rt-r31 #1bullseye PREEMPT_RT Thu Oct 27 18:39:34 UTC 2022 armv7l GNU/Linux

The uEnv.txt file is:

#Docs: Beagleboard:U-boot partitioning layout 2.0 - eLinux.org

uname_r=5.15.73-bone-rt-r31
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: Beagleboard:BeagleBoneBlack Debian - eLinux.org
###Master Enable
enable_uboot_overlays=1

###Overide capes with eeprom
#uboot_overlay_addr0=.dtbo
#uboot_overlay_addr1=.dtbo
#uboot_overlay_addr2=.dtbo
#uboot_overlay_addr3=.dtbo

###Additional custom capes
#uboot_overlay_addr4=.dtbo
#uboot_overlay_addr5=.dtbo
#uboot_overlay_addr6=.dtbo
#uboot_overlay_addr7=.dtbo

###Custom Cape
#dtb_overlay=.dtbo

###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1

##cape Universal Enable
enable_uboot_cape_universal=1

###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1

###U-Boot fdt tweaks… (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

console=ttyS0,115200n8
cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

#Use an overlayfs on top of a read-only root filesystem:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet overlayroot=tmpfs

##enable Generic eMMC Flasher:
#cmdline=init=/usr/sbin/init-beagle-flasher

First off, @AlanMThomason , I am highly UN-skilled in PRU programming but…

There was a bullseye image that allowed for handling PRU stuff but with the overlay instead of just config-pin.

My current image does not even have config-pin. Try this command: gpioinfo

Please report the output of P9_41 and P9_42. I can probably research on my board with an image or two why exactly those pins are used already. That ERROR is usually due to the pin(s) already being allocated without the proper muxing either in DTS and/or u-boot_overlays.

Seth

P.S. Where you using RemotePROC or UIO?

Update

Go to /boot/dtbs/YOUR_KERNEL/overlays/ and you will see the first two options for .dtbo files.

They should be AM335X-PRU-RPROC-PRUCAPE-00A0.dtbo and/or AM335X-PRU-UIO-00A0.dtbo?

Either/or go into the uEnv.txt file for usage. That is what is listed on my Bookworm Distro for now. I cannot be sure it will be allocated for me to use after today, e.g. I will probably upgrade and update to get latest/greatest!

Seen from above, the RPROC is for the PRU Cape for now or maybe forever. I cannot tell, i.e. as I do not know…

Another one of these updates

line 18: "P9_42B [ecappwm0]" "P9_92" input active-high [used]

and…

line 20: "P9_41A" "P9_91" input active-high [used]

For line 20, you may have to go into the DeviceTrees to figure out exactly why it is used and how it is used.

Luckily for us, line 18, it looks like ecappwm0 is being utilized on P9_42.

Last update for the night

uboot_overlay_pru=AM335X-PRU-RPROC-4-19-TI-00A0.dtbo

That overlay is not available on my system any longer, e.g. 5.10.x is what I am using now instead of 4.19.x kernel.

Thanks! That puts me further along…

The gpioinfo command responds with these lines:

gpioinfo | grep 9_4
line 18: “P9_42B [ecappwm0]” “P9_92” input active-high [used]
line 20: “P9_41A” “P9_91” input active-high [used]
line 7: “P8_42A [ecappwm0]” “P9_42” input active-high [used]
line 20: “P9_41B” “P9_41” input active-high [used]

There is a section in Derek Molloys’ Exploring Beaglebone, rev 2 (which is just fantastic) discussing overlays. I will reread this again and the other entries in this forum and see if I can figure out a path.

With what you have showed me, it looks like I do have to modify and rebuild an overlay.

P.S.

This is what I have in the overlays:
AM335X-PRU-UIO-00A0.dtbo BB-BONE-NH7C-01-A0.dtbo BB-I2C2-BME680.dtbo BB-UART4-00A0.dtbo M-BB-BBGG-00A0.dtbo
BB-ADC-00A0.dtbo BB-BONE-eMMC1-01-00A0.dtbo BB-I2C2-MPU6050.dtbo BB-W1-P9.12-00A0.dtbo PB-MIKROBUS-0.dtbo
BB-BBBW-WL1835-00A0.dtbo BB-CAPE-DISP-CT4-00A0.dtbo BB-NHDMI-TDA998x-00A0.dtbo BBORG_COMMS-00A2.dtbo PB-MIKROBUS-1.dtbo
BB-BBGG-WL1835-00A0.dtbo BB-HDMI-TDA998x-00A0.dtbo BB-SPIDEV0-00A0.dtbo BBORG_FAN-A000.dtbo
BB-BBGW-WL1835-00A0.dtbo BB-I2C1-MCP7940X-00A0.dtbo BB-SPIDEV1-00A0.dtbo BBORG_RELAY-00A2.dtbo
BB-BONE-4D5R-01-00A1.dtbo BB-I2C1-RTC-DS3231.dtbo BB-UART1-00A0.dtbo BONE-ADC.dtbo
BB-BONE-LCD4-01-00A1.dtbo BB-I2C1-RTC-PCF8563.dtbo BB-UART2-00A0.dtbo M-BB-BBG-00A0.dtbo

1 Like

AM335X-PRU-UIO-00A0.dtbo is the .dtbo needed on your image (I think)…

Also, it seems your pins are already muxed for ecappwm and are both [used].

I am not sure how good you are on DTS but BeagleBoard-DeviceTrees is a good place to look.

Seth

Use P9_91 and P9_92 for the “extra” set of options.

1 Like

@Daniel_Kulp ,

Is it possible to call that pin, say P9_91, in source?

Something like its GPIO equivalent from gpio.h of gpiod?

Seth

I may be having a similar problem – Using a 5.10.168-ti-r77 running BeagleBoard.org Debian Bookworm IoT Image 2023-10-07, trying to configure the PRU eCAP, the pin known as P9_42a has mode 3, pr1_ecap0_ecap_capin_apwm_o in control module register 0x964. I tried

sudo config-pin P9_42 pru_ecap
/usr/local/bin/config-pin: 1489: echo: echo: I/O error
Cannot write pinmux file: /sys/devices/platform/ocp/ocp:P9_42_pinmux/state

Both regsiter 0x964 and 0x9a0 boot control registers boot with value 0x27 and configure GPIO by default. I was not able to change this pin assignment using config-pin, however a diff like the following worked:

--- a/arch/arm/boot/dts/am335x-bone-common-univ.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common-univ.dtsi
@@ -602,7 +602,7 @@ BONE_PIN(P9_91, pruout, P9_91(PIN_OUTPUT_PULLDOWN | INPUT_EN | MUX_MODE5))
 	BONE_PIN(P9_91, pruin, P9_91(PIN_INPUT | MUX_MODE6))
 
 	/* P9_42 (ZCZ ball C18) eCAP0_in_PWM0_out (gpio0_7) */
-	BONE_PIN(P9_42, default, P9_42(PIN_OUTPUT_PULLDOWN | INPUT_EN | MUX_MODE7))
+	BONE_PIN(P9_42, default, P9_42(PIN_INPUT | MUX_MODE3))
 	BONE_PIN(P9_42, gpio, P9_42(PIN_OUTPUT | INPUT_EN | MUX_MODE7))
 	BONE_PIN(P9_42, gpio_pu, P9_42(PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE7))
 	BONE_PIN(P9_42, gpio_pd, P9_42(PIN_OUTPUT_PULLDOWN | INPUT_EN | MUX_MODE7))
@@ -614,7 +614,7 @@ BONE_PIN(P9_42, spi_sclk, P9_42(PIN_INPUT_PULLUP | MUX_MODE4))
 
 	/* P9_42.1 */
 	/* P9_92 (ZCZ ball B12) mcasp0_aclkr (gpio3_18) */
-	BONE_PIN(P9_92, default, P9_92(PIN_OUTPUT_PULLDOWN | INPUT_EN | MUX_MODE7))
+	BONE_PIN(P9_92, default, P9_92(PIN_INPUT | MUX_MODE6))
 	BONE_PIN(P9_92, gpio, P9_92(PIN_OUTPUT | INPUT_EN | MUX_MODE7))
 	BONE_PIN(P9_92, gpio_pu, P9_92(PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE7))
 	BONE_PIN(P9_92, gpio_pd, P9_92(PIN_OUTPUT_PULLDOWN | INPUT_EN | MUX_MODE7))

I wasn’t sure, but it seemed like changing both P9_42a and P9_42b to an input mode would work. I’m getting inconsistent information from the tools, but I was able to make the PRU eCAP function using this configuration. The config-pin tool shows one thing:

$ config-pin -i P9_42
Pin name: P9_42
Function if no cape loaded: gpio
Function if cape loaded: default gpio gpio_pu gpio_pd gpio_input spi_cs spi_sclk uart pwm pru_ecap
Function information: gpio0_7 default gpio0_7 gpio0_7 gpio0_7 gpio0_7 spi1_cs1 spi1_sclk uart3_txd ecap0_in_pwm0_out pru_ecap
Kernel GPIO id: 7
PRU GPIO id: 39

The show-pins tool appears to be correct:

$ show-pins | grep P9.42
P9.42                             89 fast rx      3 pru eCAP         ocp/P9_42_pinmux (pinmux_P9_42_default_pin)
P9.42                            104 fast rx      6 pru 0 in 4       ocp/P9_92_pinmux (pinmux_P9_92_default_pin)
1 Like