JumpMaster
Posts: 5
Joined: Sat Nov 30, 2013 9:19 pm

Which gpio pins have pull-up/down resistors?

Sat Nov 30, 2013 9:24 pm

Hi all,

I'm testing inputs on the pi and even when activating the pull-up resistors I get 100's of high/low changes per second.

I've tried all pins and the only couple that work are the I2C pins, GPIO 0/1 or GPIO 2/3 for those of you with a revision 2 board. I know these have pull-up resistors permanently attached.

Does owning a revision 1 board make a difference here?

Thanks for any help,
Kev

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

Re: Which gpio pins have pull-up/down resistors?

Sat Nov 30, 2013 10:35 pm

All 54 gpios have internal pull-up/down resistors which may be set programmatically.

The user accessible* ones, with the exception of SDA/SCL should all work as expected. Perhaps your testing is faulty?


* User accessible
rev.1 board gpios 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25
rev.2 board gpios 2, 3, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 22, 23, 24, 25, 27, 28, 29, 30, 31

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Which gpio pins have pull-up/down resistors?

Sat Nov 30, 2013 10:53 pm

The behaviour of pins going up and down is normally due to having no pull-up resistors.

Enabling pull-ups is what I do to STOP spurious state changes.

is this happening with your RPi just sitting there with nothing attached or is it when you've got something plugged into it?

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter


JumpMaster
Posts: 5
Joined: Sat Nov 30, 2013 9:19 pm

Re: Which gpio pins have pull-up/down resistors?

Sat Nov 30, 2013 11:55 pm

Yes I'm trying to use the pull-up function correctly. I'm programming in ruby using pi_piper. After setting a pin as input/pull-up I attach it to earth using a 20cm cable. When removing it from earth I get the floating on/off while the wire is indeed floating. It's a pretty basic test.

Anyway to confirm that pi_piper is setting the pull_up correctly?

I'm doing this on Raspbian btw.

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

Re: Which gpio pins have pull-up/down resistors?

Sun Dec 01, 2013 12:04 am

In effect you connect a 20cm aerial to the gpio?

The pull-up/downs are of the order of 60Kohms.

There is no software read-back of the pull up/down setting.

The most likely explanation is the software is setting the pull-up on a different gpio to the one you expected. Personally I only use Broadcom gpio numbers. Depending on the software you use it may be referring to pin numbers, Broadcom gpio numbers, or "logical" gpio numbers.

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Which gpio pins have pull-up/down resistors?

Sun Dec 01, 2013 12:17 am

And a 20 cm loose wire in a hostile EM environment might over-come the software pull-ups :(
You might have to use real resistors :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

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

Re: Which gpio pins have pull-up/down resistors?

Sun Dec 01, 2013 11:03 am

I have done an experiment which demonstrates the amount of mutual interference that there can be between gpios. It may all be down to my poor wiring techniques (ribbon cable, unshielded wires etc.).

http://www.youtube.com/watch?v=IHqaM9hdgJ0

Only one gpio (22) is being actively driven.

In the later part of the video a 20 cm wire is inserted in gpio 25 and a nice regular square wave appears (10ms on, 10 ms off, mains hum?).
Last edited by joan on Fri Dec 20, 2013 10:32 am, edited 1 time in total.

JumpMaster
Posts: 5
Joined: Sat Nov 30, 2013 9:19 pm

Re: Which gpio pins have pull-up/down resistors?

Sun Dec 01, 2013 11:19 am

I was thinking there maybe interference from other pins too. I'm using 14 pins in my project. 8 connected to a relay module and 6 used as inputs. I'm designing a PCB using fritzing (awesome app BTW!) so have now included some external pull up resistors. It seems that a 10k pull up is pretty normal? Just need to work out if [email protected] is too much for the pi.

Thanks for your help guys.

User avatar
Burngate
Posts: 5892
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Which gpio pins have pull-up/down resistors?

Sun Dec 01, 2013 11:47 am

JumpMaster wrote:... It seems that a 10k pull up is pretty normal? Just need to work out if [email protected] is too much for the pi...
10k @ 3v3 gives 0.33mA
So 6 x 10k gives 1.98mA - well within the nominal 50mA budget.
Though it will depend on what else is drawing current.

User avatar
rpdom
Posts: 14483
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Which gpio pins have pull-up/down resistors?

Sun Dec 01, 2013 11:48 am

10K resistors would be fine as pull-ups. At most they would take (3.3 V/10,000 Ohms = 0.00033 A) 0.33mA each, which is about 2mA for 6 - well within what is allowed from the GPIOs.

... and Burngate beat me to it :)

JumpMaster
Posts: 5
Joined: Sat Nov 30, 2013 9:19 pm

Re: Which gpio pins have pull-up/down resistors?

Sun Dec 01, 2013 11:53 am

Thanks guys.

Nothing else drawing current from the 3.3v rail. The relay module has it's own 5v power supply for the relays themselves, and uses 5v from the pi for the circuitry activating the relays.

It's all coming together nicely :D

Return to “General discussion”