GPIO pins - how do they work

I’m trying to control the pins through /sys/class/gpio

for any pin N, I get

cpi@clockworkpi:~$ cd /sys/class/gpio
cpi@clockworkpi:/sys/class/gpio$ su root
Password:
root@clockworkpi:/sys/class/gpio# ls
export  gpiochip0  gpiochip352  unexport
root@clockworkpi:/sys/class/gpio# echo N > export
root@clockworkpi:/sys/class/gpio# ls
export  gpioN  gpiochip0  gpiochip352  unexport
root@clockworkpi:/sys/class/gpio# cat gpioN/direction
in
root@clockworkpi:/sys/class/gpio# echo out > gpioN/direction
bash: echo: write error: Unknown error 517
root@clockworkpi:/sys/class/gpio#

Sadly I get that error when I try to set pins to output mode. It may be possible to read the values of the pins. But how are the pins numbered? Looking at the mainboard schematic I believe our gpio diagram is the part called “debug.” I probed the gpios with a multimeter and the 3 and 5 volt levels correspond to the diagram. I don’t dare short two pins together to test if it’s reflected in cat gpioN/value.

What’s the next step in unlocking the secrets of clockwork pi gpio?

1 Like