Unable to set up GPIO as input using Adafruit_BBIO.GPIO library.

I have put together a simple script to test a GPIO as an input in python:

import Adafruit_BBIO.GPIO as GPIO
from time import sleep
inputTest=“P9_25”

GPIO.setup(inputTest, GPIO.IN)
while(1):
if GPIO.input(inputTest):
print(“Input received”)

    sleep(.2)

GPIO.cleanup()

However when running the script I receive the following error:

Traceback (most recent call last):
File “single_input_test.py”, line 5, in
GPIO.setup(inputTest, GPIO.IN)
ValueError: Set gpio mode failed, missing file or invalid permissions.
debian@beaglebone:~$

I am unable to work out why this error is occuring. I have declared the pin as an input the device tree (exerpt from device tree):

fragment@6 {
  target = <&am33xx_pinmux>;
  __overlay__ {
    db_aux1_din_pins: pinmux-db_aux1_din_pins {
      pinctrl-single,pins = <
        0x1AC 0x27  /* BONE_P9_25 (PIN_INPUT_PULLDOWN | MUX_MODE7) */
        0x1A4 0x27  /* BONE_P9_27 (PIN_INPUT_PULLDOWN | MUX_MODE7) */
        0x194 0x27  /* BONE_P9_29 (PIN_INPUT_PULLDOWN | MUX_MODE7) */
        0x190 0x27  /* BONE_P9_31 (PIN_INPUT_PULLDOWN | MUX_MODE7) */
      >;
    };
  };
};

fragment@8 {
  target = <&ocp>;
  __overlay__ {
    db_aux1_din_test_helper: db_aux1_din_helper {
      compatible = "bone-pinmux-helper";
      pinctrl-names = "default";
      pinctrl-0 = <&db_aux1_din_pins>;
      status = "okay";
    };
  };
};

The output of sudo /opt/scripts/tools/version.sh is below.

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
[sudo] password for debian:
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335BNLT00C02212SBB10985]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-g923f8b8]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0.bb.org-overlays]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.bb.org-overlays]
UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0.bb.org-overlays]
kernel:[4.19.94-ti-r42]
nodejs:[v10.15.2]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr2=/lib/firmware/DB-AUX1-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.14.20210821.0-0~buster+20210821]
pkg:[bb-wl18xx-firmware]:[1.20230414.0-0~buster+20230414]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyS0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 38.542081] remoteproc remoteproc0: wkup_m3 is available
[ 38.558553] remoteproc remoteproc0: powering up wkup_m3
[ 38.558584] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[ 38.558882] remoteproc remoteproc0: remote processor wkup_m3 is now up
[ 41.514580] remoteproc remoteproc1: 4a334000.pru is available
[ 41.533355] remoteproc remoteproc2: 4a338000.pru is available
[ 85.435922] remoteproc remoteproc1: powering up 4a334000.pru
[ 85.438229] remoteproc remoteproc1: Booting fw image am335x-pru0.fw, size 112504
[ 85.448174] remoteproc remoteproc1: registered virtio0 (type 7)
[ 85.448194] remoteproc remoteproc1: remote processor 4a334000.pru is now up
dmesg | grep pru
[ 41.514580] remoteproc remoteproc1: 4a334000.pru is available
[ 41.514768] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[ 41.533355] remoteproc remoteproc2: 4a338000.pru is available
[ 41.533558] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
[ 85.435922] remoteproc remoteproc1: powering up 4a334000.pru
[ 85.438229] remoteproc remoteproc1: Booting fw image am335x-pru0.fw, size 112504
[ 85.438899] pruss 4a300000.pruss: configured system_events[63-0] = 00000000,00030000
[ 85.438913] pruss 4a300000.pruss: configured intr_channels = 0x00000005 host_intr = 0x00000005
[ 85.448194] remoteproc remoteproc1: remote processor 4a334000.pru is now up
[ 85.485669] virtio_rpmsg_bus virtio0: creating channel rpmsg-pru addr 0x1e
[ 85.533318] rpmsg_pru virtio0.rpmsg-pru.-1.30: new rpmsg_pru device: /dev/rpmsg_pru30
dmesg | grep pinctrl-single
[ 0.856550] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[ 9.136094] pinctrl-single 44e10800.pinmux: pin PIN107 already requested by ocp:db_aux1_din_helper; cannot claim for 48038000.mcasp
[ 9.148403] pinctrl-single 44e10800.pinmux: pin-107 (48038000.mcasp) status -22
[ 9.155893] pinctrl-single 44e10800.pinmux: could not request pin 107 (PIN107) from group mcasp0_pins on device pinctrl-single
dmesg | grep gpio-of-helper
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END
debian@beaglebone:~$

and as far as I can tell, the pin is configured correctly:

debian@beaglebone:/opt/scripts/device/bone$ sudo ./show-pins.pl | grep P9.25
P9.25 / audio osc 107 A14 fast rx down 7 gpio 3.21 ocp/db_aux1_din_helper (pinmux-db_aux1_din_pins)
debian@beaglebone:/opt/scripts/device/bone$

If anyone has encountered this issue before. help would be greatly appreciated

in /boot/uEnv.txt you need to uncomment the line
disable_uboot_overlay_audio=1
P9.25 is reserved for that. (had the same issue this morning)