headamage
Posts: 75
Joined: Wed Jan 07, 2015 9:59 am

GPIO update problem

Fri Jan 09, 2015 12:36 pm

Hi everyone,

The recent update for raspbian also included some GPIO packges that seem to have changed something in the Pi.
I am now getting the following warning for GPIO pins 2 and 3 only.

RuntimeWarning: A physical pull up resistor is fitted on this channel!

What is this about?

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

Re: GPIO update problem

Fri Jan 09, 2015 12:46 pm

Nothing has changed in the Pi.

The software is pointing out that gpios 2 and 3 have pull-up resistors to 3V3 (as they always have). It's irrelevant unless you set an internal pull-down on those gpios (as the pull-down will have no effect).

headamage
Posts: 75
Joined: Wed Jan 07, 2015 9:59 am

Re: GPIO update problem

Fri Jan 09, 2015 12:50 pm

thanks. so this means that i don't need to set pull up/down for those two pins because they are always pulled up by default?

what if i set them as output? do i need to set pull up/down if they are output or do i just need to set them to 1/0 after i declare them?

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

Re: GPIO update problem

Fri Jan 09, 2015 1:05 pm

headamage wrote:thanks. so this means that i don't need to set pull up/down for those two pins because they are always pulled up by default?

what if i set them as output? do i need to set pull up/down if they are output or do i just need to set them to 1/0 after i declare them?
For gpios 2 and 3.

As I say the pull-downs will not work on those gpios. The hardware pull-ups are through a 1k8 resistor. The internal pull-downs are through a 50k resistor. The pull-up wins (being a smaller value).

Setting those gpios to 0 will work as it will defeat the 1k8 pull-up. Setting them to 1 will also work as it just reinforces the pull-up.

headamage
Posts: 75
Joined: Wed Jan 07, 2015 9:59 am

Re: GPIO update problem

Fri Jan 09, 2015 2:36 pm

Ah ok, now it makes more sense. So these two pins have an internal resistor to limit current draw regardless if set as output or input.

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

Re: GPIO update problem

Fri Jan 09, 2015 2:39 pm

Could you publish the code that is giving you this warning btw?

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

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

Re: GPIO update problem

Fri Jan 09, 2015 2:53 pm

headamage wrote:Ah ok, now it makes more sense. So these two pins have an internal resistor to limit current draw regardless if set as output or input.
Not quite. Consider the gpio to have a 1k8 parallel resistor to 3V3 in addition to anything you add to the circuit. They won't limit current you output.

mob-i-l
Posts: 251
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden
Contact: Website Facebook Google+ Twitter YouTube

Re: GPIO update problem

Fri Apr 17, 2015 5:06 pm

simplesi wrote:Could you publish the code that is giving you this warning btw?
I have code that gives this warning, but only for GPIO2 = P1-03. It doesn't complain about GPIO3 = P1-05, and that is perhaps a bug.

Code: Select all

#!/usr/bin/python3
# Tested on Raspberry Pi 1 B+
import RPi.GPIO as GPIO
import sys
setup = GPIO.IN

def printfunc(start, end):
    global setup, count
    print('Streak: %i' % (end-start))
    for pin in range(start, end):
        print('%i: ' % pin, end='')
        sys.stdout.flush()
        func1 = GPIO.gpio_function(pin)
        GPIO.setup(pin, setup)
        func2 = GPIO.gpio_function(pin)
        print(func1, '-->', func2)
        count += 1

print('GPIO.IN, GPIO.OUT, GPIO.SPI, GPIO.I2C, GPIO.HARD_PWM, GPIO.SERIAL, GPIO.UNKNOWN')
print(GPIO.IN, GPIO.OUT, GPIO.SPI, GPIO.I2C, GPIO.HARD_PWM, GPIO.SERIAL, GPIO.UNKNOWN)
GPIO.setmode(GPIO.BOARD)
count = 0
printfunc(3, 4)
printfunc(5, 6)
printfunc(7, 9)
printfunc(10, 14)
printfunc(15, 17)
printfunc(18, 20)
printfunc(21, 25)
printfunc(26, 27)
printfunc(29, 30)
printfunc(31, 34)
printfunc(35, 39)
printfunc(40, 41)
print('Count: %i' % count)
print(GPIO.RPI_INFO)
print(GPIO.VERSION)
GPIO.cleanup()
Output:

Code: Select all

GPIO.IN, GPIO.OUT, GPIO.SPI, GPIO.I2C, GPIO.HARD_PWM, GPIO.SERIAL, GPIO.UNKNOWN
1 0 41 42 43 40 -1
Streak: 1
3: gpiofunction.py:14: RuntimeWarning: A physical pull up resistor is fitted on this channel!
  GPIO.setup(pin, setup)
1 --> 1
Streak: 1
5: 1 --> 1
Streak: 2
7: 1 --> 1
8: 1 --> 1
Streak: 4
10: 1 --> 1
11: 1 --> 1
12: 1 --> 1
13: 1 --> 1
Streak: 2
15: 1 --> 1
16: 1 --> 1
Streak: 2
18: 1 --> 1
19: 1 --> 1
Streak: 4
21: 1 --> 1
22: 1 --> 1
23: 1 --> 1
24: 1 --> 1
Streak: 1
26: 1 --> 1
Streak: 1
29: 1 --> 1
Streak: 3
31: 1 --> 1
32: 1 --> 1
33: 1 --> 1
Streak: 4
35: 1 --> 1
36: 1 --> 1
37: 1 --> 1
38: 1 --> 1
Streak: 1
40: 1 --> 1
Count: 26
{'P1_REVISION': 3, 'RAM': 'Unknown', 'REVISION': '0010', 'TYPE': 'Unknown', 'PROCESSOR': 'Unknown', 'MANUFACTURER': 'Unknown'}
0.5.11
Have Pi0&1A&1B&1B+&2B&3B&4B w/ Raspbian. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

yunvi
Posts: 2
Joined: Fri Apr 24, 2015 12:49 pm

Re: GPIO update problem

Fri Apr 24, 2015 1:10 pm

headamage wrote:Hi everyone,

The recent update for raspbian also included some GPIO packges that seem to have changed something in the Pi.
I am now getting the following warning for GPIO pins 2 and 3 only.

RuntimeWarning: A physical pull up resistor is fitted on this channel!

What is this about?
I have the RPi 2 model B, and GPIO pins # 2 & 3 are dedicated as the I2C pins which I am assuming would explain why there are physical pull up resistors as noted by your program.

User avatar
Grumpy Mike
Posts: 909
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: GPIO update problem

Fri May 29, 2015 9:08 am

But is there any way to stop this? The normal turn off warnings does not work. It is a bit annoying when you know what you are doing.

Return to “Python”