andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Fri Jul 04, 2014 10:24 pm

marqs wrote:
joostvanpoppel wrote:Download link in first post seems to be broken, what is the link to use?

thanks,
Joost
The driver is nowadays part of RetroPie-project, and you can install it by selecting the corresponding option in RetroPie-Setup
-script.
I couldn't find it no more, was this cancelled from retropie 2.1?

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

Re: Multi-console gamepad driver for GPIO

Sat Jul 05, 2014 7:22 am

andreatax wrote:
marqs wrote:
joostvanpoppel wrote:Download link in first post seems to be broken, what is the link to use?

thanks,
Joost
The driver is nowadays part of RetroPie-project, and you can install it by selecting the corresponding option in RetroPie-Setup
-script.
I couldn't find it no more, was this cancelled from retropie 2.1?
Apparently, RetroPie is currently under reorganization and that option seems to be missing now. I assume it will be added back shortly - meanwhile you can install the drivers manually as follows:

Code: Select all

wget http://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/linux-headers-`uname -r`_`uname -r`-2_armhf.deb
wget http://www.niksula.hut.fi/~mhiienka/Rpi/gamecon-gpio-rpi-dkms_0.9_all.deb
wget http://www.niksula.hut.fi/~mhiienka/Rpi/db9-gpio-rpi-dkms_0.7_all.deb
dpkg -i linux-headers-`uname -r`_`uname -r`-2_armhf.deb
dpkg -i gamecon-gpio-rpi-dkms_0.9_all.deb
dpkg -i db9-gpio-rpi-dkms_0.7_all.deb

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Sat Jul 05, 2014 4:48 pm

Thank you,

now I tried
modprobe gamecon_gpio_rpi map=0,0,7,7,0,0 psx_delay=14

with ps2 controller but jstest give me no response, no button or axis works...

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

Re: Multi-console gamepad driver for GPIO

Sat Jul 05, 2014 4:50 pm

andreatax wrote:Thank you,

now I tried
modprobe gamecon_gpio_rpi map=0,0,7,7,0,0 psx_delay=14

with ps2 controller but jstest give me no response, no button or axis works...
Try setting psx_delay to 25 or above. Is that controller official or 3rd-party? I also forgot to mention that gcc-4.7 should be installed before the drivers (normally done by RetroPie).

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Sat Jul 05, 2014 5:02 pm

Thank for quick reply :)

It's an original Ps2 controller scph 10010

Gcc-4.7 already installed and I tried with delay 30 or more but doesnt work

EDIT: DATA pin was connected with GPIO3 but if i do:
tail /var/log/kern.log

I see : psx controller as devices/virtual/input/input3
psx conrtoller data pin connected to gpio4

same thins with input4 connected to gpio7


Do I connected data pin wrongly?

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

Re: Multi-console gamepad driver for GPIO

Sat Jul 05, 2014 5:30 pm

andreatax wrote:Thank for quick reply :)

It's an original Ps2 controller scph 10010

Gcc-4.7 already installed and I tried with delay 30 or more but doesnt work
Hmm, I've heard a few similar reports so there's probably some issue in the driver code. I try to acquire one of those models and check if I can reproduce the issue.

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Sun Jul 06, 2014 7:54 am

Thanks but DATA psx pin where should goes ?

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

Re: Multi-console gamepad driver for GPIO

Sun Jul 06, 2014 12:24 pm

andreatax wrote:Thanks but DATA psx pin where should goes ?
Depends on how you have configured the driver. If you loaded it with gamecon_gpio_rpi map=0,0,7,7,0,0, you must connect the data pin of your first controller to GPIO4, and the second to GPIO7 as kernel log suggests (the wording is a bit misleading, it should say that 'gpio4 configured for psx controller data pin' etc.). The driver README (/usr/share/doc/gamecon_gpio_rpi/README.gz) has more details on the configuration options.

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Sun Jul 06, 2014 2:34 pm

Thank you so much, now works with jstest !

Was a problem about PINs because on gamecon_gpio wiki there was an old revision of the PIN to GPIO

Another question
How to make controller works from boot?
Because now I need to write command everytime...

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

Re: Multi-console gamepad driver for GPIO

Sun Jul 06, 2014 3:45 pm

andreatax wrote:Thank you so much, now works with jstest !

Was a problem about PINs because on gamecon_gpio wiki there was an old revision of the PIN to GPIO

Another question
How to make controller works from boot?
Because now I need to write command everytime...
Ok, good to hear it wasn't a driver issue after all. The wikipage under RetroPie project doesn't have a direct PIN->GPIO map as there are several configuration possibilities (there's only a general pinout image plus a remark on different RPi revisions) - did you mean some other wikipage?

In order to load the driver at bootup, you can add the corresponding line (e.g. gamecon_gpio_rpi map=0,0,7,7) to /etc/modules .

andreatax
Posts: 18
Joined: Wed Jun 25, 2014 10:24 pm

Re: Multi-console gamepad driver for GPIO

Mon Jul 07, 2014 8:22 am

Thank You, now all works Pretty well!

For the wiki, i was referring to retropie official wiki.. There is a picture of rpi pins But with another GPIO configuration.. There is a NOTE warning this that I didnt Read :-)

jon-whit
Posts: 7
Joined: Sun Oct 12, 2014 8:37 pm

Re: Multi-console gamepad driver for GPIO

Sun Oct 12, 2014 8:51 pm

I'm really loving all of this community support for old school gaming :D . I really want to start to contribute back to the community. First things first though. I'm having issues getting my SNES controller working. I went through the install process with the retropie_setup.sh script. I enabled the SNESDev on boot and SNESDev keyboard mapping. I have female pins that I have crimped onto the ends of the controllers output wires, and I have connected them as follows:

Vcc -> Pin 2 (5v)
GND -> Pin 6
Data -> GPIO22 (Pin 15)
Latch -> GPIO23 (Pin 16)
CLK -> GPIO24(Pin 18)

When I run ES it recognizes my keyboard, but it doesn't recognize the game controller. I guess I don't understand what I am doing wrong. I'd be willing to add more documentation clarity for the various revision, it seems like this is missing from the setup process.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12591
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Multi-console gamepad driver for GPIO

Sun Oct 12, 2014 9:05 pm

You shouldn't power the controller with 5V, as the chip in the controller will then also output a 5V data signal, which in time will damage the PI! The GPIO's are NOT 5V compatible.

Also, when powered with 5V the chip may not respond to the 3.3V control signals, as it needs "high" signals of at least 70% of VDD, which for VDD=5V is 3.5V, which explains why it doesn't work too.

The 74HC4021 chip inside the controller works fine with voltages as low as 3.0Volt.

Image

jon-whit
Posts: 7
Joined: Sun Oct 12, 2014 8:37 pm

Re: Multi-console gamepad driver for GPIO

Sun Oct 12, 2014 9:27 pm

mahjongg wrote:You shouldn't power the controller with 5V, as the chip in the controller will then also output a 5V data signal, which in time will damage the PI! The GPIO's are NOT 5V compatible.

Also, when powered with 5V the chip may not respond to the 3.3V control signals, as it needs "high" signals of at least 70% of VDD, which for VDD=5V is 3.5V, which explains why it doesn't work too.

The 74HC4021 chip inside the controller works fine with voltages as low as 3.0Volt.

Image
Great info. Thanks! I have also tried 3.3V input supply, and I have the same issue.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12591
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Multi-console gamepad driver for GPIO

Mon Oct 13, 2014 12:12 am

are you sure the GPIO with the data input still works?

At least the gamepad should now get a slick and latch signals, that is if a driver is driving the right gpio's.
also are you sure the driver running, and is actively (trying) to read the buttons, it should be creating a clock signal for the clock input, and a slower latch signal, both should be detectable with a scope, or as they are probably in hearing range (especially the latch signal) you should be able to sense them with a signal detector (like a speaker amplifier). Also the data signal should react to buttons pressed, and even with a multimeter you should be able to detect if one or more buttons are pressed. with no buttons pressed the signal on the data output pin should be close to 3V3, but should sink if more buttons are pressed (a multimeter will average out the signal on the data pin).

jon-whit
Posts: 7
Joined: Sun Oct 12, 2014 8:37 pm

Re: Multi-console gamepad driver for GPIO

Mon Oct 13, 2014 2:18 am

mahjongg wrote:are you sure the GPIO with the data input still works?

At least the gamepad should now get a slick and latch signals, that is if a driver is driving the right gpio's.
also are you sure the driver running, and is actively (trying) to read the buttons, it should be creating a clock signal for the clock input, and a slower latch signal, both should be detectable with a scope, or as they are probably in hearing range (especially the latch signal) you should be able to sense them with a signal detector (like a speaker amplifier). Also the data signal should react to buttons pressed, and even with a multimeter you should be able to detect if one or more buttons are pressed. with no buttons pressed the signal on the data output pin should be close to 3V3, but should sink if more buttons are pressed (a multimeter will average out the signal on the data pin).
I whipped out the DMM tonight and verified the 3.3v output on the data signal. The data output voltage didn't change with buttons being pressed though, so that is concerning? Also, I should have mentioned that I am using the model B pi.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12591
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Multi-console gamepad driver for GPIO

Mon Oct 13, 2014 8:04 am

the model is of no importance here.

i'm guessing you have no (suitable) driver installed, so the 4021 chip simply isn't clocked. hard to find out with just a dvm.

LucaToni
Posts: 1
Joined: Mon Oct 20, 2014 5:05 pm

Re: Multi-console gamepad driver for GPIO

Mon Oct 20, 2014 7:29 pm

Firstly, I'd to thank everyone who's contributed to the RetroPie project, the Multi-console gamepad driver, this thread, the Raspberry Pi forum, and the Raspberry Pi community in general, for making all this possible - I can't thank you enough =)




Questions RE: Db9_gpio_rpi
  1. Introduction

    Connection of db9 joysticks to RPi's GPIO requires no extra hardware in most cases
    - In what cases would extra hardware be required specifically?
  2. Joystick support

    The list of supported db9 joysticks is below. Since the number of GPIO pins is limited, only 2 joysticks can be used simultaneously.
    • Atari, Commodore, Amiga etc. db9 multisystem joysticks (1-3 buttons)
    • Sega Mega Drive (Genesis) pads
    • Sega Saturn controllers (Note: custom connector instead of db9)
    • Amiga CD32 pads
    - Raspberry Pi B+ has 40 GPIO pins (instead of 26), does that mean more controllers can be used simultaneously, say 4?
    - Are 3rd party 6-button Mega Drive pads included or is it just original brand ones?
  3. GPIO interface

    Pi's GPIO data pins operate at 3.3V and aren't 5V tolerant (see this), so 3.3V '''must''' be used for joysticks requiring power even though they'd be designed for 5V. However, some TTL-based joysticks may not function correctly using 3.3V supply. If they need to be powered from 5V, level shifters must be added between output pins of joystick and GPIO input pins. For example, 74LVC245 is an IC which can be used for this downconversion.
    - How do I tell if my joystick is TTL, RTL, DTL, etc.?
    -- For example, SpeedPad by Logic3 (6-button Sega Mega Drive pad with a mode button and a turbo switch too).

    - SN74LVC245AN by Texas Instruments is probably the most easily and cheapest available. However on the first page of its datasheet it says:
    To ensure the high-impedance state during power up or power down, OE should be tied to VCC through a pullup resistor; the minimum value of the resistor is determined by the current-sinking capability of the driver.

    Inputs can be driven from either 3.3-V or 5-V devices. This feature allows the use of this device as a translator in a mixed 3.3-V/5-V system environment.

    This device is fully specified for partial-power-down applications using I off. The I off circuitry disables the outputs, preventing damaging current backflow through the device when it is powered down.
    - Just like many other instructions by manufacturers/distributors/tutorials for use of a level shifter, use in conjunction with a pull-up resister is stated. But of how many ohms?
  4. The following image shows the pins used by the driver, and mappings are listed in the table next to it.
    Image

    Code: Select all

    ╔═════════════════╦════════════════╦════════════════╗
    ║ Button/Function ║ PORT1 GPIO pin ║ PORT2 GPIO pin ║
    ╠═════════════════╬════════════════╬════════════════╣
    ║ UP              ║              4 ║             15 ║
    ║ DOWN            ║              7 ║             17 ║
    ║ LEFT            ║              8 ║             18 ║
    ║ RIGHT           ║              9 ║             22 ║
    ║ FIRE1           ║             10 ║             23 ║
    ║ FIRE2 / SELECT1 ║             11 ║             24 ║
    ║ FIRE3 / SELECT0 ║             14 ║             25 ║
    ╚═════════════════╩════════════════╩════════════════╝
    
    - Can this image and table be updated for B+ model, please? Or are there no changes, even if 4 controllers (if possible) were to be added?
  5. Usage

    Code: Select all

    ╔════╦═══════════════════════════════╗
    ║ ID ║          Description          ║
    ╠════╬═══════════════════════════════╣
    ║  0 ║ (No joystick)                 ║
    ║  1 ║ Multisystem 1-button joystick ║
    ║  2 ║ Multisystem 2-button joystick ║
    ║  3 ║ Multisystem 3-button joystick ║
    ║  4 ║ MD/Genesis pad (3+1 buttons)  ║
    ║  5 ║ MD/Genesis pad (5+1 buttons)  ║
    ║  6 ║ MD/Genesis pad (6+2 buttons)  ║
    ║  7 ║ Sega Saturn controller        ║
    ║  8 ║ Amiga CD32 gamepad            ║
    ╚════╩═══════════════════════════════╝
    
    - Do the +2 buttons in ID 6 refer to the Start and Mode buttons and does having a turbo switch make any difference here in terms of compatibility?
  6. There also other questions like: 'Is it one level shifter (and resister) per controller?', 'Is additional power supply needed?', 'Where can I find a detail tutorial/schematic - a bit like what mahjongg posted above - for connecting DB9 (Sega Mega Drive) controllers, but that is a bit more clear/thorough/noob-proof?' - which if would be answered would help immeasurably.

Again, thank you.
Luca

epellejer
Posts: 5
Joined: Tue Nov 04, 2014 7:30 am

Re: Multi-console gamepad driver for GPIO

Fri Nov 07, 2014 11:21 pm

Hi everyone. I am trying to use db9_gpio_rpi drivers to connect an original megadrive/genesis pad to my raspberry pi. When I try to load the module using modprobe I get the message "ERROR: could not insert 'db9_gpio_rpi': Exec format error". In order to fix the problem I am supposed to run "Install/update multi-console gamepad drivers for GPIO"-option in RetroPie setup. However that option is not in my retropie_setup.sh, instead of that I run "Gamecon driver" which I guess includes the download of the newest db9_gpio_rpi module. After reboot I obtain the same error message when using modprobe.

Can someone please help me on this? I am totally new on raspberry pi and linux so I get lost quite easily.

Thanks in advance.

hazardovich
Posts: 3
Joined: Thu Dec 11, 2014 11:20 am
Location: Russia

Re: Multi-console gamepad driver for GPIO

Thu Dec 11, 2014 11:53 am

Hi all!
I have 2 chinese 6-button megadrive controllers, and in jstest axis, a,b,c,start buttons work fine, but x,y,z, and mode buttons always "on" and flick to "off" state. But they do work fine on a real Megadrive. That may be wrong?

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Multi-console gamepad driver for GPIO

Thu Dec 11, 2014 5:43 pm

Hi hazardovich,

Do you use the map=6 parameter when you load the driver ?

hazardovich
Posts: 3
Joined: Thu Dec 11, 2014 11:20 am
Location: Russia

Re: Multi-console gamepad driver for GPIO

Thu Dec 11, 2014 8:09 pm

DigitalLumberjack wrote:Hi hazardovich,

Do you use the map=6 parameter when you load the driver ?
of course!
Here is a guy exactly the same problem: http://blog.petrockblock.com/forums/top ... ontroller/

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Multi-console gamepad driver for GPIO

Fri Dec 12, 2014 9:42 am

Ok,

Could be a bug in the db9 driver.

marqs you here ? :P

Sadly i cannot check if it is as i have no megadrive controller.

Anyone on this thread already manage to make a 6btn controller work with db9 ?

hazardovich
Posts: 3
Joined: Thu Dec 11, 2014 11:20 am
Location: Russia

Re: Multi-console gamepad driver for GPIO

Mon Dec 22, 2014 9:28 am

marqs where are you?

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

Re: Multi-console gamepad driver for GPIO

Fri Feb 13, 2015 3:40 pm

hazardovich wrote:marqs where are you?
I'm sorry for the long response time - for some reason I stopped receiving automatic e-mail notifications on new posts in the topic last fall, and thought the topic would be dead...

As an answer your earlier question, I've only tested the driver with an official MD 6-button controller, which didn't have any issues. I can try to get a generic unofficial controller for testing.

Return to “Gaming”