On 22/01/18 17:21, Dennis Lee Bieber wrote:
> On Mon, 22 Jan 2018 16:32:24 +0000, RobH <
r...@despammer.com> declaimed the
> following:
>
>>>
>> I have exported the GPIO17 pin and it does show up ok, but when I do
>> echo echo out > direction OUT or out, I get
>> -bash: echo: write error: Invalid argument.
>
> You are running as root, are you not? You are also /in/ the gpio17
> subdirectory?
>
> Try with quotes around "out" (I noticed some differences being used in
> syntax between the web sites)
>
> (as root):
> echo "out" > direction
>
> Dug up my RPi-3, and running via a session from Putty:
>
> pi@raspberrypi:~$
> pi@raspberrypi:~$ sudo su root
> root@raspberrypi:/home/pi# cd /sys/class/gpio
> root@raspberrypi:/sys/class/gpio# ls
> export gpiochip0 gpiochip100 unexport
> root@raspberrypi:/sys/class/gpio# echo 17 > export
>
> Per the diagrams, GPIO17 is connector pin 11 (and pin 9 is ground)
>
> root@raspberrypi:/sys/class/gpio# ls
> export gpio17 gpiochip0 gpiochip100 unexport
> root@raspberrypi:/sys/class/gpio# cd gpio17
> root@raspberrypi:/sys/class/gpio/gpio17# ls
> active_low device direction edge subsystem uevent value
> root@raspberrypi:/sys/class/gpio/gpio17# ls -l
> total 0
> -rwxrwx--- 1 root gpio 4096 Jan 22 11:54 active_low
> lrwxrwxrwx 1 root gpio 0 Jan 22 11:54 device -> ../../../3f200000.gpio
> -rwxrwx--- 1 root gpio 4096 Jan 22 11:54 direction
> -rwxrwx--- 1 root gpio 4096 Jan 22 11:54 edge
> lrwxrwxrwx 1 root gpio 0 Jan 22 11:54 subsystem ->
> ../../../../../../class/gpio
> -rwxrwx--- 1 root gpio 4096 Jan 22 11:54 uevent
> -rwxrwx--- 1 root gpio 4096 Jan 22 11:54 value
> root@raspberrypi:/sys/class/gpio/gpio17# cat active_low direction edge
> uevent value
> 0
> in
> none
> 0
> root@raspberrypi:/sys/class/gpio/gpio17# echo out > direction
>
> No quotes needed in my test
>
> root@raspberrypi:/sys/class/gpio/gpio17# cat active_low direction edge
> uevent value
> 0
> outpi@raspberrypi:/sys/class/gpio/gpio17 $ sudo su root
root@raspberrypi:/sys/devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17#
echo out > direction out
bash: echo: write error: Invalid argument
root@raspberrypi:/sys/devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17#
echo out > direction "out"
bash: echo: write error: Invalid argument
root@raspberrypi:/sys/devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17#
> none
> 0
> root@raspberrypi:/sys/class/gpio/gpio17# echo 1 > value
> root@raspberrypi:/sys/class/gpio/gpio17# cat active_low direction edge
> uevent value
> 0
> out
> none
> 1
>
> DVM read 3.28V between connector pins 11 and 9 (Not easy holding the
> meter probes on the pins, especially as my unit is in a case and the access
> slot isn't that wide)
>
> root@raspberrypi:/sys/class/gpio/gpio17# echo 0 > value
> root@raspberrypi:/sys/class/gpio/gpio17# cat active_low direction edge
> uevent value
> 0
> out
> none
> 0
>
> DVM read 0.00V between connector pins 11 and 9
>
> root@raspberrypi:/sys/class/gpio/gpio17# cd ..
> root@raspberrypi:/sys/class/gpio# echo 17 > unexport
> root@raspberrypi:/sys/class/gpio#
>
>
> {Note: My SD card is still running a Jessie release; I need to spend a day
> reflashing and configuring the latest Raspbian, which I think is now up to
> Stretch}
>
I wasn't running as root but now I am, and this what I got:
pi@raspberrypi:/sys/class/gpio/gpio17 $ sudo su root
root@raspberrypi:/sys/devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17#
echo out > direction out
bash: echo: write error: Invalid argument
root@raspberrypi:/sys/devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17#
echo out > direction "out"
bash: echo: write error: Invalid argument
root@raspberrypi:/sys/devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17#
What am I missing.
For measuring the voltage on the pins, I just used jumper wires as it
was a lot easier than trying it on the pins.