mholgatem / GPIOnext

The next evolution of GPioneer! Create virtual gamepads with your GPIO pins!
MIT License
138 stars 37 forks source link

Failed to add edge detection #12

Closed Manofmerr closed 6 years ago

Manofmerr commented 6 years ago

I'm running retropie on a raspberry pi 3 b+, and am getting the following error: RuntimeError: failed to add edge detection. i'm having a problem sshing into my pi (pretty sure it's unrelated) so i can't copy and paste the traceback. I'm currently working on getting ssh to work, if you happen to have a answer/solution without the tracebask, feel free to share. If need be, i can retype the traceback, although i'm lazy and would rather not. I'm hoping the pic will help, sorry for the quality. image

Manofmerr commented 6 years ago

And which number system do you use for the pins?

mholgatem commented 6 years ago

GPIOnext uses board numbering for the pins. (ie - All the odd numbers are on the left, even on the right).

Are you using any of the pins for anything else? Like a screen or audio? If so, you will need to run the config with the pins flag for the pins that you want to use.

sudo python3 /home/pi/GPIOnext/config_manager.py --pins 3,5,7,11,13,15,etc...

after config, you can set the auto-run feature to always use those pins by typing

gpionext set pins 3,5,7,11,13,etc...
gpionext reload
Manofmerr commented 6 years ago

I only had the joystick hooked up the first time, and than (because i have 1/10 of a clue) i tried to get it to work with nothing attatched, and still got that error. i have rebooted my pi a few times, but i haven't reloaded gpionext, is that something i should do even if i reboot? and do i have to type out the whole command with the path just like you did when i want to use sudo?

mholgatem commented 6 years ago

gpionext config is the same as sudo python3 /home/pi/GPIOnext/config_manager.py

but if you want to use flags, then you have to type the whole thing out. I just haven't had time to implement flags into the shortcut.

GPIOnext should already handle it, but try this:

gpionext stop
sudo python3 /home/pi/GPIOnext/config_manager.py --pins 3,5,7,11,13,15,etc...

basically the problem is that something else is grabbing control of one or more of the pins before GPIOnext does it's thing.

What system image are you using and what software have you installed?

Manofmerr commented 6 years ago

I'm using retropie 4.14.34 on a pi 3 B+, i have a 128 gb sd card, i installed goodtft driver for my screen, i have quite a few roms installed (i'm using gamewizards build, hopefully that doesn't make a difference here). i don't currently have anything hooked up to the gpio pins, i did have adafruits retrogame script, i'm not sure i got rid of that, i'm going to go check on that. anything i missed that you need to know?

Manofmerr commented 6 years ago

oops. I didn't remove retrogame after all. um... how do i remove retrogame? i'm not finding a straight answer. On the bright side, looks like this is the problem.

mholgatem commented 6 years ago

sudo nano /etc/rc.local

remove the line that says /usr/local/bin/retrogame, save, exit, restart

Manofmerr commented 6 years ago

Removed it, Still getting the error. Anywhere else i can look?

mholgatem commented 6 years ago

did you reboot your system?

if so, I would look into the goodtft driver. I know that there are hdmi tft screens, but most of them connect to the gpio header. Try this to test it:

sudo python3 /home/pi/GPIOnext/config_manager.py --pins 37
Manofmerr commented 6 years ago

not sure what that did, but now i'm in what i assume is the config screen. think that fixed it. was that pin enabled for the screen by default even though i used a hdmi wire?

Manofmerr commented 6 years ago

Looks like every time i restart the pi, if i want to configure it i have to use that command. i kinda need to build more of the controller before i can do a comprehensive test, and i just noticed you have some nonstandard buttons. i didn't see anything for r3 or l3, do i just map that to a generic key of my choice? and thanks for the help, probably should've led with that.

Manofmerr commented 6 years ago

I need sleep, so tomorrow i'll try various buttons. may take me a little longer than i planned to play with a joystick. Electronics don't seem to like me anymore.

mholgatem commented 6 years ago

So that command is running the config with only 1 gpio pin (pin 37). That was just to test to see if goodtft was grabbing the pins, which it seems it is. Most tft screens use pins 1-26, so if you are planning to use a gpio based screen, these are the pins that you have available to you: 29,31,32,33,35,36,37,38,40 so you will run the command like this: sudo python3 /home/pi/GPIOnext/config_manager.py --pins 29,31,32,33,35,36,37,38,40

The buttons that I have listed is everything that is supported by evdev. If you have something that you want to map that isn't on the list, just use one of the generic options. It doesn't really matter, since you will map all of the buttons once you are in retropie.

Manofmerr commented 6 years ago

I currently have my display connected by a hdmi wire. There any way to modify the driver or something else to free up those pins?

mholgatem commented 6 years ago

According to the goodtft github repo, you can do this to get back to regular hdmi.

cd ~/LCD-show/
sudo ./LCD-hdmi
degroof commented 2 years ago

Just wanted to toss this in here in case someone else runs into this issue after installing a Raspberry Pi 4 case fan. I'd set up gpionext on a RPi 4. Worked great.

Then I added a case fan (uses PWM on GPIO14 to control fan speed). On the next reboot, all controls failed. Turns out I'd started getting the dreaded "failed to add edge detection" errors.

After a bit of digging, I tried using "gpionext set pins" to watch only the pins I had buttons on. Worked like a charm. After a reboot, everything was sunshine and roses again.