jobin-sun / raspberry-gpio-python

Automatically exported from code.google.com/p/raspberry-gpio-python
MIT License
0 stars 0 forks source link

wait_for_edge event-limit (RuntimeError: Error #3 waiting for edge) #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There seems to be a limit to how many wait_for_edge-events can be processed.
I use a circuit that switches the input on and off around 60 times per second. 
Everything is working until I hit a reproducable limit of 1017 events. 

The used code:

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
channel = 7
avg = 0
i = 0
starttime = time.time()
print "starttime: " + str(starttime)

GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
    try:  
        GPIO.wait_for_edge(channel, GPIO.RISING)  
        print GPIO.input(channel)
        t = time.time()
        starttime = t - starttime
        avg = (avg + starttime) / 2
        print "elapsed: " + str(starttime)
        print "avg: " + str(int(avg*1000))
        print i
        i += 1 
        starttime = t
    except KeyboardInterrupt:  
        GPIO.cleanup()

After holding the button on my circuit for a while the process exits with this 
errormessage:
...
elapsed: 0.0232310295105                                                        

avg: 23                                                                         

1016                                                                            

1                                                                               

elapsed: 0.0233290195465                                                        

avg: 23                                                                         

1017                                                                            

Traceback (most recent call last):                                              

  File "input.py", line 17, in <module>                                                                                               
RuntimeError: Error #3 waiting for edge

Original issue reported on code.google.com by danielpe...@gmail.com on 22 Apr 2013 at 8:07

GoogleCodeExporter commented 9 years ago
Might already be fixed in source code library - a possible fix was in place 
before any issue was identified. 

Original comment by btcros...@googlemail.com on 22 Apr 2013 at 8:28

GoogleCodeExporter commented 9 years ago
I am having the same issue with 0.5.2a. I tried to run cleanup() every time an 
edge is detected, but still the same result. Is there a work around? 

Original comment by lpc...@gmail.com on 3 May 2013 at 3:18

GoogleCodeExporter commented 9 years ago
I have the same problem. After 1016 rounds or interrupts:

T 1014
T 1015
T 1016
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 505, in run
  File "/var/www/server.py", line 25, in DoTheDew
RuntimeError: Error #3 waiting for edge

Original comment by benedikt...@gmail.com on 22 Aug 2013 at 7:07

GoogleCodeExporter commented 9 years ago
Hi,

I am having the same problem. Did anyone of you solved this problem yet?

I will be very happy to get some help on this. I am stuck on this so badly!

AH

Original comment by ahmedhus...@gmail.com on 29 Apr 2014 at 6:22

GoogleCodeExporter commented 9 years ago
Hi ahmedhus

This problem is solved just updating the library version, from 0.5.2a to a 
newer one. It's cleary explained in "btcros" comment.

Original comment by tomas.op...@gmail.com on 29 Apr 2014 at 9:59

GoogleCodeExporter commented 9 years ago
Hi

I've updated the library of version already...It is using the latest version 
i.e. 0.5.5

the error I get can be seen in the attached screenshot...

Thanks

AH

Original comment by ahmedhus...@gmail.com on 30 Apr 2014 at 10:14

Attachments:

GoogleCodeExporter commented 9 years ago
My code and GPIO version number can be seen in the screenshot below:

Original comment by ahmedhus...@gmail.com on 30 Apr 2014 at 10:27

GoogleCodeExporter commented 9 years ago

Original comment by ahmedhus...@gmail.com on 30 Apr 2014 at 10:27

Attachments:

GoogleCodeExporter commented 9 years ago
I've got the same isue :(

After 1000+ pulses the script crashes:
File "/home/pi/python/puls.py", line 10, in <module>
RuntimeError: Error #3 waiting for edge

Line 10 contains:
GPIO.wait_for_edge(22, GPIO.FALLING)

Python /GPIO version
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import RPi.GPIO as GPIO
>>> GPIO.VERSION
'0.5.5'
>>>

Hope there is a work-around /fix

Original comment by donm...@gmx.com on 14 May 2014 at 8:12

GoogleCodeExporter commented 9 years ago
Aftare a downgrade of python-rpi.gpio there's no limit of 1000+ pulses anymore!

What I did ...

#remove python-rpi.gpio 0.5.5-1
sudo apt-get remove python-rpi.gpio

#download old package of python-rpi.gpio
http://sourceforge.net/projects/raspberry-gpio-python/files/old%20releases/

# install the previous package
sudo dpkg -i python-rpi.gpio_0.5.4-1_armhf.deb

#prevent update of python-rpi.gpio with sudo apt-get update /upgrade
sudo apt-mark hold python-rpi.gpio

# solved for me!

Original comment by donm...@gmx.com on 23 May 2014 at 10:06

GoogleCodeExporter commented 9 years ago
Hello,

 I confirm that the problem is back since my last update to 0.5.5

Original comment by venturi...@gmail.com on 20 Jun 2014 at 3:09

GoogleCodeExporter commented 9 years ago
This is also present and reproducible in 0.5.6-1.

Original comment by bob.igo....@gmail.com on 19 Aug 2014 at 8:35

GoogleCodeExporter commented 9 years ago
Still having issues in 0.5.7-1.

Original comment by bozakov@gmail.com on 3 Oct 2014 at 8:06

danielmoraless commented 5 months ago

I have the same issue in 0.7.1a4