Page 1 of 1

All my GPIO pins are connected together

Posted: Sun Mar 23, 2014 10:35 pm
by JPDefault
Hello gents.

I'll say in advance that I don't poke at the GPIO pins directly. I always use jumpers.

Now, I've got a model B rev 1 board, and the issue is: all my GPIO pins seem to be connected together (with a very small resistance around 200 Ohm).

Image
I haven't tested them ALL, but so far GPIO 0, 1, 4, 7, 8, 9, 10,11, 24, 25 are all connected together as soon as I plug the power cable. Oddly enough, if there is no SD card then GPIO 7 gets disconnected.
All power pins and grounds work as expected.

So, what did I break? And how? :o

Re: All my GPIO pins are connected together

Posted: Sun Mar 23, 2014 11:00 pm
by FLYFISH TECHNOLOGIES
Hi,
JPDefault wrote:all my GPIO pins seem to be connected together (with a very small resistance around 200 Ohm).
Seem to ?
Do you see any resistors soldered to the GPIO pins ?

How do you know the resistance is 200 Ohms ?
I hope that you don't use ohm meter and measure resistance between GPIO pins...

JPDefault wrote:GPIO 0, 1, 4, 7, 8, 9, 10,11, 24, 25 are all connected together as soon as I plug the power cable.
Please describe your measurement method.

JPDefault wrote: Oddly enough, if there is no SD card then GPIO 7 gets disconnected.
Disconnected from what ?


Best wishes, Ivan Zilic.

Re: All my GPIO pins are connected together

Posted: Sun Mar 23, 2014 11:47 pm
by JPDefault
Hi Ivan.

Thank you for your answer, and sorry for not being clearer in my previous post.

To clarify, this is what I am doing: http://learn.adafruit.com/retro-gaming- ... pi/buttons
The only difference is that I used GPIO 8 and 11 instead of 17 and 23 so I only had to modify retrogame.c slightly.

How do I know they are all connected together? When I press a button, all other buttons are pressed too.

I even feared that for some reason I had all buttons connected together in my joystick, so I unplugged it and used a multimeter on the joystick plug to make sure all was fine on that side.

Note that the arcade stick is quite simply a bunch of momentary switches (normally open) with a common ground.

P.S. To answer your last question, "disconnected" from the other GPIO pins.

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 12:10 am
by FLYFISH TECHNOLOGIES
Hi,
JPDefault wrote:Thank you for your answer, and sorry for not being clearer in my previous post.
Ok, you gave more information... Being very descriptive helps, because we don't have to guess or assume much.
Can you provide further details (what and how you measure) to avoid misunderstandings ?


Best wishes, Ivan Zilic.

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 12:55 am
by mahjongg
no your GPIO pins are NOT "connected together"!

But if all of them are programmed to output a "1" (or for that matter a "0") they are all connected to the same power rail, but thats not the same thing as being (permanently) connected together.
Anyway, the default behavior would be for them to be inputs, which essentially gives them a high input impedance, except for the fact that they have ESD diodes that connect them to both the VCC rail and (for opposite current directions) to the GND rail.

But the clincher is that all your measurements with "power on" are invalid, as doing "ohms measurements" on a system that has voltages on them makes the measurements in fact invalid.

Ohms measurements cannot be performed on a system that is energized, only on systems that do not receive external energy.

measuring conductivity (ohms) on a live system gives invalid results!

that is because any conductivity measurement is actually performed by either:
  1. Putting a small voltage on the object to measure and measuring the current that consequently runs through it,

    OR
  2. Running a small current trough the measured object and measuring the voltage that falls over it
you can imagine that if a voltage is already over the measured object, (or a current is already running through it) it invalidates that measurement!

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 10:17 am
by JPDefault
Hello gents, thank you for all your answers again.

I am not measuring the resistance between two GPIO pins when the system has power.
I did measure the voltage on them though (just to make sure, and the read was 3.2V pretty much as expected).
Then I only used an ohmmeter on the unplugged joystick to make sure the pins were not shorted before connecting it to P1 using jumper wires.

So, back on topic, this is how I connect to the joystick:
Image
which is pretty much the same as Adafruit's guide.

This is the "driver": https://github.com/adafruit/Adafruit-Re ... etrogame.c
...and the only part I had to change is the actual mapping:

Code: Select all

struct {
	int pin;
	int key;
} io[] = {
	{ 25,      KEY_LEFT     },
	{ 10,      KEY_RIGHT    },
	{  7,      KEY_UP       },
	{  8,      KEY_DOWN     },
	{ 11,      KEY_LEFTCTRL },
	{  9,      KEY_LEFTALT  }
};
Note that internal pullups are enabled around line 250.
It also does this to configure the pins via sysfs:

Code: Select all

if(pinConfig(io[i].pin, "direction", "in") ||
			   pinConfig(io[i].pin, "edge"     , "both"))
				err("Pin config failed");
Seems ok to me, and if I connect only one switch to, let's say GPIO 7, that works and I get a KEY_UP when the circuit is closed.

The issue is: if another switch is connected, let's say to GPIO 8 and common ground (P1-25), and I close it... instead of getting just KEY_DOWN I also get KEY_UP as if the other switch was closed too.
If I connect all the switches and close just one, I gett ALL the KEY_* events at the same time, as if I had pressed all buttons.

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 12:32 pm
by evil_dan2wik
Unplug your buttons and test a button output with your ohmmeter and push a button that shouldn't be connected to it. It sounds like all the outputs of the buttons are connected together.

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 1:22 pm
by pluggy
Measuring the resistance between pins is entirely meaningless.

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 1:40 pm
by JPDefault
pluggy wrote:Measuring the resistance between pins is entirely meaningless.
My first post seemed to suggest that I was doing somethig like that, but that is not the case. Sorry about the confusion.

What I am doing is connecting switches to the pins, and when I push a switch the result is as if all other switches were being pushed as well.

As I said, I did measure the voltage. I put a probe on the switch (GPIO pin side) and the other on the ground rail: 3.2V alright.
If I pushed that switch where the probes are, that would become 0V of course.
But instead I pushed another switch, and the voltmeter showed a very low value, like 0.1V on the open switch.

I hope this makes more sense.

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 1:53 pm
by PiGraham
Have you measured the voltages on the GPIO pins when you close each of the swtiches?

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 2:09 pm
by FLYFISH TECHNOLOGIES
Hi,
JPDefault wrote:I am not measuring the resistance between two GPIO pins when the system has power.
You must not even when the system doesn't have power...


Let's split the system to some blocks and narrow down the issue location...

1) Verify that the joystick switches equal to its schematics:
- disconnect joystick from a circuit and take ohmmeter
- measure resistance (distinct only between infinite and very small) between each pins
- check that when one button is pressed, the resistance drops only between common pin and the related position switch's output (measure also resistances between all un-pressed switches)
** At this point you can approve or remove your joystick from the suspicious candidates list

2) Verify the GPIO levels:
- leave joystick disconnected, use a jumper wire instead
- shorten one GPIO applicable pin (eg. "Up" input) and check voltages on this pin (before and after shorted) and also voltage levels on all other (unshorted) GPIO pins planned for joystick connection
- repeat previous step for all other position GPIO inputs
** At this point you found out if your GPIO port is broken or not. If not, you now can set focus to your code...


Best wishes, Ivan Zilic.

Re: All my GPIO pins are connected together

Posted: Mon Mar 24, 2014 7:41 pm
by JPDefault
PiGraham, Ivan, thanks again for your input.

There is definitely something dodgy with the stick.

I've tested the individual pins on the unplugged joystick again and all was fine. If I move it up, only the "up" pin is shorted and so on.

Then I proceeded as Ivan suggested and probed the pins with a voltmeter when the joystick was plugged.
If I move it up the meter goes from 3.1v to 0v as expected. If I press the "A" button it stays at 3.1v still as expected.
But if I press down, left or right then it reads 0.7v!

Lastly, I've unplugged the stick and shorted GPIO 8 ("down") while reading the voltage on GPIO 7 ("up"). This time it was a steady 3.1v - as it should.

So, something wrong with the stick, don't you reckon? Probably the pad is touching all four switches slightly, not enough for my multimeter to detect it - unless there is enough current/voltage applied.

I'll try with another stick and I'll let you know if that worked.

Re: All my GPIO pins are connected together

Posted: Thu Mar 27, 2014 12:13 pm
by JPDefault
Hey guys, I've received a new stick now and I can confirm that was the issue, so problem solved (thanks to all again).

As a beginner in this field, I'm happy that I've learnt a valuable lesson.

There's just one more thing I'd like to understand, if any of you illuminated experts don't mind to share a bit of their knowledge:
FLYFISH TECHNOLOGIES wrote:You must not even when the system doesn't have power...
Why can't I probe a non-powered circuit? If I can't use my multimeter on a powered on circuit, neither on a powered off one, that means I've got no use for it at all...
Or does this rule only apply to the Raspberry Pi (and why)?

Cheers!
JPD

Re: All my GPIO pins are connected together

Posted: Thu Mar 27, 2014 1:25 pm
by klricks
JPDefault wrote:Hey guys, I've received a new stick now and I can confirm that was the issue, so problem solved (thanks to all again).

As a beginner in this field, I'm happy that I've learnt a valuable lesson.

There's just one more thing I'd like to understand, if any of you illuminated experts don't mind to share a bit of their knowledge:
FLYFISH TECHNOLOGIES wrote:You must not even when the system doesn't have power...
Why can't I probe a non-powered circuit? If I can't use my multimeter on a powered on circuit, neither on a powered off one, that means I've got no use for it at all...
Or does this rule only apply to the Raspberry Pi (and why)?

Cheers!
JPD
Yes you use an Ohm meter with power off. BUT you can only measure discrete components like resistors and diodes or do continuity or short/open tests. However you can't measure resistance between IO pins on a complex chip and get any meaningful information.

Also I don't know if you are aware that many joysticks have 8 positions where moving the stick to 45 degree positions will close 2 switches at the same time.

Re: All my GPIO pins are connected together

Posted: Thu Mar 27, 2014 1:46 pm
by JPDefault
Thanks for your answer, klricks.
klricks wrote: Yes you use an Ohm meter with power off. BUT you can only measure discrete components like resistors and diodes or do continuity or short/open tests. However you can't measure resistance between IO pins on a complex chip and get any meaningful information.
That'd be my purpose: see if something is shorted while it shouldn't be.
But Ivan, who seems very knowledgeable, told me I shouldn't... only that I still don't know why.
klricks wrote: Also I don't know if you are aware that many joysticks have 8 positions where moving the stick to 45 degree positions will close 2 switches at the same time.
Yes, this particular stick has a big pad over the contacts (it's not the "clicky" type if you know what I mean). It's supposed to close 2 switches at the same time for diagonal movements, but if the pad moves a bit too much it will close all switches at the same time.

Re: All my GPIO pins are connected together

Posted: Thu Mar 27, 2014 2:13 pm
by FLYFISH TECHNOLOGIES
Hi,
JPDefault wrote:Why can't I probe a non-powered circuit?
A quick answer would be that you're not sure what you're measuring.

There are some exceptions (but there are not lot of them), where measuring resistance of non-powered circuit makes sense. The first general prerequisite is that you can perform measurements of non powered circuits only when the circuit contains only discrete components (but read below).
Even a simple semiconductors (transistors, diodes) have non-linear characteristics, so measuring their resistance is questionable. Additionally, circuits with chips are complex elements - you can ask yourself what is actually the input... ?
For a diode the answer is easy: it is a PN junction. Chip input is much more than that... for example, if you "measure resistance" of the chip input, you're applying a voltage to (at least) two protection diodes, probably a pull up/down resistors (which are not classical resistors, but semiconductor elements), some signals conditioning elements, etc. If you assume that an ohmmeter has 1.5V battery, then one of the mentioned protection diodes starts to conduct if you perform resistance measurement. So, you're actually not measuring any kind of a resistance, but (your multimeter is) assuming something based on a current which protection diode is passing...
JPDefault wrote:If I can't use my multimeter on a powered on circuit, neither on a powered off one, that means I've got no use for it at all...
On powered circuit it (generally) makes sense only to measure voltage (we're discussing here about multimeters only). This is safe and I don't believe that you'll have any circuit on your desk where measuring voltage when the circuit is powered would harm it.

For measuring various currents of the powered circuit you have to "break" one of existing paths and then perform measurement. So, you have to "modify" a circuit during current measurement.

Measuring a resistance makes sense only when one pin of the component is not connected anywhere. That is a guarantee that the current form the ohmmeter is flowing just trough this component. Therefore, if you have a discrete resistor in the circuit and you'd like to measure its resistance, you'd have to desolder one its pin and then perform measurement (on non powered circuit). Without desoldering the pin, you have to take a deep look at circuits first and understand them... as said, you have to be sure what is the current path when you perform the measurement...
JPDefault wrote:Or does this rule only apply to the Raspberry Pi (and why)?
This is applicable to all circuits.


Best wishes, Ivan Zilic.

Re: All my GPIO pins are connected together

Posted: Thu Mar 27, 2014 2:34 pm
by JPDefault
Thanks Ivan, very kind and patient :)
There was a misunderstanding at first as it could be expected with a newb like me, but it's alot clearer now!