2

I got my pi2 this weekend and started experimenting. Now I tried adding LEDs to the GPIOs the way I know it from arduino and all the forums do it. Pin>LED>270 Ohm>GND I attached two: pin 17&27 (EDIT: Two separate LEDs, one to GPIO 17 and one to GPIO 27. The 17 one is always powered.) However I cannot control them (python and bash gpio / wirepi) and one is always on, even if the pi is shut down and the SD out.

EDIT: also the 3.3V doesn't appear to be powered, the 5V one workes however.

EDIT2: I am also using the black sainSmart 40pin T breakout

This is what gpio readall gives me right after boot:

 +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
 | 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 | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 1 | 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 | 1 | 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 | 1 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 1 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 1 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 1 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+

Is the GPIO dead?


EDIT: Did some measurements, and determined a 0 resistance between GPIO 17 and the 5 V Pins. That might be the cause. So I guess it is dead.

  • 2
    No idea. Pin 17 is the 3V3 rail. You have no control over the power and ground pins. You can only control pins connected to GPIO. – joan Dec 2 '15 at 22:28
  • GPIO 17 and 27 are shown as inputs in that list. What command(s) are you using to set their values? – joan Dec 3 '15 at 8:30
  • 1
    All the Pi GPIO are 3V3. NEVER connect them to 5V. I suggest you search for an introductory on-line tutorial. – joan Dec 3 '15 at 20:25
  • When you say GPIO 17 which PHYSICAL pin (the central two columns of numbers) do you mean? 17: which is as Joan says is a 3v3 SUPPLY rail and not controlled by software or 11: which is pin GPIO 17 as far as the Broadcom ARM core is concerned? Similarly for GPIO 27 do you mean 13 or 36. – SlySven Dec 18 '15 at 3:13
1

Think you have GPIO 17 (on physical PIN 11) confused with PIN 17; also PIN 27 is not a ground but ID_SD. Ground pins are as follows 6, 9, 14, 20, 25, 30, 34, 39. Good luck!

  • Sorry, I actually meant GPIO 17 and 27. They are two separate leds – Hans Dec 3 '15 at 6:29
1

Try To Access Pin's Using Shell Script

#!/bin/bash
#GPIO numbers should be from this list
#0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25

#Note that the GPIO numbers that you program here refer to the pins
#of the BCM2835 and *not* the numbers on the pin header. 
#So, if you want to activate GPIO7 on the header you should be 
#using GPIO4 in this script. Likewise if you want to activate GPIO0
#on the header you should be using GPIO17 here.

#Set up GPIO 4 and set to output:
echo "4" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio4/direction

#Set up GPIO 7 and set to input
echo "7" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio7/direction

#Write output
echo "1" > /sys/class/gpio/gpio4/value

#Read from input
cat /sys/class/gpio/gpio7/value 

#Clean up
echo "4" > /sys/class/gpio/unexport
echo "7" > /sys/class/gpio/unexport
  • I am getting this response - How do I permit the ports? – Hans Dec 3 '15 at 17:16
  • try in root mode – AKASH Dec 3 '15 at 17:24
  • this, If the LEDs are supposed to do something; they don't – Hans Dec 3 '15 at 17:26
  • what i gave is a example of accessing GPIO using shell script, you have to make change GPIO no in script according to your need. – AKASH Dec 4 '15 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.