marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Sun Apr 07, 2013 9:31 pm

godzirra wrote:Yeah, the green connector is from the NES control port. I hooked it back up to the NES to verify that it and the controllers work as well. I'm trying to avoid chopping the end off the connector, but that' the last thing I can think of is that I'm not getting a good connection shoving the wires in there...

Unless there's something else I wired up wrong. I'm kind of at a loss now... The wires shoved in there seem like they should be making a good connection.
On page 3 of this thread, there was discussion about the same issue - your wiring does not seem to fully match the coloring of http://tinypic.com/view.php?pic=lks5z&s=7 (clk and data_out swapped places).

godzirra
Posts: 14
Joined: Wed Mar 13, 2013 3:23 pm

Re: Multi-console gamepad driver for GPIO

Sun Apr 07, 2013 9:35 pm

marqs wrote:
godzirra wrote:Yeah, the green connector is from the NES control port. I hooked it back up to the NES to verify that it and the controllers work as well. I'm trying to avoid chopping the end off the connector, but that' the last thing I can think of is that I'm not getting a good connection shoving the wires in there...

Unless there's something else I wired up wrong. I'm kind of at a loss now... The wires shoved in there seem like they should be making a good connection.
On page 3 of this thread, there was discussion about the same issue - your wiring does not seem to fully match the coloring of http://tinypic.com/view.php?pic=lks5z&s=7 (clk and data_out swapped places).
Huh. Let me try wiring it up that way. I used this doc: https://projects.drogon.net/nes-control ... pberry-pi/ which has very different colors. I'll let you know shortly.

godzirra
Posts: 14
Joined: Wed Mar 13, 2013 3:23 pm

Re: Multi-console gamepad driver for GPIO

Mon Apr 08, 2013 1:18 am

godzirra wrote:On page 3 of this thread, there was discussion about the same issue - your wiring does not seem to fully match the coloring of http://tinypic.com/view.php?pic=lks5z&s=7 (clk and data_out swapped places).
Huh. Let me try wiring it up that way. I used this doc: https://projects.drogon.net/nes-control ... pberry-pi/ which has very different colors. I'll let you know shortly.[/quote]


That was it! I had it wired up wrong this whole time apparently. I apparently didn't even need the diode and resistor. It was just wired up wrong the whole time. I assumed that the doc I was reading at adafruit was right.

Thanks so very much for all of your help!

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Mon Apr 08, 2013 5:00 pm

godzirra wrote:That was it! I had it wired up wrong this whole time apparently. I apparently didn't even need the diode and resistor. It was just wired up wrong the whole time. I assumed that the doc I was reading at adafruit was right.

Thanks so very much for all of your help!
Ok, good that this got sorted out. So your pad works fine with 3.3V supply? I wonder if there was some way to tell which pads need 5V. I googled a bit and there seems to be various versions of 4021 shift registers used in the pads (HD14021B, BU4021B, HEF4021BF, TC4021BP NEC4021...). I also learned that PAL NES pads have built-in pullups for clk and latch lines (missing from the PAL console) - I thought up to this day that only SNES-pads were region locked...

godzirra
Posts: 14
Joined: Wed Mar 13, 2013 3:23 pm

Re: Multi-console gamepad driver for GPIO

Mon Apr 08, 2013 5:23 pm

marqs wrote:
godzirra wrote:That was it! I had it wired up wrong this whole time apparently. I apparently didn't even need the diode and resistor. It was just wired up wrong the whole time. I assumed that the doc I was reading at adafruit was right.

Thanks so very much for all of your help!
Ok, good that this got sorted out. So your pad works fine with 3.3V supply? I wonder if there was some way to tell which pads need 5V. I googled a bit and there seems to be various versions of 4021 shift registers used in the pads (HD14021B, BU4021B, HEF4021BF, TC4021BP NEC4021...). I also learned that PAL NES pads have built-in pullups for clk and latch lines (missing from the PAL console) - I thought up to this day that only SNES-pads were region locked...
Yup, it works great with 3.3v. I'm not sure how to tell if a pad needs 5V or not.

agentspaz
Posts: 7
Joined: Wed Apr 10, 2013 7:10 pm

Re: Multi-console gamepad driver for GPIO

Wed Apr 10, 2013 7:20 pm

i am having trouble with the retro pi gpio adapter, when ever i put in the command "modprobe gamecon_gpio_rpi map=0" i get an error message saying "ERROR: could not insert 'gamecon_gpio_rpi' :Operation not permitted"

i am trying to set it up for 2 nes controllers on the 512MB version of the PI

godzirra
Posts: 14
Joined: Wed Mar 13, 2013 3:23 pm

Re: Multi-console gamepad driver for GPIO

Wed Apr 10, 2013 8:02 pm

agentspaz wrote:i am having trouble with the retro pi gpio adapter, when ever i put in the command "modprobe gamecon_gpio_rpi map=0" i get an error message saying "ERROR: could not insert 'gamecon_gpio_rpi' :Operation not permitted"

i am trying to set it up for 2 nes controllers on the 512MB version of the PI
You can't install a mod unless you are root. Your command should be "sudo modprobe gamecon_gpio_rpi map=0". Sudo will run your command as the root user which has super privileges.

Also, if I remember correctly, 0 means that a controller isn't connected. You need to change the 0 to whatever type of controller you're actually using, per the readme.

agentspaz
Posts: 7
Joined: Wed Apr 10, 2013 7:10 pm

Re: Multi-console gamepad driver for GPIO

Thu Apr 18, 2013 3:47 am

im a total noob, please help me. I have the GPIO adapter and now im trying to set up the driver for 2 nes controllers, but i cant seem to understand the directions. Can someone give me the command lines? i cant find help anywhere. Thank you I have the 512MB version.

maniac79
Posts: 4
Joined: Tue Oct 30, 2012 7:23 pm
Location: Germany, Dortmund
Contact: Website

Re: Multi-console gamepad driver for GPIO

Tue Apr 23, 2013 6:05 pm

Hi,
I have a somewhat strange problem, didn't find any information on that on the net so far.

I have connected 2 NES controllers via the RetroPi GPIO adapter and used the recent RetroPi Project SD card image (1.4.1) with gamepad driver 2.1.0. I have configured the driver to use 2 NES pads. emulationstation loads up fine and shows my roms. In the menu, if I don't touch anything, sometimes the cursor moves automatically and selects a rom which then starts up. If I press the button on the GPIO adapter 3 times, the emulator stops and I'm back in the menu as expected. Then randomly after a few seconds or even minutes, another rom is selected automatically (as if I'm pressing buttons, but I'm not!).
Now I would expect that there is a short circuit or something, but if that was the case I would expect the same behaviour in-game too, random key-presses during game-play. But that is not the case! As soon as a rom is loaded I don't experience that "unwanted keypresses" anymore.

Is there any way to circumvent this or maybe configure the driver to only except key presses that are longer as for example 10ms?

Any help is appreciated.

EDIT:
I think I MAY have found the solution myself to the problem. I checked js0 with jstest and wasn't able to notice any of these 'unwanted keypresses'. Then I checked js1 and it was flickering like hell. No pad was connected to the 2nd port btw. And it seems that exactly that was the problem. Now that I have connected the 2nd pad to the 2nd port, the emulationstation menu is stable. At least for the past few minutes. :)

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Tue Apr 23, 2013 6:44 pm

maniac79 wrote:Hi,
I have a somewhat strange problem, didn't find any information on that on the net so far.

I have connected 2 NES controllers via the RetroPi GPIO adapter and used the recent RetroPi Project SD card image (1.4.1) with gamepad driver 2.1.0. I have configured the driver to use 2 NES pads. emulationstation loads up fine and shows my roms. In the menu, if I don't touch anything, sometimes the cursor moves automatically and selects a rom which then starts up. If I press the button on the GPIO adapter 3 times, the emulator stops and I'm back in the menu as expected. Then randomly after a few seconds or even minutes, another rom is selected automatically (as if I'm pressing buttons, but I'm not!).
Now I would expect that there is a short circuit or something, but if that was the case I would expect the same behaviour in-game too, random key-presses during game-play. But that is not the case! As soon as a rom is loaded I don't experience that "unwanted keypresses" anymore.

Is there any way to circumvent this or maybe configure the driver to only except key presses that are longer as for example 10ms?

Any help is appreciated.

EDIT:
I think I MAY have found the solution myself to the problem. I checked js0 with jstest and wasn't able to notice any of these 'unwanted keypresses'. Then I checked js1 and it was flickering like hell. No pad was connected to the 2nd port btw. And it seems that exactly that was the problem. Now that I have connected the 2nd pad to the 2nd port, the emulationstation menu is stable. At least for the past few minutes. :)
Hmm, pullup resistors should keep the input stable if no controller is connected. Do you know which RPi revision you have? There could be some other GPIO driver which uses the same pin causing issues like this (you can list the loaded modules with 'lsmod', and unload unnecessary ones with 'rmmod <modname>' - sudo or root). Hope that helps.

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Tue Apr 23, 2013 7:36 pm

Quick update on the db9 driver:

I just got back from a vacation in Japan and brought some MD and Saturn controllers for testing their compatibility with the db9 driver. Once the functionality is verified, I'll release the driver for public and write instructions and wikipage.

To recap, the db9 driver will simultaneously support up to 2 pads of the following types:
-Atari, Commodore, Amiga etc. db9 multisystem joysticks (1-3 buttons)
-MD (genesis) pads (standard and 6-button pad)
-Saturn pads (digital + analog)
-Amiga CD32 pads (?)

maniac79
Posts: 4
Joined: Tue Oct 30, 2012 7:23 pm
Location: Germany, Dortmund
Contact: Website

Re: Multi-console gamepad driver for GPIO

Tue Apr 23, 2013 8:43 pm

Well, it may have something to do with my soldering. I now have tested with only pad 2 connected and did a jstest on js0. There is no flickering like the other way round, but all buttons report they are "on".

This is the output of lsmod, I am not so experienced in that area, but it looks good to me?

Module Size Used by
evdev 9426 9
gamecon_gpio_rpi 13993 0
joydev 9316 0
uinput 6575 3
snd_bcm2835 15846 1
snd_pcm 77560 2 snd_bcm2835
snd_page_alloc 5145 1 snd_pcm
snd_seq 53329 0
snd_seq_device 6438 1 snd_seq
snd_timer 19998 2 snd_pcm,snd_seq
snd 58447 6 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
leds_gpio 2235 0
led_class 3562 1 leds_gpio

Thanks for looking.

ti84
Posts: 70
Joined: Wed Feb 06, 2013 9:09 pm

Re: Multi-console gamepad driver for GPIO

Tue Apr 23, 2013 9:38 pm

@marqs

Awesome...keep up the good work...I look forward to the db9 driver :)

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Sat Apr 27, 2013 11:09 pm

maniac79 wrote:Well, it may have something to do with my soldering. I now have tested with only pad 2 connected and did a jstest on js0. There is no flickering like the other way round, but all buttons report they are "on".

This is the output of lsmod, I am not so experienced in that area, but it looks good to me?

Module Size Used by
evdev 9426 9
gamecon_gpio_rpi 13993 0
joydev 9316 0
uinput 6575 3
snd_bcm2835 15846 1
snd_pcm 77560 2 snd_bcm2835
snd_page_alloc 5145 1 snd_pcm
snd_seq 53329 0
snd_seq_device 6438 1 snd_seq
snd_timer 19998 2 snd_pcm,snd_seq
snd 58447 6 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
leds_gpio 2235 0
led_class 3562 1 leds_gpio

Thanks for looking.
That looks quite normal to me. You probably don't have Snesdev running, right? If both are active, some issues may occur. If you're unsure, try the following commands:

Code: Select all

sudo service SNESDev stop
sudo rmmod uinput
sudo rmmod gamecon_gpio_rpi
sudo modprobe gamecon_gpio_rpi map=...

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Thu May 02, 2013 5:51 pm

Db9-driver is now finished and can be installed by selecting "Install/update multi-console gamepad drivers for GPIO" -option in RetroPie-script.

Wikipage for the module is found here, and the included README contains detailed information on how to connect the joysticks and configure the driver.

I've tested the driver with a custom-made multisystem joystick, Mega Drive 6-button pad and a standard Sega Saturn controller. To my surprise, MD and Saturn controllers worked fine with 3.3v even though the contain TTL logic chips, so level shifters were not needed in my setup. CD32 gamepads and special Saturn controllers (e.g. analog pad) are still unverified until someone tests them.

booger
Posts: 1
Joined: Fri May 03, 2013 11:43 am

Re: Multi-console gamepad driver for GPIO

Fri May 03, 2013 12:01 pm

I have connected 2 NES controllers via the RetroPi GPIO adapter and used the recent RetroPi Project SD card image (1.4.1) with gamepad driver 2.1.0. I have configured the driver to use 2 NES pads. emulationstation loads up fine and shows my roms. In the menu, if I don't touch anything, sometimes the cursor moves automatically and selects a rom which then starts up. If I press the button on the GPIO adapter 3 times, the emulator stops and I'm back in the menu as expected. Then randomly after a few seconds or even minutes, another rom is selected automatically (as if I'm pressing buttons, but I'm not!).
I had similar problem with revision 0002 board and two nes-controllers. First I noticed that first pad connected to P3 or P5 did not work (I tested with jstest). However the pad in P7 (gpio04) worked perfectly. After double checking everything, I finally got both controllers working using GPIO04 and GPIO07. After these changes and after removing es_input.cfg under emulationstation I managed to configure controllers in emulationstation.

Here's my configuration:

Pad 1:
Vcc --- P1
GND --- P6
Clock --- P19
Latch --- P23
Data --- P7

Pad 2:
Vcc --- P1
GND --- P6
Clock --- P19
Latch --- P23
Data --- P26

/etc/modules
gamecon_gpio_rpi map=0,0,2,2

jaans
Posts: 1
Joined: Fri May 10, 2013 9:22 am

Re: Multi-console gamepad driver for GPIO

Fri May 10, 2013 9:27 am

I am thinking about using a NES Four Score to wire four NES controllers into Raspberry PI (in order to play 4 player games with NES emulators).

As I am pretty new to this, could someone confirm if it is possible to wire four controllers using the Four Score by soldering the wires to the end points in the Four Score PCB? I would use this to help in wiring the controllers to the GPIO (as multiple NES controllers share some pins, I guess I need a breadboard or something too): https://a248.e.akamai.net/camo.github.c ... 692e706e67

And this to solder the wires into the Four Score (times four of course): http://psmay.com/news/wp-content/upload ... pinout.png

Also: Does any NES emulator for Raspberry Pi support four gamepads wired like this?

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Fri May 10, 2013 11:43 pm

jaans wrote:I am thinking about using a NES Four Score to wire four NES controllers into Raspberry PI (in order to play 4 player games with NES emulators).

As I am pretty new to this, could someone confirm if it is possible to wire four controllers using the Four Score by soldering the wires to the end points in the Four Score PCB? I would use this to help in wiring the controllers to the GPIO (as multiple NES controllers share some pins, I guess I need a breadboard or something too): https://a248.e.akamai.net/camo.github.c ... 692e706e67

And this to solder the wires into the Four Score (times four of course): http://psmay.com/news/wp-content/upload ... pinout.png

Also: Does any NES emulator for Raspberry Pi support four gamepads wired like this?
That should work, but you'll need to cut some lines inside the Four Score (at least the voltage going to the control chip), so it won't be usable with a NES anymore if that matters. Notice also that the clock and latch lines are not probably wired together (and some data lines may be) in Four Score, so you have to check those.

FCEU should support both Famicom and NES 4-player games (they use different controller protocol), but I haven't tested that.

User avatar
Evil_Maniak
Posts: 3
Joined: Thu Jun 06, 2013 8:32 pm

Re: Multi-console gamepad driver for GPIO

Thu Jun 06, 2013 8:45 pm

Hello!
I would greatly appreciate help in the matter of attaching PSX controllers to my RasPi. I am brand new in the topic as I have received my RasPi just today, however, I have a plan in my head and that would require attaching PSX pads to GPIO. Could someone help me?

What I would like to know at this moment is what to plug where. I mean what cables should be attached to the pad and in which order, so I would get something like this:

Image

Nevertheless, every help will be appreciated and if I will be succesful in my attempt I would like to create a photo tutorial how to achieve that as well, for future reference.

Cheers from Poland! :3

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Fri Jun 07, 2013 6:16 am

Hi,

did you check the wikipage and the README of the driver? You have to connect 6 wires from RPi GPIO to each pad (of which 5 are shared between all PSX pads). The easiest way is to use female-female jumpers as is done in that photo. The pinout of PSX pad is found here. Remember to use 3.3V for power. Depending of the controller model, you may also have to increase the psx pad setup time using psx_delay-option when you load the driver.

User avatar
Evil_Maniak
Posts: 3
Joined: Thu Jun 06, 2013 8:32 pm

Re: Multi-console gamepad driver for GPIO

Sun Jun 09, 2013 9:29 am

Ok, I was able to figure out how to connect one pad:

(left PSX pad pins / right GPIO)

1. Data - P1-03
2. CMD - P1-08
3. nothing
4. GND - P1-06
5. VCC - P1-02
6. ATT - P1-10
7. CLK - P1-12
8. nothing
9. nothing

But now I would need help in how should I connect two pads simulatenously. I've read somewhere that I should use "splitters", but I wasn't successful in finding any helpful pages on GPIO splitting. Any ideas?

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Sun Jun 09, 2013 6:25 pm

You can use e.g. a breadboard with long pin headers to split the connections. BTW, P1-02 seems to 5V - you should use P1-01 (3.3V) for Vcc.

User avatar
Evil_Maniak
Posts: 3
Joined: Thu Jun 06, 2013 8:32 pm

Re: Multi-console gamepad driver for GPIO

Sun Jun 09, 2013 9:26 pm

Holy shit, thanks for noticing. I might burn it before I even start at this rate :D

So I have this idea:

Image

I want to use original PSX pad sockets as they come with handy pins within:

Image

I got his idea when I thought of old ribbon cables and my old ATA hard disc, as they were connected in a similiar manner. Do you think it will work? Can it be done that way? If not how should I improve that?

marqs
Posts: 212
Joined: Sat Jun 09, 2012 11:34 am

Re: Multi-console gamepad driver for GPIO

Mon Jun 10, 2013 6:17 am

Yeah, that should work.

lzrstrm
Posts: 3
Joined: Fri Jul 12, 2013 11:13 pm

Re: Multi-console gamepad driver for GPIO

Fri Jul 12, 2013 11:42 pm

I can seem to connect my n64 pad to the Pi.
when i use command

Code: Select all

sudo modprobe gamecon_gpio_rpi map=0,0,0,0,6,0 
all work fine and when i use command

Code: Select all

tail /var/log/kern.log
it says my n64 connected, but when emulationstation asks me to set up a controller my n64 pad doesn't work.

sometimes I wonder if it didn't install properly.

Return to “Gaming”