momoaux
Posts: 11
Joined: Fri Aug 19, 2016 11:37 am

GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 7:10 am

Hello,
I'm using a Raspberry Pi 3
I have connected GPIO04 with an external pull-up (1,8KR) to +3,3V.
I have attached a button between GPIO4 and GND

The button press is recognized.

After about 20 Hours and hundreds off button klicks, the button suddenly stopped working.
I checked the pin and it seems dead.

I tested with:
http://elinux.org/R-Pi_Troubleshooting#Testingrpi gpio dead

The results are that PIN 3,4 and 5 failed.

there is no 5V involved.
No other Power sources.
Only 3,3V pin, pull-up and the button.

In my setup I'm using the GPIO Pins 4,17,18, 22, 23, 24, 25, 27 all with external pull-ups and buttons, nothing else.
All other pins work and keep on working after pin 4 is dead.

Do you have any hints for me?


The same happened on another Pi so It's repeatable.

Aydan
Posts: 727
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 7:43 am

How long is the cable from the pi to your button?
Are you using the 3.3V from the IO header?

Regards
Aydan

momoaux
Posts: 11
Joined: Fri Aug 19, 2016 11:37 am

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 8:08 am

The cable is about 20m long (using a cat5 cable).
Yes, the 3.3V from PIN1 of the GPIO Header.

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 8:21 am

Can you confirm that you had nothing connected to the 40 pin expansion header when you ran the test?

The actual test output may also be useful.

momoaux
Posts: 11
Joined: Fri Aug 19, 2016 11:37 am

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 8:51 am

Yes, nothing was connected during the test.

Here the complete output:
This program checks the Pi's (user) gpios.

The program reads and writes all the gpios. Make sure NOTHING
is connected to the gpios during this test.

The program uses the pigpio daemon which must be running.

To start the daemon use the command sudo pigpiod.

Press the ENTER key to continue or ctrl-C to abort...

Testing...
Write 1 to gpio 3 failed.
Pull up on gpio 3 failed.
Write 0 to gpio 4 failed.
Pull down on gpio 4 failed.
Write 1 to gpio 5 failed.
Pull up on gpio 5 failed.
Skipped non-user gpios: 0 1 28 29 30 31
Tested user gpios: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Failed user gpios: 3 4 5

Aydan
Posts: 727
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 9:43 am

momoaux wrote:The cable is about 20m long (using a cat5 cable).
Yes, the 3.3V from PIN1 of the GPIO Header.
The long cable is most likely your problem:
cat 5 has a significant inductive and capacitive component. Pushing the button will create a wavefront in the cable and this will then reflect on the pi side into a negative voltage. This most likely killed your pin.
I just did a rough simulation with LTspice, and the effect is very visible.
Add a 10nF capacitor between GND and IO pin, and a 100Ohm resistor between the IO pin and the pullup/cable. This will remove the "ringing" when pressing the button.

THe forum won't let me upload txt or asc files so:
copy this code into a file (*.asc) for use with LTspice

Code: Select all

Version 4
SHEET 1 1116 680
WIRE -192 64 -256 64
WIRE 160 64 -192 64
WIRE -256 112 -256 64
WIRE 16 144 -80 144
WIRE 64 144 16 144
WIRE 160 144 144 144
WIRE 192 144 160 144
WIRE 480 144 288 144
WIRE 560 144 480 144
WIRE 624 160 608 160
WIRE 704 160 640 160
WIRE 192 176 -16 176
WIRE 496 176 288 176
WIRE 704 176 704 160
WIRE 640 208 640 160
WIRE 640 208 608 208
WIRE -256 224 -256 192
WIRE -256 224 -272 224
WIRE -80 224 -80 208
WIRE -80 224 -256 224
WIRE -16 224 -16 176
WIRE -16 224 -80 224
WIRE -272 240 -272 224
WIRE 496 240 496 176
WIRE 560 256 560 224
WIRE 624 256 624 160
WIRE 624 256 560 256
WIRE 704 256 624 256
WIRE 560 272 560 256
FLAG -272 240 0
FLAG 496 240 0
FLAG 560 272 0
FLAG 16 144 GPIO
FLAG 480 144 Button
FLAG -192 64 N0
SYMBOL voltage -256 96 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 3.3
SYMBOL res 144 48 R0
SYMATTR InstName R2
SYMATTR Value 1.8k
SYMBOL sw 560 128 M0
SYMATTR InstName S1
SYMATTR Value MYSW
SYMBOL voltage 704 160 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value PULSE(0 2 1m 1n 1n 1m 20m)
SYMBOL cap -96 144 R0
SYMATTR InstName C1
SYMATTR Value 10n
SYMATTR SpiceLine Rser=1
SYMBOL ltline 240 160 R0
SYMATTR InstName O1
SYMATTR Value 20mcable
SYMBOL res 160 128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 100
TEXT -384 264 Left 2 !.tran 10m
TEXT -192 -176 Left 2 !.model MYSW SW(Ron=1 Roff=1Meg Vt=1 Vh=.5)
TEXT -168 -120 Left 2 !.model 20mcable LTRA(len=20 r=22m l=.7u c=33p)
Regards
Aydan
Last edited by Aydan on Thu Oct 27, 2016 9:49 am, edited 1 time in total.

momoaux
Posts: 11
Joined: Fri Aug 19, 2016 11:37 am

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 9:44 am

Thank you very much, I'll test that and report back.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 9:45 am

With a 20m cable, its quite possible, certainly in an electrically noisy surrounding, that due to inductive noise a voltage peak can appear at the GPIO that causes a latch up that destroys the GPIO transistors.
I would add an opto-isolator close to the PI, for all cables longer than half a meter or so.

Aydan
Posts: 727
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 9:51 am

mahjongg wrote:With a 20m cable, its quite possible, certainly in an electrically noisy surrounding, that due to inductive noise a voltage peak can appear at the GPIO that causes a latch up that destroys the GPIO transistors.
I would add an opto-isolator close to the PI, for all cables longer than half a meter or so.
No need for an optoisolator, and it's not the noisy surrounding, but the fast transient from the switch that is a problem.

Regards
Aydan

momoaux
Posts: 11
Joined: Fri Aug 19, 2016 11:37 am

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 10:00 am

Aydan wrote:100Ohm resistor between the IO pin and the pullup/cable.
I don't get it :-)

Cap between GND and GPIO is clear.

but resistor between GPIO and pullup (would be another pullup) or in the line between the gpio and where the button is attached to limit the current?

The button pulls the GPIO to GND. I'm waiting for a falling flank.

Aydan
Posts: 727
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 10:08 am

momoaux wrote:
Aydan wrote:100Ohm resistor between the IO pin and the pullup/cable.
I don't get it :-)

Cap between GND and GPIO is clear.

but resistor between GPIO and pullup (would be another pullup) or in the line between the gpio and where the button is attached to limit the current?

The button pulls the GPIO to GND. I'm waiting for a falling flank.
100 ohm between GPIO and pullup is not another pullup, it becomes a filter with the capacitor.

Code: Select all

        3.3V o-----
                  |
           1.8K  | |
                  |
   GPIO o----==---o----- cable
        |  100R
        = 10nF
        |
       GND

momoaux
Posts: 11
Joined: Fri Aug 19, 2016 11:37 am

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 11:08 am

Got it, thank you :-)

Would it be the same to put the resistor closer to the button or does it have to be close to the cap or GPIO?
Last edited by momoaux on Thu Oct 27, 2016 11:13 am, edited 1 time in total.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 11:11 am

Aydan wrote:
mahjongg wrote:With a 20m cable, its quite possible, certainly in an electrically noisy surrounding, that due to inductive noise a voltage peak can appear at the GPIO that causes a latch up that destroys the GPIO transistors.
I would add an opto-isolator close to the PI, for all cables longer than half a meter or so.
No need for an optoisolator, and it's not the noisy surrounding, but the fast transient from the switch that is a problem.

Regards
Aydan
Yeah, if the lead is long enough, and enough current loops through it, then if it has sufficient induction, it will cause ringing, with the same effect, latchup.

Aydan
Posts: 727
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: GPIO Dead after 20 Hours runtime

Thu Oct 27, 2016 11:33 am

momoaux wrote:Got it, thank you :-)

Would it be the same to put the resistor closer to the button or does it have to be close to the cap or GPIO?
The R-C-Combination has to be very close to the GPIO. FOr noise reasons and otherwise you'd have a voltage divider between the button and 3.3V.

Regards
Aydan

Return to “Troubleshooting”