George_P
Posts: 10
Joined: Sun Jun 16, 2013 12:11 am

GPIO Pin13 (and more)

Sun Jun 16, 2013 12:47 am

Hello,

I bought a PI a couple of months ago to evaluate as an educational tool..
I have installed the Python GPIO library and tested controlling the GPIO pins with Python. All GPIO pins seem OK, except GPIO2 (pin 13 of GPIO port). This does not respond to the program and always reads 0V
The Pi is a ModelB Rev 2, Rev no 0xf. Could it be hardware problem? Something to do with the library?
Also, is there a similar library for Python that handles the SPI or serial interface?
We would like to use a microcontroller for actual control, with the Pi sending commands/reading data through SPI /serial interface.
Any suggestions please?

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

Re: GPIO Pin13 (and more)

Sun Jun 16, 2013 7:50 am

Is the Python library you are using the "wiringpi" one? If so, it sounds like you may have an old version of it.

The GPIO line used for pin 13 changed between the Rev 1 board and the Rev 2 board. On Rev1 it was connected to GPIO line 21 and on Rev2 it is connected to GPIO line 27. So it may be that your program is setting GPIO 21 high - which isn't connected to any pins now.

The recent versions of the library handle that change so you can still use it as wiringpi GPIO2.

George_P
Posts: 10
Joined: Sun Jun 16, 2013 12:11 am

Re: GPIO Pin13 (and more)

Sun Jun 16, 2013 4:26 pm

Thanks for the answer

It is not the WiringPi Library
It is the GPIO Python library I downloaded a couple of days ago from
http://code.google.com/p/raspberry-gpio-python.
Calls to this library use the pin numbers of the GPIO connector on the Raspberry board.
It probably has to do with this library (hope it is not hardware problem) as the rest of the GPIO pins respond fine.
In this case what can be done?
Also, are there libraries for the rest of the interfaces availabe on the P1 connector?

User avatar
croston
Posts: 708
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: GPIO Pin13 (and more)

Sun Jun 16, 2013 8:46 pm

Make sure you have up to date firmware and RPi.GPIO:

Code: Select all

sudo apt-get update
sudo apt-get dist-upgrade
What is the result of:

Code: Select all

import RPi.GPIO as GPIO
GPIO.VERSION
GPIO.RPI_REVISION

George_P
Posts: 10
Joined: Sun Jun 16, 2013 12:11 am

Re: GPIO Pin13 (and more)

Sun Jun 16, 2013 11:26 pm

Thanks
The message I get is that attributes VERSION and RPI_REVISION are not supported...

User avatar
croston
Posts: 708
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: GPIO Pin13 (and more)

Mon Jun 17, 2013 5:33 am

Sounds like you are using a really ancient version of RPi.GPIO then - older than Revision 2 boards! Have you been copy-and-pasting out of date command line instructions off the internet? These tend to install an old version of RPi.GPIO that overrides the latest version that comes with Raspbian.

A quick check - what is the result of:

Code: Select all

find /usr | grep -i GPIO

George_P
Posts: 10
Joined: Sun Jun 16, 2013 12:11 am

Re: GPIO Pin13 (and more)

Mon Jun 17, 2013 7:47 pm

Sorry I did not know there were so many versions. Got the address from Eben Upton's book, I suppose much of the info in there is obsolete now
I also did not know a library suitable for Ver2 was included in the latest Rasbian distribution...

Would upgrading the distribution install the latest library?
If not where can I get and install it? Also do I need to remove the old one to avoid any conflicts?

User avatar
croston
Posts: 708
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: GPIO Pin13 (and more)

Mon Jun 17, 2013 8:04 pm

You will need to delete the old version of RPi.GPIO that you installed manually. It's a case of deleting the relevant files for the old version you discovered using the 'find' command in my earlier post. After this, the newer version installed as part of Raspbian will start working.

Unfortunately, Eben's book is very out of date with regards to RPi.GPIO. For the latest information about RPi.GPIO look here:
http://code.google.com/p/raspberry-gpio ... i/Examples

George_P
Posts: 10
Joined: Sun Jun 16, 2013 12:11 am

Re: GPIO Pin13 (and more)

Thu Jun 20, 2013 10:53 am

Many thanks for that.
Instead of manually removing the old library I re-installed rasbian on a spare SD card and then with a
sudo apt-get dist-upgrade
the latest library was installed.
Can I use all the GPIO pins? Are they configured as GPIO on reset?
I think I saw somewhere that all can be used as GPIO if they have not been configured otherwise, except TxD and RxD (pins 8 and 10)?

User avatar
croston
Posts: 708
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: GPIO Pin13 (and more)

Thu Jun 20, 2013 11:08 am

George_P wrote:Can I use all the GPIO pins? Are they configured as GPIO on reset?
I think I saw somewhere that all can be used as GPIO if they have not been configured otherwise, except TxD and RxD (pins 8 and 10)?
That is correct.

Return to “Troubleshooting”