Enable GPIO pins on Beaglebone Black using Yocto for Beginner's

Hello,

I am recent computer engineering graduate attempting to teach myself embedded Linux with Yocto using the beaglebone black. I have created images to boot from an sd card, and added a few test layers. However, I am stuck trying to enable the GPIO pins. I cannot find a decent tutorial that walks you through the process of creating a custom layer to do this. I have been trying to use the kirkstone branch, and the meta-ti layer with the “beaglebone” machine (found in meta-ti/meta-ti-bsp/conf/machine/beaglebone.conf).

It would be greatly appreciated if anyone could help with a quick guide on creating this patch such that after boot you can run from the terminal (using p8_10 for example):
echo 68 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio68/direction
echo 1 > /sys/class/gpio/gpio68/value

Thanks,

Best way to start out with the GPIO is to load the relay cape or load cape overlay. Those capes have LED indicators, way better then trying to watch it on a scope.
Install the bookworm 12 IoT image.

You will need to use libgpiod to control the pins. Most of the that works, a couple of the c++ calls to activate multiple pins at one time I could not get to work. It is important to read all of the docs, several times, they mention what not to do and that is critical.

My recommendation would be to first, toggle pins with libgpiod. When you get that done then move on to your yocto build. Its best to climb one mountain at a time so you can test your yocto build with known working code.

I cannot post any working examples because it is proprietary code, I will help you out when you get stuck on the code you have written.

Also, get a nextion HMI and set it up with a few buttons and text boxes. The nextion interfaces with UART and you will need to be able to bridge the gap from machine to human and that HMI is reliable and easy to set up.

I’ve never done anything with yocto, however your post doesn’t mention anything about a devicetree files. Did you load a devicetree (.dtb file) under the /boot directory?

Devicetree files control what peripherals are defined to kernel.

This page (probably outdated) says you need 2 files am335x-bone.dtb and am335x-boneblack.dtb (I assume first file is general am335 devices and second file is specifics for BB Black)