If you are using Debian Buster 10 install gpiod by typing these commands:
sudo apt update
sudo apt install gpiod
Six command-line tools are available:
* gpiodetect - list all gpiochips present on the system, their names, labels
and number of GPIO lines
* gpioinfo - list all lines of specified gpiochips, their names, consumers,
direction, active state and additional flags
* gpioget - read values of specified GPIO lines
* gpioset - set values of specified GPIO lines, potentially keep the lines
exported and wait until timeout, user input or signal
* gpiofind - find the gpiochip name and line offset given the line name
* gpiomon - wait for events on GPIO lines, specify which events to watch,
how many events to process before exiting or if the events
should be reported to the console
sudo gpiodetect
gpiochip0 [fc038000.pinctrl] (128 lines)
gpiochip1 [fc040000.secumod] (8 lines)
sudo gpiodetect
gpiochip0 [fffff200.gpio] (32 lines)
gpiochip1 [fffff400.gpio] (32 lines)
gpiochip2 [fffff600.gpio] (32 lines)
gpiochip3 [fffff800.gpio] (32 lines)
gpiochip4 [fffffa00.gpio] (32 lines)
sudo gpioinfo fc038000.pinctrl
gpiochip0 - 128 lines:
line 0: "PA0" unused input active-high
line 1: "PA1" unused input active-high
line 2: "PA2" unused input active-high
line 3: "PA3" unused input active-high
line 4: "PA4" unused input active-high
...
line 123: "PD27" unused input active-high
line 124: "PD28" unused input active-high
line 125: "PD29" unused input active-high
line 126: "PD30" unused input active-high
line 127: "PD31" unused input active-high
sudo gpioinfo fc040000.secumod
gpiochip1 - 8 lines:
line 0: unnamed unused output active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed unused input active-high
sudo gpioinfo fffff200.gpio
gpiochip0 - 32 lines:
line 0: "pioA0" unused input active-high
line 1: "pioA1" unused input active-high
line 2: "pioA2" unused input active-high
line 3: "pioA3" unused input active-high
line 4: "pioA4" unused input active-high
line 5: "pioA5" unused input active-high
line 6: "pioA6" unused input active-high
line 7: "pioA7" unused input active-high
line 8: "pioA8" unused input active-high
line 9: "pioA9" unused input active-high
line 10: "pioA10" unused input active-high
line 11: "pioA11" unused input active-high
line 12: "pioA12" unused input active-high
line 13: "pioA13" unused input active-high
line 14: "pioA14" unused input active-high
line 15: "pioA15" unused input active-high
line 16: "pioA16" unused input active-high
line 17: "pioA17" unused input active-high
line 18: "pioA18" unused input active-high
line 19: "pioA19" unused input active-high
line 20: "pioA20" unused input active-high
line 21: "pioA21" unused input active-high
line 22: "pioA22" unused input active-high
line 23: "pioA23" unused input active-high
line 24: "pioA24" unused input active-high
line 25: "pioA25" unused input active-high
line 26: "pioA26" unused input active-high
line 27: "pioA27" unused input active-high
line 28: "pioA28" unused input active-high
line 29: "pioA29" unused input active-high
line 30: "pioA30" unused input active-high
line 31: "pioA31" unused input active-high
sudo gpiofind "PA24"
gpiochip0 24
sudo gpioget gpiochip0 24
1
wire PA24 to GND and try again:
sudo gpioget gpiochip0 24
0
sudo gpiofind "pioA0"
gpiochip0 0
sudo gpioget gpiochip0 0
1
wire PA24 to GND and try again:
sudo gpioget gpiochip0 0
0
sudo gpioget --active-low gpiochip0 24 25
1 1
sudo gpioset gpiochip0 24=1
sudo gpioset --mode=wait `gpiofind "PA24"`=1
sudo gpioset --mode=time --sec=1 gpiochip0 34=0
sudo gpiomon --num-events=3 --rising-edge gpiochip0 24
event: RISING EDGE offset: 3 timestamp: [ 1151.814356387]
event: RISING EDGE offset: 3 timestamp: [ 1151.815449803]
event: RISING EDGE offset: 3 timestamp: [ 1152.091556803]
sudo gpiomon --format="%e %o %s %n" --falling-edge gpiochip0 24
0 25 1156 615459801
sudo gpiomon --num-events=1 --silent `gpiofind "PA24"`
sudo gpiomon --silent --num-events=1 gpiochip0 24 25 31
sudo cat /sys/kernel/debug/pinctrl/ahb:apb:pinctrl@fffff200/pinmux-pins