My Raspberry Pi3 is dead or dying.

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.

Reply to
RobH
Loading thread data ...

On Mon, 22 Jan 2018 16:32:24 +0000, RobH declaimed the following:

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 out 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}

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

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#

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.

Reply to
RobH

How do I find out if it is installed or not, and if not, should I install it.

Reply to
RobH

If you just type gpio in a terminal window and press return, if it's installed it'll give you some usage information, if not installed it'll complain no command found.

Reply to
Andy Burns

On Mon, 22 Jan 2018 17:42:02 +0000, RobH declaimed the following:

Try "cd" back to /sys/class/gpio/gpio17

You seem to be in the device directory, not the class directory

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

Yes it is installed as I did get some usage information

Reply to
RobH

I have just measured the voltage on GPIO17 and it is still as it was before at 0.06 volts.

Reply to
RobH

On Mon, 22 Jan 2018 18:53:35 +0000, RobH declaimed the following:

Measurement of the pins is meaningless without knowing that /direction and /value were set properly. The default state seems to be INput with the pin pulled down to ground (value shows 0).

And /that/ requires being able to control things from the command line. Until you can successfully set /direction to out, and /value to 1, the pin voltage is expected to be near ground (except for the two pins that are pulled high)

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

Direction and value are set

root@raspberrypi:/sys/class/gpio/gpio17# echo out > direction root@raspberrypi:/sys/class/gpio/gpio17# echo 1 > value root@raspberrypi:/sys/class/gpio/gpio17#

I also tried: >>> GPIO.setup(17, GPIO.OUT) >>> GPIO.output(17, GPIO.HIGH)

To get it give 3.3 volts, but it didn't

Reply to
RobH

Fairy Nuff, I was going by two of the Pi's here that had Raspbian Lite installed on them before Christmas by downloading the image and copying to card.

--
Cheers 
Dave.
Reply to
Dave Liquorice

WiringPi?

That'll be why I don't have wiringPi on two Oi's here, I use Lite...

I was sort of hoping for "command not found" but getting useage info when no parameters are supplied or just returning to the prompt shows that gpio is there.

The last very slim straw to grasp is the parameters for gpio being correct for the GPIO and that the LED is connected to the correct pin for that GPIO.

If the OP only wants to flash one LED, then hopefully one of the other GPIO's will work.

--
Cheers 
Dave.
Reply to
Dave Liquorice

On Mon, 22 Jan 2018 20:22:09 +0000, RobH declaimed the following:

But you did not read them back out to confirm the chip thinks they are set...

cat direction cat value

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

Open a terminal and type:

gpio -v

It ought to read 2.44 (or greater) if wiringPi is installed. If it's not installed, then:

sudo apt-get install wiringpi

will get it for you. (Assuming Raspbian or a Raspbian derived system)

The command:

gpio readall

will always give you a handy print out of the GPIO connector with the

3 different pin numbering schemes. wiringPi by default uses it's own numbering scheme, but with the -g flag to the gpio program it uses the native gpio pin numbers and with the -1 flag it uses the physical pin numbers (On the original Pi the connector was marked P1, hence the -1 flag)

Pin numbering can be confusing, see this:

formatting link

The best pin out site is the Pimoroni one at

https://pinout.xyz/

A very simple way to get/test a pin with an LED is 'blink', see here:

formatting link

I would strongly suggest that newbies do not jump into code, nor that they try to use the sysfs interface either when starting out - it's just too much to do, learn and get wrong - this one command is all you need:

gpio -g blink 17

to test an LED on BCM_GPIO pin 17, wiringPi pin 0, physical pin 11.

Gordon (wiringPi author)

Reply to
Gordon Henderson

Now according to wiringPi, when I do a gpio readall, I get the following for pin 17:

BCM 17 wPi 0 Name GPIO. 0 Mode OUT Physical 11

So Pin 11 is set to OUT as I read it.

Reply to
RobH

Thanks for the information about wiringPi, and yes it is already installed on my Pi3. Interestingly when I do a gpio readall, it shows that:

BCM 17 wPi 0 Name GPIO. 0 Mode OUT. Physical 11

All the other pins are shown as Mode IN.

Reply to
RobH

On Tue, 23 Jan 2018 10:10:14 +0000, RobH declaimed the following:

Which implies that something executed a mode OUT setting...

But what does any of:

gpio -g read 17 gpio read 0 gpio -1 read 11

produce. Readall appears to merely report the direction, the chip pin, the header pin, and the WiringPI number&name. Unless the pin, in OUT mode, comes back as high (1) internally the physical pin will measure near GND level. If it does read back as high, and the physical pin is still near GND, you may have a bad chip -- in that the pin driver is not providing a signal... Double check by setting mode IN, jumpering pin first to ground and reading it (should be low/0), then jumper to 3.3V [DO NOT TOUCH 5V with the jumper] and again reading (should be high/1).

If I had physical access, I'd probably do a verification run by writing

0, measuring all pins relative to ground, then writing 1 and measuring all pins again -- looking for any pin that changed value. If a pin changes value -- stay on that pin with the meter and alternately command the system to 0 and 1 to see if the value follows the commanded writes.
--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

All of the above commands return 0

I set the direction to IN then did gpio readall which shows the gpio17 pin as IN and 0 voltage.

Then I connected the positive jumper wire to the 3.3 volt pin, and then measured th voltage across the positive and ground wires, which was 3.28 Volts.

Reply to
RobH

Hm.

The Pi (or any electronic device) will only draw what it needs. You could use a 5v, 1000 amp PSU on a Pi and it'll be fine.

The Pi v2 and v3 both have a 2.5 amp polyfuse (self resetting) on the

5v input.

Additionally the USB system has an overall current limit of 1.2 amps - this is limited by a little bit of electronics (switchable from 0.6 amps to 1.2 amps on the v2, but not switchable on the v3). You can pull 1.2 amps out of one USB socket or spread over all 4.

The 5v power output on the GPIO pin has no separate limiter (other than the input polyfuse) and there it is possible to 'crowbar' the Pi and cause it to powerdown/reboot if you short the 5v to 0v. The input fuse is there to stop the PCB melting.

What you don't have much protection from is connecting the 5v signal directly to a GPIO pin - then you have 5v going into a 3.3v system. If the 3.3v pin is set to output then you can destroy the output driver (and possibly other things too). You mostly get away with it if the pin is set to input mode.

Gordon

Reply to
Gordon Henderson

gpio readall does a read of the pin as well as it's direction. Look at the 'V' column. V for Value.

The thing you can't read the state of is the internal pull up/down resistors. These are write only.

Gordon

Reply to
Gordon Henderson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.