Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO callback causing segmentation fault #42

Closed
guilhermearaujo opened this issue Nov 3, 2013 · 5 comments
Closed

GPIO callback causing segmentation fault #42

guilhermearaujo opened this issue Nov 3, 2013 · 5 comments

Comments

@guilhermearaujo
Copy link

I am attempting to perform some tasks on a rising edge of the P8 14, but everytime after the callback function ends, there's a segmentation fault and the script stops.

The following counter in incremented, the line is properly printed, but right after that comes the error message.

import Adafruit_BBIO.GPIO as GPIO

counterX = 0

def updateEncoderX(channel):
    global counterX
    counterX = counterX + 1
    print "Encoder counter updated: %d" % counterX

GPIO.setup("P8_14", GPIO.IN)
GPIO.add_event_detect("P8_14", GPIO.RISING, callback=updateEncoderX)

try:
    while 1:
        pass

except KeyboardInterrupt:
    GPIO.cleanup()
GPIO.cleanup()
@jwcooper
Copy link
Member

jwcooper commented Nov 5, 2013

Which operating system and kernel are you using?

Are you able to use the add_event_detect without the callback (at the bottom: http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/gpio)? Mostly just trying to narrow down the issue.

@guilhermearaujo
Copy link
Author

Ubuntu, Linux beagle 3.8.13-bone23 #4 SMP Thu Jul 18 13:31:51 CDT 2013 armv7l armv7l armv7l GNU/Linux
Without the callback function, the script runs normally and prints on GPIO.event_detected as expected.

Were you able to reproduce the error?

@jwcooper
Copy link
Member

I just tested this on Angstrom, and it worked for me. This might be an Ubuntu specific version issue. The first thing I'd do is update to the latest Ubuntu.

@jwcooper
Copy link
Member

Closing this. Please comment, and we can re-open if it's currently an issue.

@ghost
Copy link

ghost commented Mar 26, 2016

I have some kind of similar issue. I hope it will be okey if I reopen this issue. Or should I open another issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants