libgpiod and gpio port on BBB

On BeagleBone Black, when I tried the pin gpio1_28 with libgpiod

it works if replace gpiochip1 by gpiochip0

gpioset gpiochip0 28=1  

Does NOT work if I use gpiochip1, but this is proper way.

Anyone know why or where to correct it?

Because now if I want pin gpio0_3 then no way.

If your setting this to just be an output you toggle…

Take a look at using the linux device-tree “gpio-led” framework to toggle it on and off…


Hi Robert,

we need libgpiod work, not just toggle a pin.

We found that:

gpio_0 → mapped to gpio_3
gpio_1-> mapped to gpio_0
gpio_2-> mapped to gpio_1
gpio_3-> mapped to gpio_2

Do you know what could affect to this order? It is only on our custom build.

Random race conditions on startup you get to deal with…

You can use gpioinfo to read this struct (gpio-line-names)…

To correctly figure out on every bootup which gpio bank it’s mapped too…


Thanks Robert,

Since it is because of random race conditions, I use device tree overlay and load manually when boot. Seems libgpiod is happy now.

Thank you a lot.