title: Pull up setting via GPIO on rasperry PI
body: <p>I need many I2C busses on a rasperry PI so I wrote my own I2C controler using usual GPIOs.</p>
  <p>It works when using BCM GPIO 2 and 3, but not other GPIOs.
  GPIO 2 and 3 are pulled up to VCC via 1.8KOhm resistor according to the <a href="https://www.raspberrypi.org/documentation/hardware/raspberrypi/schematics/rpi_SCH_3b_1p2_reduced.pdf" rel="nofollow noreferrer">schematics</a>.</p>
  <p>I wonder why this pull-up resistor is needed, as the GPIOs can be pulled up internally in the BCM (not sure about the resistor value then, maybe it is regarded as too weak for I2C)... Anyway...</p>
  <p>When using <code>Rpi.GPIO</code>, this &quot;software&quot; pull up should be controled with the following statement:</p>
  <pre><code>GPIO.setup(&lt;gpio_pin&gt;, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  </code></pre>
  <p>So I wrote the following test code to test things:</p>
  <pre><code>GPIO.setmode(GPIO.BOARD)
  gpios= [3,5,29,31] #board numbering (2,3,5,6 in BCM)
  
  GPIO.setup(gpios, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  
  for gpio in gpios:  #test pin for pin
      print(&quot;&gt;&gt;&gt;&gt;&gt; &quot;, gpio)
      GPIO.setup(gpio, GPIO.IN, pull_up_down=GPIO.PUD_UP)
      res= GPIO.input(gpio)
      print res
  </code></pre>
  <p>Which returns</p>
  <pre><code>./r:15: RuntimeWarning: A physical pull up resistor is fitted on this channel!
    GPIO.setup(gpios, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  ('&gt;&gt;&gt;&gt;&gt; ', 3)
  ./r:18: RuntimeWarning: A physical pull up resistor is fitted on this channel!
    GPIO.setup(gpio, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  1
  ('&gt;&gt;&gt;&gt;&gt; ', 5)
  1
  ('&gt;&gt;&gt;&gt;&gt; ', 29)
  0
  ('&gt;&gt;&gt;&gt;&gt; ', 31)
  0
  </code></pre>
  <p>Nothing is connected to any pin yet, so there is nothing pulling anything down.</p>
  <p>Strangely, I got the warning for board pin 3 but not 5, despite both being pulled up externally(?).</p>
  <p>But more to the point, the above result tells me that my software controlled pull-up failed. I should be getting '1' on all four GPIOs.</p>
  <p>Did I misunderstood what Rpi.GPIO is doing?</p>