raspberry:raspberry-gpio
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| raspberry:raspberry-gpio [2024/04/23 14:29] – created - external edit 127.0.0.1 | raspberry:raspberry-gpio [2024/04/23 16:03] (current) – oscar | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== GPIO ====== | ====== GPIO ====== | ||
| + | The old sysfs GPIO interface is deprecated and will be phased out of the kernel. As part of this the base offset of GPIO ports has been omitted in the kernel. Setting the base GPIO number to zero will result in a boot up error on kernels from 6.6. At the same time, the sysfs interface to the GPIOs has been deprecated - some distributions have already disabled it and are expecting users to go through libgpiod. In 6.6, high-numbered GPIOs - probably still available by sysfs, but eventually that will be switched off. | ||
| ===== Query GPIO ports ===== | ===== Query GPIO ports ===== | ||
| + | From 6.5 onwards, the Pi kernel is not forcing a base GPIO for the main GPIO driver. Whilst the sysfs API is still enabled, the base GPIOs will change. The dynamic assignment generally starts at 512 and counts down. If you really need to track down a GPIO using sysfs, look through / | ||
| < | < | ||
| cat / | cat / | ||
| Line 63: | Line 65: | ||
| </ | </ | ||
| + | ===== GPIOD ===== | ||
| + | You can install the libraries and tools to interact with this device, using sudo apt install gpiod. This will install the gpiod tools, and the libgpiod2 library to let you interact with the device from your own code. | ||
| + | < | ||
| + | # apt install gpiod --> runtime | ||
| + | # apt install libgpiod2 | ||
| + | </ | ||
| + | |||
| + | |||
| + | * **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 | ||
| + | |||
| + | ==== gpiodetect ==== | ||
| + | The first column represents name of the chip (also the device node name). The second column (in square brackets) is the device label which is normally set by the GPIO driver (this will match the value of / | ||
| + | < | ||
| + | # gpiodetect | ||
| + | ------------ | ||
| + | gpiochip0 [pinctrl-bcm2835] (54 lines) | ||
| + | gpiochip1 [ftdi-cbus] (4 lines) | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | # gpioinfo | ||
| + | ---------- | ||
| + | gpiochip0 - 54 lines: | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line 10: " | ||
| + | line 11: " | ||
| + | line 12: " | ||
| + | line 13: " | ||
| + | line 14: " | ||
| + | line 15: " | ||
| + | line 16: " | ||
| + | line 17: " | ||
| + | line 18: " | ||
| + | line 19: " | ||
| + | line 20: " | ||
| + | line 21: " | ||
| + | line 22: " | ||
| + | line 23: " | ||
| + | line 24: " | ||
| + | line 25: " | ||
| + | line 26: " | ||
| + | line 27: " | ||
| + | line 28: " | ||
| + | line 29: " | ||
| + | line 30: " | ||
| + | line 31: " | ||
| + | line 32: " | ||
| + | line 33: " | ||
| + | line 34: " | ||
| + | line 35: " | ||
| + | line 36: " | ||
| + | line 37: " | ||
| + | line 38: " | ||
| + | line 39: " | ||
| + | line 40: " | ||
| + | line 41: " | ||
| + | line 42: " | ||
| + | line 43: " | ||
| + | line 44: " | ||
| + | line 45: " | ||
| + | line 46: " | ||
| + | line 47: " | ||
| + | line 48: " | ||
| + | line 49: " | ||
| + | line 50: " | ||
| + | line 51: " | ||
| + | line 52: " | ||
| + | line 53: " | ||
| + | gpiochip1 - 4 lines: | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | line | ||
| + | </ | ||
| + | ===== Links ===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
raspberry/raspberry-gpio.1713882577.txt.gz · Last modified: by 127.0.0.1
