JarJarGeek
Posts: 48
Joined: Tue Mar 18, 2014 11:32 am

Raspberry Pi 2 ; GPIO not working

Sun Feb 08, 2015 10:14 pm

OK so got VCN working now on to GPIO Model B2, trying to set up GPIO as prescribed by gardav (4Tronix) seems to be working for him. Error messages given when running IDLE or ScratchGPIO is as follows:
'Runtime Error, this module can only be run on a Raspberry Pi' uuuhhhh ?!?! :shock:

Anyone else got any similar issues or solutions to this ??
@jarjargeek

syntax-err0r.com

marvin42
Posts: 10
Joined: Fri Jul 13, 2012 8:22 pm

Re: Raspberry Pi 2 ; GPIO not working

Sun Feb 08, 2015 10:38 pm

I had the same issue with a simple python test program and there seems to be an RPI.GPIO update you need to install, after this, it worked for me.

But I have severe problems with GPIO that I'm trying to access from a c++ code - with works just nice on any RPI1
...

JarJarGeek
Posts: 48
Joined: Tue Mar 18, 2014 11:32 am

Re: Raspberry Pi 2 ; GPIO not working

Sun Feb 08, 2015 10:54 pm

Well good news peeps - bit of a workaround but as Gareth pointed out earlier you need to install the dev version of python from here http://sourceforge.net/p/raspberry-gpio ... i/install/ - works very well with Python2/3 and ScratchGPIO 7. Im off to bed :ugeek:
@jarjargeek

syntax-err0r.com

Pete68
Posts: 6
Joined: Sun Feb 08, 2015 11:01 pm
Location: West Sussex

Re: Raspberry Pi 2 ; GPIO not working

Sun Feb 08, 2015 11:14 pm

I'm still having problems with GPIO outputs on my RPv2 Model B even after doing the Python-Dev update.

It seems that anything trying to set the mode or state of an output simply does not work from Python. Inputs, however are working fine. PIR, buttons and 1 wire temp sensors all reading ok.

I've tried RPi.GPIO and WiringPi, both do not work from Python (even as root), but WiringPi works fine from the CLI in a terminal using 'gpio -g' commands. It's driving me mad!

My scripts are running fine on my model B+.

Any ideas?

timknapen
Posts: 1
Joined: Mon Feb 09, 2015 6:46 pm

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 6:48 pm

For GPIO access in C++ on the pi2, try this: https://github.com/timknapen/Raspberry/ ... r/mmapGPIO

Pete68
Posts: 6
Joined: Sun Feb 08, 2015 11:01 pm
Location: West Sussex

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 6:57 pm

Thanks for the info but I need the GPIO working from Python as it did on earlier versions of the Pi.

I appreciate that the dev version is likely to be buggy. Does anyone know how long we will have to wait for a new full release version?


Pete68
Posts: 6
Joined: Sun Feb 08, 2015 11:01 pm
Location: West Sussex

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 7:48 pm

@gordon77

That is what I have done. Nothing worked at all prior to that.

Now all inputs work OK, I just don't have any outputs working at all! Only from scripts written in Python (these are ones that worked fine on the B+).

I have written a bash script using 'gpio -g' commands and everything is OK on any GPIO set as an output, driving a LED. It seems that python is my problem :(

gordon77
Posts: 6623
Joined: Sun Aug 05, 2012 3:12 pm

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 8:36 pm

Works OK for me with python, l would uninstall and try again.

Gordon77

JarJarGeek
Posts: 48
Joined: Tue Mar 18, 2014 11:32 am

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 9:17 pm

as Gordon said the dev version of rpi.GPIO works and although there are warnings about 'what it could do' to your Pi2 , well it's not as if its gonna blow up ?!?!? A 'damage limitation statement' from foundation would surely be welcome now . . . .
@jarjargeek

syntax-err0r.com

User avatar
DougieLawson
Posts: 42213
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 9:29 pm

JarJarGeek wrote: A 'damage limitation statement' from foundation would surely be welcome now . . . .
Why should they? It's not their software.

RPi.GPIO is a user supplied software from Ben Croston and he's been working hard all last week to try to fix the break in his code from the new processor architecture. The fact that everyone uses it and it's borked by the RPi2 is not the Foundation's problem.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Pete68
Posts: 6
Joined: Sun Feb 08, 2015 11:01 pm
Location: West Sussex

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 9:41 pm

Well, I've re-installed this a few times now and it is still the same.

Raspberry Pi model B rev2 (256MB): Run python script and then do a 'gpio readall', I can see the outputs get set and toggle on/off. Works as expected.

Raspberry Pi 2 : Run same script and do 'gpio readall', all GPIO's stay set to IN. Even if I force them to OUT (via gpio -g mode n 1), they still do not work from a python script. They work perfectly from a bash script!

I guess as I've now updated the old model B OS, it should boot on a Pi2, so I'll try that after I've imaged it onto a micro SD and see if it jumps into life. It must be a software issue as the hardware is working fine.

Will post results......

Cheers.

User avatar
DougieLawson
Posts: 42213
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 9:48 pm

Have you installed the new version of WiringPi for the Raspberry Pi 2B?
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Pete68
Posts: 6
Joined: Sun Feb 08, 2015 11:01 pm
Location: West Sussex

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 10:19 pm

DougieLawson wrote:Have you installed the new version of WiringPi for the Raspberry Pi 2B?
Indeed I did, v2.25

Pete68
Posts: 6
Joined: Sun Feb 08, 2015 11:01 pm
Location: West Sussex

Re: Raspberry Pi 2 ; GPIO not working

Mon Feb 09, 2015 11:03 pm

OK, finally getting somewhere....

It seems that adding (device_tree=) in /boot/config.txt is the problem.

I added this following posts about getting 1-wire sensors working on the Pi2 after the recent firmware updates. After booting from my updated model B SD Card, things seemed to be working OK except the 1-wire sensors. The 'gpio readall' reported i/o pins being setup and toggling correctly, just no readings from the sensors. I put the device_tree= back in along with the dtoverlay=w1-gpio-pullup,gpiopin=4 and it all broke again! I now just have the 1-wire line in and all seems good.

Thanks for the suggestions. I think this one is closed now :D

bobrathbone
Posts: 22
Joined: Mon Oct 22, 2012 7:43 am

Re: Raspberry Pi 2 ; GPIO not working

Thu Feb 12, 2015 6:56 pm

There appears to be a major incompatibly between the Raspberry Pi model 2 B and the current GPIO libraries. I just do not understand that the Model 2 was released without compatible GPIO libraries being available. Installing GPIO from http://sourceforge.net/p/raspberry-gpio ... i/install/ will probably get your program working but is about 20 times slower than normal. If I put the same OS and software on a model 1 B it works as expected. I am the author of the Raspberry PI internet radio (bobrathbone.com) and the LCD display is now dreadfully slow with the new model 2 hardware. I think we will have to wait until the problems with the GPIO incompatibilities are sorted out and new GPIO libraries released. I am very disappointed with the Model 2 B GPIO performance who ever is to blame.

texy
Forum Moderator
Forum Moderator
Posts: 5173
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 8:09 am

bobrathbone wrote:There appears to be a major incompatibly between the Raspberry Pi model 2 B and the current GPIO libraries. I just do not understand that the Model 2 was released without compatible GPIO libraries being available. Installing GPIO from http://sourceforge.net/p/raspberry-gpio ... i/install/ will probably get your program working but is about 20 times slower than normal. If I put the same OS and software on a model 1 B it works as expected. I am the author of the Raspberry PI internet radio (bobrathbone.com) and the LCD display is now dreadfully slow with the new model 2 hardware. I think we will have to wait until the problems with the GPIO incompatibilities are sorted out and new GPIO libraries released. I am very disappointed with the Model 2 B GPIO performance who ever is to blame.
...that's the price you pay for using bleeding edge hardware. I believe the RPi.GPIO dev version has been updated :
http://www.raspberrypi.org/forums/viewt ... 00#p693406
Try an update and see how you get on.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
DougieLawson
Posts: 42213
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 8:58 am

bobrathbone wrote:There appears to be a major incompatibly between the Raspberry Pi model 2 B and the current GPIO libraries. I just do not understand that the Model 2 was released without compatible GPIO libraries being available.
The box has been out for less than two weeks and you're moaning about software that isn't from the Foundation.

How are developers supposed to work on a machine that they don't know it exists if they aren't part of the NDA early support group?

You should be cheering that it's only taken two weeks to fix the code that got broken by the new hardware.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

bobrathbone
Posts: 22
Joined: Mon Oct 22, 2012 7:43 am

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 3:56 pm

Well I am certainly not cheering! A working GPIO library is absolutely fundamental for any model of the Raspberry Pi. I suspect that thousands of projects and software such as mine will not work (or will be severely degraded) on the new hardware as a result. Like I said, lets hope that authors of the GPIO libraries can come up with a solution fairly soon.

telecom
Posts: 59
Joined: Fri Feb 13, 2015 7:47 pm
Location: Toronto, Canada

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 7:50 pm

Hi
have the same problem with Raspberry B +
Folks,
please help GPIO going, need to control the relay.
Right now pins are dead - no errors/warnings.
Regards

texy
Forum Moderator
Forum Moderator
Posts: 5173
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 8:06 pm

telecom wrote:Hi
have the same problem with Raspberry B +
Folks,
please help GPIO going, need to control the relay.
Right now pins are dead - no errors/warnings.
Regards
There should be NO problem using RPi.GPIO with the Pi B+ - only the Pi 2 B. Are you sure you have a B+ ?

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

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

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 8:09 pm

There is a problem recognising pins > 26 when using BOARD numbers. It is fixed in the development version and I am looking to release 0.5.11 later tonight.

texy
Forum Moderator
Forum Moderator
Posts: 5173
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 8:17 pm

croston wrote:There is a problem recognising pins > 26 when using BOARD numbers. It is fixed in the development version and I am looking to release 0.5.11 later tonight.
Has this problem only just come light then? Obviously the B+ has been around for a while...
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

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

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 8:27 pm

I had to change the method of board detection with the new Pi2 and missed changing one line of code that determines which pins are valid for a given board revision. So now:
- GPIO.RPI_REVISION is now deprecated and replaced by RPI_INFO['P1_REVISION']
- The new RPI_INFO is a dictionary telling you a lot more about your Pi

telecom
Posts: 59
Joined: Fri Feb 13, 2015 7:47 pm
Location: Toronto, Canada

Re: Raspberry Pi 2 ; GPIO not working

Fri Feb 13, 2015 10:43 pm

texy wrote:
telecom wrote:Hi
have the same problem with Raspberry B +

Regards
There should be NO problem using RPi.GPIO with the Pi B+ - only the Pi 2 B. Are you sure you have a B+ ?

Texy
Its the one with the increased number of GPIO pins and 4 USB ports,
getting totally confused with the actual model.
In any case,
when I tried using Python to control the pin, was only able to turn the relay ON, When tried turning OFF, got the message pertaining to the channel
being occupied or something like this. Did the upgrade. After the upgrade,
got no warning message, but still pins are getting stuck, The strange thing
is, that they keep getting stuck even after the reboot. May be its only this particular board which is defective? I wish I had my dependable original
RPI!
Regards

Return to “Troubleshooting”