_John
Posts: 8
Joined: Wed May 23, 2012 4:15 pm

Broken GPIO? -- How to test?

Tue Feb 12, 2013 1:57 pm

Hi.

I am a bit of electronics Newb and I have been trying to get my Rev1 Model B to light up an LED via GPIO.
I followed various tutorials floating through the interweb and I cannot get any to work, leading me to the thought that somewhere along the way I might have damaged the GPIO of my PI (I have tried several different pins).

What is the best way to test this? The PI works fine otherwise...

Thanks

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

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 2:10 pm

Do you have a resistor and a LED? What value is the resistor?

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 4:48 pm

To test them I'd write a script to turn them all on and off say twice a second and see what a multimeter across the pins says.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

drgeoff
Posts: 11224
Joined: Wed Jan 25, 2012 6:39 pm

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 4:59 pm

Unike an ordinary filament bulb, a LED only works when connected with the correct polarity. So, are you sure which lead is which?

If you only have one LED are you sure it is working? Connecting it and its series resistor to 5 volts (eg the RPi supply) will test it.
Quis custodiet ipsos custodes?

_John
Posts: 8
Joined: Wed May 23, 2012 4:15 pm

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 7:39 pm

Hi,

thanks for the initial hints, to answer the questions that arose:

a) I have a bag of LED's and I can get them to light up with a battery
b) I polarity I don't think is the issue in my tests

==> what simplest setup would you recommend I use to test with LED?

on multimeter what tests would you run exactly (please assume I can write the python code but no little (too little) about electronics :oops:

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

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 7:46 pm

What value resistor are you using in series with the LEDs?

_John
Posts: 8
Joined: Wed May 23, 2012 4:15 pm

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 7:52 pm

oh sorry joan, I forgot to answer I have a bags full of resistors (I ordered a "starter bag" for about a tenner from ebay) and the various diagrams have called for tutorials I have tried to follow have used different ones.

if you have an "idiot-like-me-proof" setup just assume I will have the right resistor and I have a chart to read the right colour codes ;)

thanks!!!

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 7:53 pm

Assuming you can write the code to make LEDs flash, use the same code and measure the voltage across where you connected the leds. It should be close to 0 when off and close to 3.3V when on. Be careful not to cross any pins with the meter probes. You could make some small paper tubes or something to drop over adjacent/dangerous pins (the 5V is dangerous)

It is imperative you use resistors with LEDS (on anything, not just the Pi). A value of 1k (brown black red) should be safe to keep the current to what the Pi can comfortably stand.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

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

Re: Broken GPIO? -- How to test?

Tue Feb 12, 2013 7:59 pm

pluggy wrote:Assuming you can write the code to make LEDs flash, use the same code and measure the voltage across where you connected the leds. It should be close to 0 when off and close to 3.3V when on. Be careful not to cross any pins with the meter probes. You could make some small paper tubes or something to drop over adjacent/dangerous pins (the 5V is dangerous)

It is imperative you use resistors with LEDS (on anything, not just the Pi). A value of 1k (brown black red) should be safe to keep the current to what the Pi can comfortably stand.
For a software test you could make gpio16 flash (the green activity LED on the Pi). If gpio16 flashes then just change 16 to the gpio actually being used.

@_John

A lot of problems are caused because of a mismatch between the gpio numbering schemes. It's worth double checking how the software you are using maps gpio numbers to pins.

_John
Posts: 8
Joined: Wed May 23, 2012 4:15 pm

Re: Broken GPIO? -- How to test?

Sun Feb 17, 2013 8:29 am

Hi all,
thanks for your replies.

I followed the lead of trying to steer the OK LED GPIO 16 and that does work after I flush the SD Card permissions from it as per this: http://www.raspberrypi.org/phpBB3/viewt ... 66#p136266

I have given the other GPIOs a try with a couple of LED but have not had any success...

I then tried to just light up an LED as per the first bit here:
https://projects.drogon.net/raspberry-p ... ingle-led/
+3.3V --> LED --> Resistor --> Ground

but nothing, so I am presuming that my pi just does not have any juice going out the GPIO....

any ideas?

PS I just checked the LED with a battery and it worked

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

Re: Broken GPIO? -- How to test?

Sun Feb 17, 2013 9:13 am

_John wrote:...
PS I just checked the LED with a battery and it worked
Perhaps it's not a LED but a small lamp like those found in Christmas lights?

_John
Posts: 8
Joined: Wed May 23, 2012 4:15 pm

Re: Broken GPIO? -- How to test?

Sun Feb 17, 2013 11:07 am

I am fairly sure that this is an LED on my breadboard....

:) Image

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

Re: Broken GPIO? -- How to test?

Sun Feb 17, 2013 11:32 am

_John wrote:I am fairly sure that this is an LED on my breadboard....

:) Image
Yes, that certainly looks like a LED.

Given you've connected everything up correctly then a problem with the software you're using seems likely.

_John
Posts: 8
Joined: Wed May 23, 2012 4:15 pm

Re: Broken GPIO? -- How to test?

Sun Feb 24, 2013 9:48 am

I dont know how likely this is but I am now thinking that gpio's / power rail(s) to the gpio's are defect (I have 2A phone charger as a power-supply that should be enough for a LED) .

I tried just lighting the LED up via a direct connection 3.3V -> LED -> resistor -> GND but the LED still did not light up...

Image

if anyone has any ideas left I would be grateful ..

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

Re: Broken GPIO? -- How to test?

Sun Feb 24, 2013 10:15 am

Try the 5V rail. I think it more likely that the LED has blown rather than the power rails or faulty.

drgeoff
Posts: 11224
Joined: Wed Jan 25, 2012 6:39 pm

Re: Broken GPIO? -- How to test?

Sun Feb 24, 2013 12:55 pm

_John wrote:I dont know how likely this is but I am now thinking that gpio's / power rail(s) to the gpio's are defect (I have 2A phone charger as a power-supply that should be enough for a LED) .

I tried just lighting the LED up via a direct connection 3.3V -> LED -> resistor -> GND but the LED still did not light up...

Image

if anyone has any ideas left I would be grateful ..
What colours on the resistor?
Quis custodiet ipsos custodes?

sloughin
Posts: 4
Joined: Sat Aug 16, 2014 5:27 pm

Re: Broken GPIO? -- How to test?

Sat Aug 16, 2014 5:41 pm

I am also having this problem. My RPi2 is working fine otherwise - I can boot up, use the network etc. My supply is the 1A usb phone charger supplied by CanaKit. The 5V - GND pins measure 4.98 VDC. However, the 3V3-GND pins measures only 0.55 - 0.63 VDC. When I hook up the LED ckt shown above, I can light the LED if I use the 5V pin as the + source, but not when I try the 3V3 pin as the + source. (which makes sense since for this yellow LED I'd expect a voltage drop of 2V or so).

Here's the result of issuing gpio readall, in case that helps anyone spot my problem. Should I just buy another RPi and use this one for non-GPIO applications?

Code: Select all

+-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 0 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |  28 |  17 | GPIO.17 | ALT2 | 0 | 51 || 52 | 0 | ALT2 | GPIO.18 | 18  | 29  |
 |  30 |  19 | GPIO.19 | ALT2 | 0 | 53 || 54 | 0 | ALT2 | GPIO.20 | 20  | 31  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+

drgeoff
Posts: 11224
Joined: Wed Jan 25, 2012 6:39 pm

Re: Broken GPIO? -- How to test?

Sat Aug 16, 2014 7:02 pm

sloughin wrote:However, the 3V3-GND pins measures only 0.55 - 0.63 VDC
An RPi would not even boot if the 3.3 volt rail were that low. Either you are not measuring what you think you are measuring or your meter is faulty or you are not using it properly. Between what two physical points are you measuring?
Quis custodiet ipsos custodes?

sloughin
Posts: 4
Joined: Sat Aug 16, 2014 5:27 pm

Re: Broken GPIO? -- How to test?

Sat Aug 16, 2014 8:04 pm

Thanks Dr Geoff.
You were correct. I had made the assumption that the cable supplied with the breakout connector would naturally face the exit slot on the case, but I was mistaken. A careful look at the circuit board shows that P1 of the GPIO is actually at the end closest to the SIMM card. When I connect the cable so that the red stripe edge is at the SIMM card end of the case (even though it that means I'll have to wrap it back over itself to get it out of the case) everthing works as advertised. Here's a photo of how it connects and with my LED lit (connected to 3V3 pin). Hi-res version here:

Image
Attachments
GPIOConnectionRaspPi.png
GPIOConnectionRaspPi.png (42.78 KiB) Viewed 7333 times

drgeoff
Posts: 11224
Joined: Wed Jan 25, 2012 6:39 pm

Re: Broken GPIO? -- How to test?

Sat Aug 16, 2014 8:44 pm

Is there a reason why you cannot swap the two ends of the cable? Then it will come out of the RPi case as you desire.
Quis custodiet ipsos custodes?

sloughin
Posts: 4
Joined: Sat Aug 16, 2014 5:27 pm

Re: Broken GPIO? -- How to test?

Sun Aug 17, 2014 2:15 am

Yes I was just now looking at that -- I had assumed that it would be correctly configured "out-of-the-box" but I see that I can detach the breakout board and then swap which end of the cable is connected to the pi and which to the board. Thanks again.

Return to “Troubleshooting”