I’m using an updated BeagleV-Fire device and trying to monitor an input pin for level transitions. The command line tools gpioset and gpioget can be used to write and read two interconnected pins, however gpiomon fails when trying to monitor a pin.
Note: The RaspberryPi gpiomon tool works, however all of the Pi GPIO ports are initialised as inputs, which may alleviate any initial ISR configuration issue.
Calling gpioinfo reports that the pins as unused, but are all outputs.
beagle@BeagleV:~$ gpioinfo gpiochip3
gpiochip3 - 21 lines:
<snip>
line 10: "P9_23" unused output active-high
line 11: unnamed unused output active-high
line 12: "P9_25" unused output active-high
line 13: unnamed unused output active-high
line 14: "P9_27" unused input active-high
<snip>
Executing the gpiomon command generates an error:
beagle@BeagleV:~$ gpiomon -r gpiochip3 12
gpiomon: error waiting for events: Input/output error
And reports errors in the kernel log:
[25246.884515] gpio gpiochip3: (41200000.gpio): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[25246.894579] gpio gpiochip3: (41200000.gpio): unable to lock HW IRQ 12 for IRQ
[25246.901866] genirq: Failed to request resources for gpiomon (irq 67) on irqchip mpfs
I’ve tried a variety of different methods (gpioget and “C” gpiod_line_* functions) to pre-configure GPIO as an input prior to calling gpiomon, but without success. Additionally the C function gpiod_line_request_rising_edge_events() fails and generates the same errors.
I did find mention of previous Linux kernel issue regarding GPIO when the pin is pre-configured as an output [Linux-Kernel Archive: [PATCH v2] pinctrl: st: add irq_request/release_resources callbacks] but couldn’t determine if Beagles have a similar patch applied.
Current OS information:
The kernel was updated as per 24.04 instructions. The gateware was updated from the OS default version. The device tree was modified to support SPI [How to enable SPI on BeagleV®-Fire]
beagle@BeagleV:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
beagle@BeagleV:~$ uname -a
Linux BeagleV 6.1.33-linux4microchip+fpga-2023.06-20231121+ #1 SMP Tue Nov 21 13:43:17 UTC 2023 riscv64 riscv64 riscv64 GNU/Linux
beagle@BeagleV:~$ tree /proc/device-tree/chosen/overlays/
/proc/device-tree/chosen/overlays/
├── DEFAULT-CAPE-GATEWARE
├── PCIE-M2-GATEWARE
└── name
1 directory, 3 files
beagle@BeagleV:~$ cat /proc/device-tree/chosen/overlays/DEFAULT-CAPE-GATEWARE
0.5.1-25-g6ba5ed3
beagle@BeagleV:~$ sudo apt-get install gpiod
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gpiod is already the newest version (1.6.3-1.1build1).