User Tools

Site Tools


raspberry:raspberry-gpio

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
raspberry:raspberry-gpio [2024/04/23 15:34] oscarraspberry:raspberry-gpio [2024/04/23 16:03] (current) oscar
Line 68: Line 68:
 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. 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.
 <code> <code>
-apt install gpiod --> runtime +apt install gpiod --> runtime 
-apt install libgpiod2  --> build libraries+apt install libgpiod2  --> build libraries
 </code> </code>
 +
 +
 +  * **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 /sys/class/gpio/gpiochipX/label). The last column shows how many GPIO lines the chip has.
 +<code>
 +# gpiodetect
 +------------
 +gpiochip0 [pinctrl-bcm2835] (54 lines)
 +gpiochip1 [ftdi-cbus] (4 lines)
 +</code>
 +
 +<code>
 +# gpioinfo
 +----------
 +gpiochip0 - 54 lines:
 + line   0:     "ID_SDA"       unused   input  active-high 
 + line   1:     "ID_SCL"       unused   input  active-high 
 + line   2:      "GPIO2"       unused   input  active-high 
 + line   3:      "GPIO3"       unused   input  active-high 
 + line   4:      "GPIO4"       unused   input  active-high 
 + line   5:      "GPIO5"      "sysfs"   input  active-high [used]
 + line   6:      "GPIO6"       unused   input  active-high 
 + line   7:      "GPIO7"       unused   input  active-high 
 + line   8:      "GPIO8"       unused   input  active-high 
 + line   9:      "GPIO9"       unused   input  active-high 
 + line  10:     "GPIO10"       unused   input  active-high 
 + line  11:     "GPIO11"       unused   input  active-high 
 + line  12:     "GPIO12"       unused   input  active-high 
 + line  13:     "GPIO13"       unused   input  active-high 
 + line  14:     "GPIO14"       unused   input  active-high 
 + line  15:     "GPIO15"       unused   input  active-high 
 + line  16:     "GPIO16"       unused   input  active-high 
 + line  17:     "GPIO17"       unused   input  active-high 
 + line  18:     "GPIO18"       unused   input  active-high 
 + line  19:     "GPIO19"       unused   input  active-high 
 + line  20:     "GPIO20"       unused   input  active-high 
 + line  21:     "GPIO21"       unused   input  active-high 
 + line  22:     "GPIO22"       unused   input  active-high 
 + line  23:     "GPIO23"       unused   input  active-high 
 + line  24:     "GPIO24"       unused   input  active-high 
 + line  25:     "GPIO25"       unused   input  active-high 
 + line  26:     "GPIO26"       unused   input  active-high 
 + line  27:     "GPIO27"       unused   input  active-high 
 + line  28:       "SDA0"       unused   input  active-high 
 + line  29:       "SCL0"       unused   input  active-high 
 + line  30:         "NC"       unused   input  active-high 
 + line  31:    "LAN_RUN"       unused  output  active-high 
 + line  32:  "CAM_GPIO1"       unused  output  active-high 
 + line  33:         "NC"       unused   input  active-high 
 + line  34:         "NC"       unused   input  active-high 
 + line  35:  "PWR_LOW_N"        "PWR"   input  active-high [used]
 + line  36:         "NC"       unused   input  active-high 
 + line  37:         "NC"       unused   input  active-high 
 + line  38:  "USB_LIMIT"       unused  output  active-high 
 + line  39:         "NC"       unused   input  active-high 
 + line  40:   "PWM0_OUT"       unused   input  active-high 
 + line  41:  "CAM_GPIO0" "cam1_regulator" output active-high [used]
 + line  42:   "SMPS_SCL"       unused  output  active-high 
 + line  43:   "SMPS_SDA"       unused   input  active-high 
 + line  44:    "ETH_CLK"       unused   input  active-high 
 + line  45:   "PWM1_OUT"       unused   input  active-high 
 + line  46: "HDMI_HPD_N"        "hpd"   input   active-low [used]
 + line  47: "STATUS_LED"        "ACT"  output  active-high [used]
 + line  48:   "SD_CLK_R"       unused   input  active-high 
 + line  49:   "SD_CMD_R"       unused   input  active-high 
 + line  50: "SD_DATA0_R"       unused   input  active-high 
 + line  51: "SD_DATA1_R"       unused   input  active-high 
 + line  52: "SD_DATA2_R"       unused   input  active-high 
 + line  53: "SD_DATA3_R"       unused   input  active-high 
 +gpiochip1 - 4 lines:
 + line   0:      unnamed       kernel   input  active-high [used]
 + line   1:      unnamed       kernel   input  active-high [used]
 + line   2:      unnamed       kernel   input  active-high [used]
 + line   3:      unnamed       kernel   input  active-high [used]
 +</code>
 +===== Links =====
 +  * [[https://www.auctoris.co.uk/2023/08/18/how-not-to-use-sysfs-for-gpio-on-a-raspberry-pi-how-you-should-do-it-in-2023/]]
 +  * [[https://openwrt.org/docs/techref/hardware/port.gpio]]
 +  * [[https://www.thegoodpenguin.co.uk/blog/stop-using-sys-class-gpio-its-deprecated/]]
  
raspberry/raspberry-gpio.1713886466.txt.gz · Last modified: by oscar