joan wrote:GPIO 27 was not connected to the expansion header on early Pis. Which model Pi are you testing on?
I use a Model B rev 2.0, but that's not the problem, it's me!
When I was preparing some more information for you, I found my goof!
This is what I normally do by using the code I showed to
gregeric in the post above.
It is a piece of code that is part of a daemon installed in /etc/init.d, and runs at root level.
I use this to see if I have a certain interface connected to the P-1 header, to determine if I need to install a supporting program that runs as a daemon or not. Kinda like a "Hat" detection. I typically tie one GPIO pin high, and test for that. Normally, the daemon code checks the hardware before my Python application starts, so I can use the particular pin twice. Once for the daemon to check, and further on in my program that gets launched as a result of the "Hat" test. Normally works great.
However, this is the response I got:
pi@raspberrypi ~ $ port27=""
pi@raspberrypi ~ $ sudo sh -c "echo '27' > /sys/class/gpio/export"
pi@raspberrypi ~ $ sudo sh -c "echo 'in' > /sys/class/gpio/gpio27/direction"
sh: 1: cannot create /sys/class/gpio/gpio27/direction: Directory nonexistent
pi@raspberrypi ~ $
And that put me on the wrong track. The outdated Wiki page didn't help either, so I continued to dig in the wrong direction.
What I overlooked (face getting red fast) is that I already use GPIO-27 in /boot/config.txt
Code: Select all
# start/stop application needs a power_off signal to cut power to the Pi
dtoverlay=gpio-poweroff,gpiopin=27,active_low
The overlay gets loaded first and blocks the port, as it should be, of course!
Problem solved!
Thank you two for helping me to get back to earth.