2

I'm running the same image on 2 different Pis: 2020-08-20-raspios-buster-armhf-lite.img.

Kernel 5.4.51-v7+.

One Pi is Pi3, and the other is Pi4.

On both, I installed gpiod, and ran:

$ sudo gpioinfo

On the Pi 4, I get proper pin names:

gpiochip0 - 54 lines:
    line   0:     "ID_SDA"       unused   input  active-high 
    line   1:     "ID_SCL"       unused   input  active-high 
    line   2:       "SDA1"       unused   input  active-high 
    line   3:       "SCL1"       unused   input  active-high 
    line   4:  "GPIO_GCLK"       unused   input  active-high 
    line   5:      "GPIO5"       unused   input  active-high 
    line   6:      "GPIO6"       unused   input  active-high 
    line   7:  "SPI_CE1_N"       unused   input  active-high 
    line   8:  "SPI_CE0_N"       unused   input  active-high 
    line   9:   "SPI_MISO"       unused   input  active-high 
    line  10:   "SPI_MOSI"       unused   input  active-high 
    line  11:   "SPI_SCLK"       unused   input  active-high 
    line  12:     "GPIO12"       unused   input  active-high 
    line  13:     "GPIO13"       unused   input  active-high 
    line  14:       "TXD1"       unused   input  active-high 
    line  15:       "RXD1"       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: "RGMII_MDIO"       unused   input  active-high 
    line  29:  "RGMIO_MDC"       unused   input  active-high 
    line  30:       "CTS0"       unused   input  active-high 
    line  31:       "RTS0"       unused   input  active-high 
    line  32:       "TXD0"       unused   input  active-high 
    line  33:       "RXD0"       unused   input  active-high 
    line  34:    "SD1_CLK"       unused   input  active-high 
    line  35:    "SD1_CMD"       unused   input  active-high 
    line  36:  "SD1_DATA0"       unused   input  active-high 
    line  37:  "SD1_DATA1"       unused   input  active-high 
    line  38:  "SD1_DATA2"       unused   input  active-high 
    line  39:  "SD1_DATA3"       unused   input  active-high 
    line  40:  "PWM0_MISO"       unused   input  active-high 
    line  41:  "PWM1_MOSI"       unused   input  active-high 
    line  42: "STATUS_LED_G_CLK" "led0" output active-high [used]
    line  43: "SPIFLASH_CE_N" unused input active-high 
    line  44:       "SDA0"       unused   input  active-high 
    line  45:       "SCL0"       unused   input  active-high 
    line  46: "RGMII_RXCLK" unused input active-high 
    line  47: "RGMII_RXCTL" unused input active-high 
    line  48: "RGMII_RXD0"       unused   input  active-high 
    line  49: "RGMII_RXD1"       unused   input  active-high 
    line  50: "RGMII_RXD2"       unused   input  active-high 
    line  51: "RGMII_RXD3"       unused   input  active-high 
    line  52: "RGMII_TXCLK" unused input active-high 
    line  53: "RGMII_TXCTL" unused input active-high 
gpiochip1 - 8 lines:
    line   0:      "BT_ON"       unused  output  active-high 
    line   1:      "WL_ON"       unused  output  active-high 
    line   2: "PWR_LED_OFF" "led1" output active-low [used]
    line   3: "GLOBAL_RESET" unused output active-high 
    line   4: "VDD_SD_IO_SEL" "vdd-sd-io" output active-high [used]
    line   5:   "CAM_GPIO"       unused  output  active-high 
    line   6:  "SD_PWR_ON" "sd_vcc_reg"  output  active-high [used]
    line   7:    "SD_OC_N"       unused   input  active-high

On the Pi 3, I get no names:

gpiochip0 - 54 lines:
    line   0:      unnamed       unused   input  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 
    line   8:      unnamed       unused   input  active-high 
    line   9:      unnamed       unused   input  active-high 
    line  10:      unnamed       unused   input  active-high 
    line  11:      unnamed       unused   input  active-high 
    line  12:      unnamed       unused   input  active-high 
    line  13:      unnamed       unused   input  active-high 
    line  14:      unnamed       unused   input  active-high 
    line  15:      unnamed       unused   input  active-high 
    line  16:      unnamed       unused   input  active-high 
    line  17:      unnamed       unused   input  active-high 
    line  18:      unnamed       unused   input  active-high 
    line  19:      unnamed       unused   input  active-high 
    line  20:      unnamed       unused   input  active-high 
    line  21:      unnamed       unused   input  active-high 
    line  22:      unnamed       unused   input  active-high 
    line  23:      unnamed       unused   input  active-high 
    line  24:      unnamed       unused   input  active-high 
    line  25:      unnamed       unused   input  active-high 
    line  26:      unnamed       unused   input  active-high 
    line  27:      unnamed       unused   input  active-high 
    line  28:      unnamed       unused   input  active-high 
    line  29:      unnamed       unused   input  active-high 
    line  30:      unnamed       unused   input  active-high 
    line  31:      unnamed       unused   input  active-high 
    line  32:      unnamed       unused   input  active-high 
    line  33:      unnamed       unused   input  active-high 
    line  34:      unnamed       unused   input  active-high 
    line  35:      unnamed       unused   input  active-high 
    line  36:      unnamed       unused   input  active-high 
    line  37:      unnamed       unused   input  active-high 
    line  38:      unnamed       unused   input  active-high 
    line  39:      unnamed       unused   input  active-high 
    line  40:      unnamed       unused   input  active-high 
    line  41:      unnamed       unused   input  active-high 
    line  42:      unnamed       unused   input  active-high 
    line  43:      unnamed       unused   input  active-high 
    line  44:      unnamed       unused   input  active-high 
    line  45:      unnamed       unused   input  active-high 
    line  46:      unnamed       unused   input  active-high 
    line  47:      unnamed       unused  output  active-high 
    line  48:      unnamed       unused   input  active-high 
    line  49:      unnamed       unused   input  active-high 
    line  50:      unnamed       unused   input  active-high 
    line  51:      unnamed       unused   input  active-high 
    line  52:      unnamed       unused   input  active-high 
    line  53:      unnamed       unused   input  active-high 
gpiochip1 - 2 lines:
    line   0:      unnamed       "led0"  output  active-high [used]
    line   1:      unnamed       unused   input  active-high 
gpiochip2 - 8 lines:
    line   0:      unnamed       unused  output  active-high 
    line   1:      unnamed       unused  output  active-high 
    line   2:      unnamed       unused  output  active-high 
    line   3:      unnamed       unused  output  active-high 
    line   4:      unnamed       unused   input  active-high 
    line   5:      unnamed       unused  output  active-high 
    line   6:      unnamed       unused  output  active-high 
    line   7:      unnamed       "led1"   input  active-high [used]

Any reason why this might happen?

Update: Even on the latest Raspberry Pi OS, with kernel 5.4.83-v7+, gpioinfo does NOT show me any names for pins.

3
  • interestingly, gpioinfo had the inverse problem 3 years ago github.com/raspberrypi/linux/issues/2760 the names were missing on the newer (back then the 3 series) pi's and present only on older pi's - perhaps whoever wrote the utility is completely clueless Feb 25, 2021 at 0:10
  • 1
    Actually, it might be that the DTS(DTB actually) file that the kernel is using might not have gpionames mentioned. Here is a popular example from Beaglebone github.com/torvalds/linux/blob/… May 29, 2021 at 19:59
  • FWIW: I've just now installed gpiod & friends on my RPi 3B+ running bullseye (lite), Linux 5.10.92-v7+ armv7l. I get similar output as @John from gpioinfo - all lines are unnamed - even the few that are used.
    – Seamus
    Feb 18, 2022 at 6:25

3 Answers 3

2

The pin names are elements of the device tree. Specifically, they are coded into the source files (*.dts), and eventually become one of the device tree blob (.dtb) files. Each model of RPi has a unique .dtb file; they are all found in /boot of your local filesystem. For example, the device tree blob for the RPi 3B+ may be found in /boot/bcm2710-rpi-3-b-plus.dtb, for the RPi 3B, it is /boot/bcm2710-rpi-3-b.dtb.

The reason that the pin names are displayed for your RPi 4B, but not for your RPi 3 is that they were only very recently added to the RPi 3B+ *.dts files.

I think the pin names will be useful if you are using the GPIO character device API with gpiod. From this point, I think you have 3 options, depending upon your timeline preferences:

  1. Wait for the next firmware release, at which time your device tree blob will be updated via the routine apt update & upgrade. The maintainers have just recently added the pin names to all of the downstream sources, and so it is just a matter of time.

  2. As of Mar 2, 2022, the updated firmware & kernel is available as a beta release. You can install this release using the rpi-update utility. rpi-update is sometimes considered risky business, but it now has a [get-back-to-safety option] (https://www.raspberrypi.com/documentation/computers/os.html#how-to-get-back-to-safety) if things don't go your way :) Be sure you have a reliable backup before you try this option.

  3. If you prefer the DIY approach - you can use this "source" file to build an overlay. Building and installing the file are simple; there are some instructions here.. Using an overlay for pin names allows you to easily customize the names on your machine to suit your preferences. Note that this source file is unique to the RPi 3B+. If you have another Model 3 the source may require some small changes.

0

I don't know. But on my Pi4B /dev/gpiochip0 appears to have 58 lines (this seemed to happen recently).

I've just checked the BCM2711 docs and it does indeed have 58 GPIO. That information had passed me by.

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/rpi_DATA_2711_1p0.pdf

python EXAMPLES/py_rgpio/chipline.py 
lines=58 name=gpiochip0 label=pinctrl-bcm2711
offset=0 flags=0 name=ID_SDA user=
offset=1 flags=0 name=ID_SCL user=
offset=2 flags=0 name=SDA1 user=
offset=3 flags=0 name=SCL1 user=
offset=4 flags=0 name=GPIO_GCLK user=
offset=5 flags=0 name=GPIO5 user=
offset=6 flags=0 name=GPIO6 user=
offset=7 flags=0 name=SPI_CE1_N user=
offset=8 flags=0 name=SPI_CE0_N user=
offset=9 flags=0 name=SPI_MISO user=
offset=10 flags=0 name=SPI_MOSI user=
offset=11 flags=0 name=SPI_SCLK user=
offset=12 flags=0 name=GPIO12 user=
offset=13 flags=0 name=GPIO13 user=
offset=14 flags=0 name=TXD1 user=
offset=15 flags=0 name=RXD1 user=
offset=16 flags=0 name=GPIO16 user=
offset=17 flags=0 name=GPIO17 user=
offset=18 flags=0 name=GPIO18 user=
offset=19 flags=0 name=GPIO19 user=
offset=20 flags=0 name=GPIO20 user=
offset=21 flags=0 name=GPIO21 user=
offset=22 flags=0 name=GPIO22 user=
offset=23 flags=0 name=GPIO23 user=
offset=24 flags=0 name=GPIO24 user=
offset=25 flags=0 name=GPIO25 user=
offset=26 flags=0 name=GPIO26 user=
offset=27 flags=0 name=GPIO27 user=
offset=28 flags=0 name=RGMII_MDIO user=
offset=29 flags=0 name=RGMIO_MDC user=
offset=30 flags=0 name=CTS0 user=
offset=31 flags=0 name=RTS0 user=
offset=32 flags=0 name=TXD0 user=
offset=33 flags=0 name=RXD0 user=
offset=34 flags=0 name=SD1_CLK user=
offset=35 flags=0 name=SD1_CMD user=
offset=36 flags=0 name=SD1_DATA0 user=
offset=37 flags=0 name=SD1_DATA1 user=
offset=38 flags=0 name=SD1_DATA2 user=
offset=39 flags=0 name=SD1_DATA3 user=
offset=40 flags=0 name=PWM0_MISO user=
offset=41 flags=0 name=PWM1_MOSI user=
offset=42 flags=3 name=STATUS_LED_G_CLK user=led0
offset=43 flags=0 name=SPIFLASH_CE_N user=
offset=44 flags=7 name=SDA0 user=spi0 CS0
offset=45 flags=7 name=SCL0 user=spi0 CS1
offset=46 flags=0 name=RGMII_RXCLK user=
offset=47 flags=0 name=RGMII_RXCTL user=
offset=48 flags=0 name=RGMII_RXD0 user=
offset=49 flags=0 name=RGMII_RXD1 user=
offset=50 flags=0 name=RGMII_RXD2 user=
offset=51 flags=0 name=RGMII_RXD3 user=
offset=52 flags=0 name=RGMII_TXCLK user=
offset=53 flags=0 name=RGMII_TXCTL user=
offset=54 flags=0 name=RGMII_TXD0 user=
offset=55 flags=0 name=RGMII_TXD1 user=
offset=56 flags=0 name=RGMII_TXD2 user=
offset=57 flags=0 name=RGMII_TXD3 user=
5
  • 1
    seems irrelevant to the question Feb 24, 2021 at 22:26
  • The rpi_DATA_2711_1p0.pdf shows 0-57 pins but GPIO46-57 only show "INTERNAL". It looks like a SDIO interface.
    – Milliways
    Feb 24, 2021 at 23:31
  • I tried on a Pi4 running 5.4.72-v7l+ which only shows pins 0-53 so I still think this is a kernel issue. Maybe the other kernels haven't been updated.
    – Milliways
    Feb 25, 2021 at 5:44
  • @Milliways I was using my own utility which queries the /dev/gpiochip. It's certainly reporting 58 lines and as far as the pdf is concerned these are standard GPIO.
    – joan
    Feb 25, 2021 at 8:56
  • The OP's question refers to gpiod, and specifically the gpioinfo utility; i.e. the GPIO character device API. This API gets its pin label information from the device tree blob.
    – Seamus
    Feb 26, 2022 at 10:03
0

The names appear to be missing from (some of) the dtb.
You can see what the dtb contains with the following command (substitute appropriate dtb).

dtc -I dtb /boot/bcm2711-rpi-4-b.dtb | grep "gpio-line-names"

Why they are missing from bcm2710-rpi-3-b.dtb and why has this not been fixed remains one of the (many) RPLtd mysteries. I am sure they were previously present on Pi3B+.

Only bcm2711 dtb seem to have gpio-line-names.

Even when present the names are of limited use as they only show the default NOT the actual programmed value, which can be easily obtained from the gpio registers.

raspi-gpio get (among other tools) shows ACTUAL function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.