config-pin for gpio output

In the day I did:

config-pin P9_11 out

to make it a gpio output. Now it appears I have to do:

config-pin P9_11 gpio

But how do I make it an output? Must I do:

echo out > /sys/class/gpio/gpio30/direction ?

–Mark

The concept of out/in is not currently supported in the c based
re-write of config-pin used in Buster..

https://github.com/beagleboard/bb.org-overlays/tree/master/tools/pmunts_muntsos

https://github.com/beagleboard/bb.org-overlays/blob/master/tools/beaglebone-universal-io/config-pin#L1088-L1108

Regards,

So is,
echo out > /sys/class/gpio/gpio30/direction

The proper way to set it to output?

–Mark

The proper way is to use libgpiod tools such as gpioset :wink:

sudo gpioset gpiochip0 30=1

But that old way still woks.

Regards,

Well, my solution, for now, was to write a wrapper[1] for config-pin that uses gpioinfo when ‘in’ or ‘out’ are used.

–Mark

[1] https://github.com/MarkAYoder/PRUCookbook/blob/v2.0/docs/common/config-pin.sh

The proper way is to use libpruio and do pinmuxing single source in the code :wink:

pruio_gpio_setValue(io, P9_11, [0,1]);

Regards

How does the library change the pinmux during runtime?

Does it use /sys/devices/platform/ocp/ocp:P9_11_pinmux/state? (which
is created by bone-pinmux-helper)

thanks,
drew

The GPIO utils in FPP use a combination of /sys/devices/platform/ocp/ocp:%s_pinmux/state and /sys/class/gpio/gpio%u/ locations to configure the pin in various ways. See:

https://github.com/FalconChristmas/fpp/blob/master/src/util/BBBUtils.cpp#L228

Some of it is a bit complex as some pins may need to boot up in i2c mode but then be flipped to gpio/out.

The idea of using libgpiod is “ok” but doesn’t allow configuring the internal pull ups for the input (at least until kernel 5.4 and a newer version of libgpiod)

Dan

It contains a LKM (loadable kernel module) that can set any pin configuration (ie. PRU-GPIO with pull-[up,down] at SD card slot) at run-time. All members of system group “pruio” have pinmuxing access from user space. This concept saves lots of kernel memory and more than six seconds boot-time.

Check out the documentation.

Regards