accessing pin p8_14

I have code that wants to write a Boolean value to this file on the Beaglebone:
/sys/class/gpio/gpio26/value
but there is no directory “gpio26” on this Beaglebone.

This code appears to have functioned in 2011 or so until some time 2013 and accessed P8 pin 14.

What changed?

Thank you.

Run:

sudo /opt/scripts/tools/version.sh

So we can see what failed..

Regards,

Was the following already run or is the expectation that this is already enabled via an overlay or something?

echo 26 > /sys/class/gpio/export

Cheers,

Jon

I’m uneasy about this. I don’t know device tree basics. But thanks for responding. I am attaching the output of version.sh

opt_scripts_tools_version (2.45 KB)

Thanks for the report.. Sadly that didn't detect anything 'wrong'..

eeprom:[A335BNLTAIA05016BBBI4952]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot
2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
kernel:[4.19.94-ti-r42]

uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]

So what i'd expect to see would be:

debian@bbb-pwr03-ser11:/sys/class/gpio$ ls
export gpio117 gpio26 gpio37 gpio5 gpio68 gpio77 gpio9
gpio10 gpio12 gpio27 gpio38 gpio50 gpio69 gpio78 gpiochip0
gpio11 gpio13 gpio3 gpio39 gpio51 gpio7 gpio79 gpiochip32
gpio110 gpio14 gpio30 gpio4 gpio60 gpio70 gpio8 gpiochip64
gpio111 gpio15 gpio31 gpio44 gpio61 gpio71 gpio80 gpiochip96
gpio112 gpio19 gpio32 gpio45 gpio62 gpio72 gpio81 unexport
gpio113 gpio2 gpio33 gpio46 gpio63 gpio73 gpio86
gpio114 gpio20 gpio34 gpio47 gpio65 gpio74 gpio87
gpio115 gpio22 gpio35 gpio48 gpio66 gpio75 gpio88
gpio116 gpio23 gpio36 gpio49 gpio67 gpio76 gpio89
debian@bbb-pwr03-ser11:/sys/class/gpio$

Do any gpio directories show up?

Regards,

Side note, "AIA0" decodes to the "Arrow BeagleBone Black Industrial",
my version of that board is an hour away.. Unfortunately, due to world
event's i'm working from home, so till things change. i can't locally
debug..

Regards,

So what i’d expect to see would be:

debian@bbb-pwr03-ser11:/sys/class/gpio$ ls
export gpio117 gpio26 gpio37 gpio5 gpio68 gpio77 gpio9
gpio10 gpio12 gpio27 gpio38 gpio50 gpio69 gpio78 gpiochip0
gpio11 gpio13 gpio3 gpio39 gpio51 gpio7 gpio79 gpiochip32
gpio110 gpio14 gpio30 gpio4 gpio60 gpio70 gpio8 gpiochip64
gpio111 gpio15 gpio31 gpio44 gpio61 gpio71 gpio80 gpiochip96
gpio112 gpio19 gpio32 gpio45 gpio62 gpio72 gpio81 unexport
gpio113 gpio2 gpio33 gpio46 gpio63 gpio73 gpio86
gpio114 gpio20 gpio34 gpio47 gpio65 gpio74 gpio87
gpio115 gpio22 gpio35 gpio48 gpio66 gpio75 gpio88
gpio116 gpio23 gpio36 gpio49 gpio67 gpio76 gpio89
debian@bbb-pwr03-ser11:/sys/class/gpio$

Do any gpio directories show up?

Yes, but 5 fewer, gpio26 included:

debian@beaglebone:~$ ls /sys/class/gpio/
export gpio112 gpio117 gpio19 gpio27 gpio33 gpio45 gpio5 gpio62 gpio68 gpio72 gpio77 gpio81 gpio9 unexport
gpio10 gpio113 gpio12 gpio2 gpio3 gpio35 gpio46 gpio50 gpio63 gpio69 gpio73 gpio78 gpio86 gpiochip0
gpio11 gpio114 gpio13 gpio20 gpio30 gpio36 gpio47 gpio51 gpio65 gpio7 gpio74 gpio79 gpio87 gpiochip32
gpio110 gpio115 gpio14 gpio22 gpio31 gpio37 gpio48 gpio60 gpio66 gpio70 gpio75 gpio8 gpio88 gpiochip64
gpio111 gpio116 gpio15 gpio23 gpio32 gpio4 gpio49 gpio61 gpio67 gpio71 gpio76 gpio80 gpio89 gpiochip96

There is much for me to study here at home. :slight_smile:

Yes, but 5 fewer, gpio26 included:

debian@beaglebone:~$ ls /sys/class/gpio/
export gpio112 gpio117 gpio19 gpio27 gpio33 gpio45 gpio5 gpio62 gpio68 gpio72 gpio77 gpio81 gpio9 unexport
gpio10 gpio113 gpio12 gpio2 gpio3 gpio35 gpio46 gpio50 gpio63 gpio69 gpio73 gpio78 gpio86 gpiochip0
gpio11 gpio114 gpio13 gpio20 gpio30 gpio36 gpio47 gpio51 gpio65 gpio7 gpio74 gpio79 gpio87 gpiochip32
gpio110 gpio115 gpio14 gpio22 gpio31 gpio37 gpio48 gpio60 gpio66 gpio70 gpio75 gpio8 gpio88 gpiochip64
gpio111 gpio116 gpio15 gpio23 gpio32 gpio4 gpio49 gpio61 gpio67 gpio71 gpio76 gpio80 gpio89 gpiochip96

There is much for me to study here at home. :slight_smile:

That makes it even more confusing.. i was expecting '2' gpio nodes as
that is usually the issue, but most of them show up..???...

Do you happen to have a usb-serial adapter to plug into j1?

https://elinux.org/Beagleboard:BeagleBone_Black_Serial

I'd like to see what u-boot does on startup..

I'm most interested in this section:

Yes, I do. Yes, I’ll run it. Only I have it at our warehouse. I’ve been lazy to go get it but now I will. (after a hamburger).

Thank you.

Argh! I must confess that shot myself in the foot.

Starting with a clean reboot, GPIO devices are all existent as they should be:

debian@beaglebone:~/stepper/beaglebone$ ls /sys/class/gpio/
export gpio112 gpio117 gpio19 gpio26 gpio32 gpio37 gpio45 gpio5 gpio62 gpio68 gpio72 gpio77 gpio81 gpio9 unexport
gpio10 gpio113 gpio12 gpio2 gpio27 gpio33 gpio38 gpio46 gpio50 gpio63 gpio69 gpio73 gpio78 gpio86 gpiochip0
gpio11 gpio114 gpio13 gpio20 gpio3 gpio34 gpio39 gpio47 gpio51 gpio65 gpio7 gpio74 gpio79 gpio87 gpiochip32
gpio110 gpio115 gpio14 gpio22 gpio30 gpio35 gpio4 gpio48 gpio60 gpio66 gpio70 gpio75 gpio8 gpio88 gpiochip64
gpio111 gpio116 gpio15 gpio23 gpio31 gpio36 gpio44 gpio49 gpio61 gpio67 gpio71 gpio76 gpio80 gpio89 gpiochip96

Then I ran this snippet of code:

#define SYSFS_GPIO_DIR “/sys/class/gpio”
#define MAX_BUF 64

int gpio_export(unsigned int gpio)
{
int fd, len;
char buf[MAX_BUF];

fd = open(SYSFS_GPIO_DIR “/export”, O_WRONLY);
if (fd < 0) {
perror(“gpio/export”);
return fd;
}

len = snprintf(buf, sizeof(buf), “%d”, gpio);
write(fd, buf, len);
close(fd);

return 0;
}

int main(int argc, char *argv[]){

gpio_export(26);

return 0;
}

and poof gpio26 disappears:

debian@beaglebone:~/stepper/beaglebone$ ls /sys/class/gpio/
export gpio112 gpio117 gpio19 gpio27 gpio33 gpio38 gpio46 gpio50 gpio63 gpio69 gpio73 gpio78 gpio86 gpiochip0
gpio10 gpio113 gpio12 gpio2 gpio3 gpio34 gpio39 gpio47 gpio51 gpio65 gpio7 gpio74 gpio79 gpio87 gpiochip32
gpio11 gpio114 gpio13 gpio20 gpio30 gpio35 gpio4 gpio48 gpio60 gpio66 gpio70 gpio75 gpio8 gpio88 gpiochip64
gpio110 gpio115 gpio14 gpio22 gpio31 gpio36 gpio44 gpio49 gpio61 gpio67 gpio71 gpio76 gpio80 gpio89 gpiochip96
gpio111 gpio116 gpio15 gpio23 gpio32 gpio37 gpio45 gpio5 gpio62 gpio68 gpio72 gpio77 gpio81 gpio9 unexport

Sorry for the distraction.