Why beaglebone gpio is not working with sysfs (kernel_version=5.10.153-bone69)

281 Views Asked by At

I am trying to use a gpio P9_23 (gpio 49) to light up an LED via sysfs and kernel module, and I used this link to bring up SD card

https://forum.digikey.com/t/debian-getting-started-with-the-beaglebone-black/12967

kernel: am33x-v5.10 (Longterm 5.10.x), kernel_version=5.10.153-bone69

Then once device boots up I do below commands

cd /sys/class/gpio/
echo 49 > export
cd gpio49
echo out > direction
echo 1 > value 
echo 0 > value

Attached is pinmux map,

https://pastebin.com/raw/zW6hJaUs

I tried released images and there it works,

https://www.beagleboard.org/distros/am3358-debian-10-3-2020-04-06-4gb-sd-iot

I don't understand why it doesn't work with https://forum.digikey.com/t/debian-getting-started-with-the-beaglebone-black/12967 guide.

P.S. more info

used this am335x-bone-uboot-univ.dtb for pinmux,

which shows pinmux on P9_23 as,

P9.23 17 fast rx down 7 gpio 1.17 lo >> sysfs (pinmux_P9_23_default_pin)

In working SD image it shows as,

P9.23 17 fast rx down 7 gpio 1.17 << lo P9_23 (pinmux_P9_23_default_pin)

I think that in both cases gpio is configured on this pin, then why its not working as gpio.

Kindly help.

1

There are 1 best solutions below

0
mrigendra On

Ok so finally I am able to make my gpio working,

Not sure but from google searches /sys/class/gpio seems to be getting removed and descriptor based gpiolib is recommended. Check here and here,

Corresponding userspace commands given in libgpiod, so using below commands just to test,

gpioset gpiochip0 17=1
gpioset gpiochip0 17=0

So I took reference from overlay of BB-W1-P9.12-00A0.dts for pinmux and its respective driver w1-gpio.c to use as a kernel driver,

Now I LED works as expected,

gpioinfo | grep -i P9_23

line  17:      "P9_23" "gpio-learn"  output  active-high [used open-drain]

I'll continue doing experiments to learn more about this new gpio library.

This answer is just suggestive,I can't say sysfs gpio userspace is completely removed.