I have been updating things recently...

If you get board and would like some moderate source on the Relay Cape, please visit here: silver2row/BBBW_RELAYCAPE: More Source for the Beagleboard.org BBBW and RelayCape (github.com) .

Here too: BeagleBoard.org BeagleBone Relay Cape — BeagleBoard Documentation

If that source from docs.beagleboard.org does not work to your liking, please just contact me. I am sure the two of us can make it work for the BBB or other am335x styled SoC board from beagleboard.org, and this Relay Cape.

Hello,

uname -r: 5.10.100-ti-r40

cat /etc/dogtag: BeagleBoard.org Debian Bullseye IoT Image 2022-03-12

Please see these ideas:

git clone https://github.com/mvduin/sysfs-gpio

1. Once you get the source or write your own, type make in /sysfs-gpio to create your project but please add your file to the Makefile for compilation.

git clone https://github.com/mvduin/overlay-utils

1. This lib. has the BBORG_RELAY-00A2.dtsi to be compiled into a .dtbo for use in /boot/uEnv.txt. 

2. Once compiled with make, please add it to your /boot/uEnv.txt file and reboot your machine, i.e. the BeagleBone Black or other family board.

and this source for use with the lib:

#include "sysfs-gpio.h"
#include <stdio.h>
#include <unistd.h>

unsigned int mSeconds = 5000000;
int returnCode;


int main()
{
        struct Gpio gpio = GPIO_INITIALIZER;

        gpio_open_output( &gpio, "/dev/gpio/relay-jp3", false );
        while (1) {
                gpio_is_output( &gpio );
                        gpio_write( &gpio, false );
                        returnCode = usleep(mSeconds);
                        gpio_write( &gpio, true );
                        returnCode = usleep(mSeconds);
        }
        gpio_close( &gpio );
        return 0;
}

You may also need a script that is located in /etc/udev/rules.d/ for use with accessing GPIOs without root permissions needed. 

Here is the location of that file and you can call it: 80-gpio-noroot.rules

Once this file has been added, please reboot your system or use this command and it should work if we are lucky: sudo udevadm control --reload-rules

It is located here online and I will show it below also: https://github.com/beagleboard/customizations/blob/master/etc/udev/rules.d/80-gpio-noroot.rules

Here is the source:

# /etc/udev/rules.d/80-gpio-noroot.rules
#
# ReWritten by: Matthijs van Duin
# Corrects sys GPIO permissions on the BB so non-root users in the gpio group can manipulate bits
#
SUBSYSTEM=="gpio", ACTION=="add", \
    RUN+="/bin/chgrp -R gpio '/sys%p'", \
    RUN+="/bin/chmod -R g=u '/sys%p'"

SUBSYSTEM=="subsystem", KERNEL=="gpio", ACTION=="add", \
    RUN+="/bin/chgrp gpio '/sys/class/gpio/export' '/sys/class/gpio/unexport'", \
    RUN+="/bin/chmod g=u '/sys/class/gpio/export' '/sys/class/gpio/unexport'"

That should get you up to speed on this neat C/C++ lib. I found for use with the RelayCape, am335x processors from TI, and the Beagleboard.org family of boards.

Seth