1

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.

mrigendra
  • 1,472
  • 3
  • 19
  • 33
  • You need to elaborate what the step in the guide fails for you. – 0andriy Jan 12 '23 at 20:08
  • all of the steps work, device boots up, but pinmux doesn't work. – mrigendra Jan 13 '23 at 04:40
  • It sounds like the MUX itself is not in place. The GPIO functionality is available without it being MUXed to the outside. You need to figure out why the MUX doesn't work. Note that there may be differences on HOW you set up and control MUX between U-Boot and Kernel versions. May require very different approaches. – TBR Jan 13 '23 at 10:00
  • Using gpio sysfs commands doesn't do anything but if I use gpioset, gpiodetect I can see led light up on 1. Its a little strange to me that I have all the nodes for sysfs userspace and still echo 1 > value is not working, maybe I need to see what happened inside gpio-sysfs.c – mrigendra Jan 17 '23 at 04:08

1 Answers1

1

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.

mrigendra
  • 1,472
  • 3
  • 19
  • 33