complete newb question - getting GPIO pins to work from Python

Let me start with saying I am a complete newb, don’t work with linux every day.

I have a BBB, revision C. It is freshly flashed with bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img.xz and has been updated to Debian version is 8.9

Kernel version is 4.4.54-ti-r93.

It has the Adafruit_BBIO installed.

After struggling to get some UARTs working, I found some online threads which stated:

Apparently the powers that be like to change files to keep us on our toes.

TamusJRoyce left a comment here: that helped me:

/media/BEAGLEBONE/env.txt and /boot/uBoot/uEnv.txt has moved to /etc/default/capemgr (file which may not exist). It also has a new syntax. Add “CAPE=BB-SPI-01,BB-UART1,BB-UART2,BB-UART4” to get main ports working. Then reboot.

I added CAPE=BB-UART1,BB-UART2,BB-UART4 and that finally got the UARTS working. I was able to open them from python, stream serial data from one to another, and get serial data to-from a separate microcontroller.

Now I am trying to get some simple GPIO pins working from Python. The Adafruit example doesn’t seem to work (or perhaps it no longer applies with newer debian BBB).

At any rate, can someone tell me what to do to get P9.23 (GPIO_49) working?

Do I have to add some more entries in the file “/etc/default/capemgr” ?

Thank you for any suggestions.


At boot, the output of # cat /sys/devices/platform/bone_capemgr/slots is:

cat /sys/devices/platform/bone_capemgr/slots

0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1

In the file /etc/default/capemgr, I have no options passing to capemgr at boot (CAPE= is the only entry).

In the file /boot/uEnv.txt , I have deleted cape_universal=enable (uncommented line now reads cmdline=coherent_pool=1M net.ifnames=0 quiet )

If I then run config-pin overlay cape-universal I get:

cat /sys/devices/platform/bone_capemgr/slots

0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,cape-universal

If I then run the following two config-pin commands,
# config-pin P9.11 uart
# config-pin P9.13 uart
the pins for UART4 are enabled and it works from a Python script.

Now, I can use config-pin to setup GPIO pins as inputs, outputs, pulldown, pullup, high, low, etc,

the Adafruit_BBIO python library generated some error “Set gpio direction failed, missing file or invalid permissions.” last night, but when I went to duplicate it this morning (reboot), it worked.

Last night, I was running as root, tried using sudo, etc etc, still not sure about the permissions error.

But it is working now to toggle GPIO out and to set pins as input or output, except I still can’t get

to work the way I want.

Next Update…

Adafruit_BBIO python GPIO output seems to work, I can toggle voltage low or high, measure it on the multimeter, and see it in the show-pins utility.

Although the pins for input are getting set up properly through python Adafruit_BBIO according to the show-pins utility, I can’t get any GPIO input to actually detect either by polling or adding event.

Any thoughts?

Hi, are you still having issues this?

If so, please raise an issue in the github repo and I'll try to
reproduce and resolve the issue: