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

Re: Multi-console gamepad driver for GPIO

Thu Aug 04, 2016 9:46 pm

Seems like you don't have bc installed. Try running "sudo apt-get install bc" before installing the headers.

larsmjoh
Posts: 8
Joined: Sun Jul 31, 2016 6:30 pm

Re: Multi-console gamepad driver for GPIO

Fri Aug 05, 2016 9:08 pm

So, now I've got a segfault instead... :-(

Code: Select all

  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  CHK     include/generated/bounds.h
  UPD     include/generated/bounds.h
  CHK     include/generated/timeconst.h
Segmentation fault
Kbuild:66: recipe for target 'include/generated/timeconst.h' failed
make[1]: *** [include/generated/timeconst.h] Error 139
Makefile:987: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.16+'

larsmjoh
Posts: 8
Joined: Sun Jul 31, 2016 6:30 pm

Re: Multi-console gamepad driver for GPIO

Mon Aug 08, 2016 8:08 pm

larsmjoh wrote:So, now I've got a segfault instead... :-(

Code: Select all

  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  CHK     include/generated/bounds.h
  UPD     include/generated/bounds.h
  CHK     include/generated/timeconst.h
Segmentation fault
Kbuild:66: recipe for target 'include/generated/timeconst.h' failed
make[1]: *** [include/generated/timeconst.h] Error 139
Makefile:987: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.16+'
I tried installing the complete kernel source by hand, but I get the same segfault when I do 'make oldconfig && make prepare'

Any ideas..?

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

Re: Multi-console gamepad driver for GPIO

Mon Aug 08, 2016 9:20 pm

larsmjoh wrote:
larsmjoh wrote:So, now I've got a segfault instead... :-(

Code: Select all

  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  CHK     include/generated/bounds.h
  UPD     include/generated/bounds.h
  CHK     include/generated/timeconst.h
Segmentation fault
Kbuild:66: recipe for target 'include/generated/timeconst.h' failed
make[1]: *** [include/generated/timeconst.h] Error 139
Makefile:987: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.16+'
I tried installing the complete kernel source by hand, but I get the same segfault when I do 'make oldconfig && make prepare'

Any ideas..?
It looks like gcc itself is segfaulting. I just tried installing the headers for original Pi (also armv6l) and it went just fine (with gcc 4.9.2). You might try running "make -C /usr/src/linux-headers-4.4.16+ modules_prepare V=1" to get a better idea where it fails.

larsmjoh
Posts: 8
Joined: Sun Jul 31, 2016 6:30 pm

Re: Multi-console gamepad driver for GPIO

Mon Aug 22, 2016 7:13 pm

marqs wrote:It looks like gcc itself is segfaulting. I just tried installing the headers for original Pi (also armv6l) and it went just fine (with gcc 4.9.2). You might try running "make -C /usr/src/linux-headers-4.4.16+ modules_prepare V=1" to get a better idea where it fails.
So, I finaly got around to try your suggestion. This time I tried on a fresh RetroPIe installation and this is what it spat out:

Code: Select all

pi@retropie:~$ sudo make -C /usr/src/linux-rpi-4.4.11+ modules_prepare V=1
make: Entering directory '/usr/src/linux-rpi-4.4.11+'
set -e; : '  CHK     include/config/kernel.release'; mkdir -p include/config/;  echo "4.4.16$(/bin/bash ./scripts/setlocalversion .)" < include/config/auto.conf > include/config/kernel.release.tmp; if [ -r include/config/kernel.release ] && cmp -s include/config/kernel.release include/config/kernel.release.tmp; then rm -f include/config/kernel.release.tmp; else : '  UPD     include/config/kernel.release'; mv -f include/config/kernel.release.tmp include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic \
            src=asm obj=arch/arm/include/generated/asm
make -f ./scripts/Makefile.asm-generic \
            src=uapi/asm obj=arch/arm/include/generated/uapi/asm
set -e; : '  CHK     include/generated/uapi/linux/version.h'; mkdir -p include/generated/uapi/linux/;   (echo \#define LINUX_VERSION_CODE 263184; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) < Makefile > include/generated/uapi/linux/version.h.tmp; if [ -r include/generated/uapi/linux/version.h ] && cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/version.h.tmp; then rm -f include/generated/uapi/linux/version.h.tmp; else : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/version.h.tmp include/generated/uapi/linux/version.h; fi
rm -f include/linux/version.h
set -e; : '  CHK     include/generated/utsrelease.h'; mkdir -p include/generated/;      if [ `echo -n "4.4.16" | wc -c ` -gt 64 ]; then echo '"4.4.16" exceeds 64 characters' >&2; exit 1; fi; (echo \#define UTS_RELEASE \"4.4.16\";) < include/config/kernel.release > include/generated/utsrelease.h.tmp; if [ -r include/generated/utsrelease.h ] && cmp -s include/generated/utsrelease.h include/generated/utsrelease.h.tmp; then rm -f include/generated/utsrelease.h.tmp; else : '  UPD     include/generated/utsrelease.h'; mv -f include/generated/utsrelease.h.tmp include/generated/utsrelease.h; fi
mkdir -p .tmp_versions 
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=arch/arm/tools include/generated/mach-types.h
make[1]: 'include/generated/mach-types.h' is up to date.
make -f ./scripts/Makefile.build obj=.
mkdir -p kernel/
set -e; : '  CHK     include/generated/bounds.h'; mkdir -p include/generated/;  (set -e; echo "#ifndef __LINUX_BOUNDS_H__"; echo "#define __LINUX_BOUNDS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne  "/^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; echo ""; echo "#endif" ) < kernel/bounds.s > include/generated/bounds.h.tmp; if [ -r include/generated/bounds.h ] && cmp -s include/generated/bounds.h include/generated/bounds.h.tmp; then rm -f include/generated/bounds.h.tmp; else : '  UPD     include/generated/bounds.h'; mv -f include/generated/bounds.h.tmp include/generated/bounds.h; fi
set -e; : '  CHK     include/generated/timeconst.h'; mkdir -p include/generated/;       (echo 100 | bc -q kernel/time/timeconst.bc ) < kernel/time/timeconst.bc > include/generated/timeconst.h.tmp; if [ -r include/generated/timeconst.h ] && cmp -s include/generated/timeconst.h include/generated/timeconst.h.tmp; then rm -f include/generated/timeconst.h.tmp; else : '  UPD     include/generated/timeconst.h'; mv -f include/generated/timeconst.h.tmp include/generated/timeconst.h; fi
Segmentation fault
Kbuild:66: recipe for target 'include/generated/timeconst.h' failed
make[1]: *** [include/generated/timeconst.h] Error 139
Makefile:987: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: Leaving directory '/usr/src/linux-rpi-4.4.11+'
Does it make any sense to you?

Thanx...

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

Re: Multi-console gamepad driver for GPIO

Tue Aug 23, 2016 10:29 pm

larsmjoh wrote:
marqs wrote:It looks like gcc itself is segfaulting. I just tried installing the headers for original Pi (also armv6l) and it went just fine (with gcc 4.9.2). You might try running "make -C /usr/src/linux-headers-4.4.16+ modules_prepare V=1" to get a better idea where it fails.
So, I finaly got around to try your suggestion. This time I tried on a fresh RetroPIe installation and this is what it spat out:

Code: Select all

pi@retropie:~$ sudo make -C /usr/src/linux-rpi-4.4.11+ modules_prepare V=1
make: Entering directory '/usr/src/linux-rpi-4.4.11+'
set -e; : '  CHK     include/config/kernel.release'; mkdir -p include/config/;  echo "4.4.16$(/bin/bash ./scripts/setlocalversion .)" < include/config/auto.conf > include/config/kernel.release.tmp; if [ -r include/config/kernel.release ] && cmp -s include/config/kernel.release include/config/kernel.release.tmp; then rm -f include/config/kernel.release.tmp; else : '  UPD     include/config/kernel.release'; mv -f include/config/kernel.release.tmp include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic \
            src=asm obj=arch/arm/include/generated/asm
make -f ./scripts/Makefile.asm-generic \
            src=uapi/asm obj=arch/arm/include/generated/uapi/asm
set -e; : '  CHK     include/generated/uapi/linux/version.h'; mkdir -p include/generated/uapi/linux/;   (echo \#define LINUX_VERSION_CODE 263184; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) < Makefile > include/generated/uapi/linux/version.h.tmp; if [ -r include/generated/uapi/linux/version.h ] && cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/version.h.tmp; then rm -f include/generated/uapi/linux/version.h.tmp; else : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/version.h.tmp include/generated/uapi/linux/version.h; fi
rm -f include/linux/version.h
set -e; : '  CHK     include/generated/utsrelease.h'; mkdir -p include/generated/;      if [ `echo -n "4.4.16" | wc -c ` -gt 64 ]; then echo '"4.4.16" exceeds 64 characters' >&2; exit 1; fi; (echo \#define UTS_RELEASE \"4.4.16\";) < include/config/kernel.release > include/generated/utsrelease.h.tmp; if [ -r include/generated/utsrelease.h ] && cmp -s include/generated/utsrelease.h include/generated/utsrelease.h.tmp; then rm -f include/generated/utsrelease.h.tmp; else : '  UPD     include/generated/utsrelease.h'; mv -f include/generated/utsrelease.h.tmp include/generated/utsrelease.h; fi
mkdir -p .tmp_versions 
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=arch/arm/tools include/generated/mach-types.h
make[1]: 'include/generated/mach-types.h' is up to date.
make -f ./scripts/Makefile.build obj=.
mkdir -p kernel/
set -e; : '  CHK     include/generated/bounds.h'; mkdir -p include/generated/;  (set -e; echo "#ifndef __LINUX_BOUNDS_H__"; echo "#define __LINUX_BOUNDS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne  "/^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; echo ""; echo "#endif" ) < kernel/bounds.s > include/generated/bounds.h.tmp; if [ -r include/generated/bounds.h ] && cmp -s include/generated/bounds.h include/generated/bounds.h.tmp; then rm -f include/generated/bounds.h.tmp; else : '  UPD     include/generated/bounds.h'; mv -f include/generated/bounds.h.tmp include/generated/bounds.h; fi
set -e; : '  CHK     include/generated/timeconst.h'; mkdir -p include/generated/;       (echo 100 | bc -q kernel/time/timeconst.bc ) < kernel/time/timeconst.bc > include/generated/timeconst.h.tmp; if [ -r include/generated/timeconst.h ] && cmp -s include/generated/timeconst.h include/generated/timeconst.h.tmp; then rm -f include/generated/timeconst.h.tmp; else : '  UPD     include/generated/timeconst.h'; mv -f include/generated/timeconst.h.tmp include/generated/timeconst.h; fi
Segmentation fault
Kbuild:66: recipe for target 'include/generated/timeconst.h' failed
make[1]: *** [include/generated/timeconst.h] Error 139
Makefile:987: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: Leaving directory '/usr/src/linux-rpi-4.4.11+'
Does it make any sense to you?

Thanx...
The following subscript might be the source of the error:

Code: Select all

(echo 100 | bc -q kernel/time/timeconst.bc ) < kernel/time/timeconst.bc
From the log it seems you're now running kernel 4.4.11+ which does not have updated header packages (e.g. missing timeconst.bc).

larsmjoh
Posts: 8
Joined: Sun Jul 31, 2016 6:30 pm

Re: Multi-console gamepad driver for GPIO

Sun Sep 04, 2016 6:56 pm

Tried installing on latest RetroPie (4.0.2) - worked like a charm!
(Apparently it has correct kernel headers installed)

larsmjoh
Posts: 8
Joined: Sun Jul 31, 2016 6:30 pm

Re: Multi-console gamepad driver for GPIO

Thu Sep 22, 2016 10:35 pm

So, ehm...

...has anyone actually gotten these working with UAE (either version)? If so, what's the trick? I can't seem to get them to work, nothing happens (works fine in ES GUI).

Thanx,
Lars

Scias
Posts: 2
Joined: Mon Dec 12, 2016 12:00 pm

Re: Multi-console gamepad driver for GPIO

Mon Dec 12, 2016 12:16 pm

marqs wrote:
Soullous wrote:Thanks. I updated to 1.1. I'm not sure exactly what changed, but the buttons on all of my controllers (PS1 and PS2) seem to have a mind of their own now. They all seem to be registering randomly, as soon as the controllers are plugged in, and actually pressing the buttons seems to have no effect. I did try changing the psx_delay from 10 to 25, and then to 50, with no effect.
I modified the new version so that tweaking psx_delay is no more needed (and has no effect). I made a new test today, using RPi v2 (used RPi1 originally) and testing different pins. I think I found the reason why some people are having problems with PSX controllers: the internal pull-up resistors are not sufficient for reliable operation. The solution is to use gpio pins P1-03 or P1-05 for the data line (1.8kohm onboard pull-up). If more than 2 controllers needs to be plugged or if those pins are used for something else, an external pull-up resistor (anything between 1.8k-4.7k should be fine) must be added per each additional data pin (GPIO4 / GPIO7) and 3.3V.

Tested 2 different controllers with driver version 1.1 using that setup, and everything worked reliably. Analog sticks registered slight random movement at rest though, but that might be a controller "feature" and can be filtered out with suitable deadzone settings.
hi sir Marqs, I'm a Raspberry Pi 2 Model B+ user and currently using Retropie. I'm having trouble connecting my PSX GamePad SCPHC1200 to Pi using GPIO.
Edit: I only have one gamepad.

Q1: how do I map driver properly? currently using
map=0,0,0,0,7,7
Q2: why is my Retropie detecting 2 Gampeds, (1) USB Gamepad, (2) PSX Controller
yes it was red by my system.
Q3: when I try jstest0 or jstest1 I get a response that both gamepads are active, but when I do to push button(triangle X, Circle, Square) there is no right response some should be "yes" if I pushed any of this right?
Q4: regarding your post in my quote I wanna know how to setup wires correctly because I believe it was the missing object.
Q5: can I request for a clear Schematic Diagram on how to configure wires onto Pi's Pins.

thank you for reading and bear with my English I'm not a good in English.
I will have a further more questions hope I can hear from you soon. That is all for this time being.

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

Re: Multi-console gamepad driver for GPIO

Mon Dec 12, 2016 7:05 pm

Scias wrote:hi sir Marqs, I'm a Raspberry Pi 2 Model B+ user and currently using Retropie. I'm having trouble connecting my PSX GamePad SCPHC1200 to Pi using GPIO.
Edit: I only have one gamepad.

Q1: how do I map driver properly? currently using
map=0,0,0,0,7,7
Q2: why is my Retropie detecting 2 Gampeds, (1) USB Gamepad, (2) PSX Controller
yes it was red by my system.
Q3: when I try jstest0 or jstest1 I get a response that both gamepads are active, but when I do to push button(triangle X, Circle, Square) there is no right response some should be "yes" if I pushed any of this right?
Q4: regarding your post in my quote I wanna know how to setup wires correctly because I believe it was the missing object.
Q5: can I request for a clear Schematic Diagram on how to configure wires onto Pi's Pins.

thank you for reading and bear with my English I'm not a good in English.
I will have a further more questions hope I can hear from you soon. That is all for this time being.
Hi,

A1: If you have connected data pin to GPIO2, use map=0,0,0,0,7,0
A2: Previous mapping configured 2 pads, not sure why other one was shown as usb controller
A3: Please double-check your connections
A4: If you use GPIO2 or GPIO3, there is no need for external resistors.
A5: The connection is very straightforward. I don't have an illustration at the moment, but below is connection guide from README:

Code: Select all

Rpi pin				     PSX controller pin

P1-01 (3.3V)  ====      5 (power/3.3V)
GPIO14        --->      2 (command)
GPIO15        --->      6 (select)
GPIO18        --->      7 (clock)
GPIOXX        <---      1 (data)
P1-06 (GND)   ====      4 (ground)

Scias
Posts: 2
Joined: Mon Dec 12, 2016 12:00 pm

Re: Multi-console gamepad driver for GPIO

Tue Dec 13, 2016 3:55 am

yes sir Marqs. you are right in your presumption in your A2. I previously configured Generic USB Gamepad. I configured USB first, I think that is why I'm having problems? I tried to map my driver using map=0,0,0,0,7,0 and still 0/0 PSX Gamepad Configured appears when I try to launch a PSX game the with jstest and menu set Input, there is no right response from gamepad. please help.

munskey
Posts: 1
Joined: Thu Dec 22, 2016 1:40 am

Re: Multi-console gamepad driver for GPIO

Thu Dec 22, 2016 2:08 am

I recently installed a GERT VGA 666 hat on my RPi, then connected it to a Sony PVM and am loving RetroPie in RGB glory all over again. Due to the GERT hat the Gamecon GPIO ports are now occupied, so I am back to using USB controllers. Prior to installing the GERT board I was able to successfully use the Gamecon drivers and loved the feel of the original (S)NES controllers and low controller lag inherit of the gpio connection. Thanks for the great work @marqs

Is it possible to create a version of the Gamecon driver that is compatible with the GERT VGA 666 board? The GERT board has GPIO 22-27 available (note those are NOT the physical pin numbers, they are the internal GPIO numbers). Unfortunately this modification is beyond me - I have no experience building linux drivers and deciphering the bitwise operations and pointers in the gamecon driver left me a bit lost.

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

Re: Multi-console gamepad driver for GPIO

Thu Dec 22, 2016 11:19 pm

Scias wrote:yes sir Marqs. you are right in your presumption in your A2. I previously configured Generic USB Gamepad. I configured USB first, I think that is why I'm having problems? I tried to map my driver using map=0,0,0,0,7,0 and still 0/0 PSX Gamepad Configured appears when I try to launch a PSX game the with jstest and menu set Input, there is no right response from gamepad. please help.
Does the DualShock led light up, and are all button values stuck to off in jstest?
munskey wrote:Is it possible to create a version of the Gamecon driver that is compatible with the GERT VGA 666 board? The GERT board has GPIO 22-27 available (note those are NOT the physical pin numbers, they are the internal GPIO numbers). Unfortunately this modification is beyond me - I have no experience building linux drivers and deciphering the bitwise operations and pointers in the gamecon driver left me a bit lost.
Depending on RPi model, 5 or 6 pins from GPIO 22-27 are routed to gpio header which would be enough for 3-4 NES/SNES controllers. The driver would then need be customized just for this purpose by changing values on a couple source code lines. I can post the required changes here along with rebuild commands next week when I have more time.

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

Re: Multi-console gamepad driver for GPIO

Fri Dec 30, 2016 8:36 pm

Below is a list of changes you can apply to /usr/src/gamecon_gpio_rpi-1.2/gamecon_gpio_rpi.c to change gpio ids to following:

GPIO22: Gamepad3
GPIO23: Gamepad4
GPIO25: snes_clk
GPIO27: snes_latch

Code: Select all

lines 116-117:
static const int gc_status_bit[] = { 0x01, 0x02, (1<<22), (1<<23), 0x04, 0x08 };
static const int gc_gpio_ids[] = { 0, 1, 22, 23, 2, 3 };

lines 429-430:
#define GC_NES_CLOCK    (1<<25)
#define GC_NES_LATCH    (1<<27)

lines 1143-1144:
*(gpio+2) &= ~((7<<15) | (7<<21));
*(gpio+2) |= ((1<<15) | (1<<21));
Then recompile the driver by running make in /usr/src/gamecon_gpio_rpi-1.2 directory. Now you can load the modified by running "sudo insmod /usr/src/gamecon_gpio_rpi-1.2/gamecon_gpio_rpi.ko map=0,0,1,1".

darksavior
Posts: 4
Joined: Sat Jul 25, 2015 7:56 am

Re: Multi-console gamepad driver for GPIO

Sun Jan 01, 2017 6:07 pm

Is there a kodi 17 add on or a way to get my gamecon snes pads working in kodi? USB pads work on my libreelec kodi partition. Snes pads work in my retropie partition with the gamecon driver.

fdr4prez
Posts: 17
Joined: Fri May 13, 2016 8:06 pm

Re: Multi-console gamepad driver for GPIO

Mon Jan 16, 2017 10:54 pm

I've posted this on the RetroPie forum, but no responses, yet. Sorry for any cross-posting, but this thread appears to be more dedicated for this driver.

I am using Pi Zero with RetroPie v4.1

Preformed these updates:
sudo apt-get update
sudo apt-get dist-upgrade

Used RetroPie to install the DB9 driver:
RetroPie-Setup > Manage Packages > Manage Driver Packages > gamecontroller > install from binaries

Viewed the readme in /usr/share/doc/db9_gpio_rpi/README.gz

Opened the console and loaded the driver:
sudo modprobe --first-time db9_gpio_rpi map=1,1

There was no feedback that it was successful, or anything, but if I do it again, it reports that it is already loaded in the kernel. So it appears to be loading something.

I do see that /dev/input/js0 and /dev/input/js1 are created but they are basically empty. JS0 = 0kb and JS1 = 1kb

And the joystick does not work.

Also in the readme is says for auto-loading on reboot go to etc/modules and add db9_gpio_rpi map=1,1 but after reboot the driver is not loaded.

There was a post on the RetroPie forum indicating that loading drivers in the etc/modules is not supported any longer, and it was suggested in that post to create a conf file in etc/modprobe.d/ with contents options db9_gpio_rpi map=1,1 and for that particular post it appears to work that way.

But for me that does not seem to auto-load the driver either because after reboot there is no JS0 or JS1 created.

so overall it seems that the driver can be manually loaded and does not work, and it is not auto-loaded when rebooted.

What else am I missing to get this driver working?

Jofo
Posts: 1
Joined: Wed Jan 25, 2017 9:24 pm

Re: Multi-console gamepad driver for GPIO

Wed Jan 25, 2017 9:32 pm

Hello,

I have a problem with the gamecon driver. I wanted to hook up two DualShock2 controllers using a adapter, more in here:

https://retropie.org.uk/forum/topic/639 ... to-work/21

The problem is random input - I get random START and SELECT. I was experimenting with the delay, I've seen online the recommended values, but no matter what, I still have issues (I am running Retropie on RSPi 3 B).

My questions are:
1. What psx_delay should I set?
2. Where is the source code of the driver? Any SVN/GIT? (OK I've found the source code...) I am a coder, I may have a look at it. Besides, here https://retropie.org.uk/forum/topic/675 ... m-input/18 is probably someone, who has fixed it
3. Is rumble supported in the driver?

Thanks

110sasa
Posts: 2
Joined: Sat Feb 04, 2017 12:49 pm

PSX multitap (scph-1070)

Sat Feb 04, 2017 1:05 pm

Hi,

today I bought PSX multitap at second-hand shop thinking that if I can make GPIO interface from this.
It seems easy for me only one gamepad to connect, but I think whether all four ports can be used if possible.
Are there any resources to help?

Denisuu
Posts: 6
Joined: Sun Jan 22, 2017 10:32 pm

Re: Multi-console gamepad driver for GPIO

Sun Feb 26, 2017 3:39 pm

Does wire thickness and length matter much?

I soldered a header from an old motherboard onto the SNES controller plate and connected it with a 67cm jumper cable. I checked continuity with a multi-meter on all the points.

Image
Image

On controller 1 only "B' button works and it triggers all buttons at once (GPIO4=Pin07).

Image

I can't get controller 2 to do anything (GPIO7=Pin26 or GPIO3=Pin05)
gamecon_gpio_rpi map=0,0,1,1,0,0 or gamecon_gpio_rpi map=0,0,1,0,0,1...

It seems to be a common problem here, Should I start by trimming the wire length or solder them directly to the ports?

Denisuu
Posts: 6
Joined: Sun Jan 22, 2017 10:32 pm

Re: Multi-console gamepad driver for GPIO

Mon Feb 27, 2017 4:48 pm

I tried with the thickest/shortest wire I could find but still no luck.

Image

Zerorob
Posts: 1
Joined: Tue May 02, 2017 2:37 pm

Re: Multi-console gamepad driver for GPIO

Tue May 02, 2017 2:40 pm

Im having troubles reconfiguring the driver to use different data ports, I really just need to move the gpio4 that uses pin 7 as I'm using a petrockblock power block that occupies that pin.

Any help on how to change that would be great. The method above doesn't seem to work, and I get errors compiling it

darksavior
Posts: 4
Joined: Sat Jul 25, 2015 7:56 am

Re: Multi-console gamepad driver for GPIO

Wed May 03, 2017 9:41 am

The gamecon driver is broken as of version 4.9.24-v7+ of the kernel. Version 4.2.2 of Retropie. No fix yet. My error log is here:
https://github.com/RetroPie/RetroPie-Setup/issues/1963

PiffundPaff
Posts: 3
Joined: Sat Aug 16, 2014 10:44 am

Re: Multi-console gamepad driver for GPIO

Mon Jun 19, 2017 7:29 pm

So I dont know if someone still reads this but Im using the db9_gpio_rpi driver for my genesis controller. Working fine right now.

In addition I want to use some other buttons on the following GPIOs
GPIO 21
GPIO 26
GPIO 19
GPIO 13
GPIO 6
GPIO 5

the Code for these is based on a python script.

The script is working fine as long as the db9_gpio_rpi is not active.

If the system is configured for the db9_gpio_rpi it is behaveing strange.

GPIO 21 is set as a exit button to terminate the emulator and to return to emulationstation.
While db9_gpio_rpi is active it exits the emulator but I get a black screen in emulationstation. So basicly nothing is happening but I can press Start to get to the emulationstation option screen and restart emulationstation.
the code from this is here:

Code: Select all

from time import sleep
import os
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

def exitEmulator(channel):
    print('exitEmulator')
    pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]

    for pid in pids:
        try:
            commandpath = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
            if commandpath[0:24] == '/opt/retropie/emulators/':
                os.system('kill -QUIT %s' % pid)
                print('kill -QUIT %s' % pid)
        except IOError:
            continue
GPIO.add_event_detect(17, GPIO.RISING, callback=exitEmulator, bouncetime=500)

while True:
    sleep(10)
The rest of the GPIOs are configured to load db9_gpio_rpi or unload it and load other drivers for other controllers. Works fine but if db9_gpio_rpi is active, the system just reboots or crashed.

I think since both are using the GPIOs there should be the problem but Im not a good enough coder to figure the driver out all by myself.

The code for the other script is longer but i can post it too if needed.

Update: I tested the exit emulator with the button combo from emulationstation and it is the same thing.

Thanks for the help!

DD-Indeed
Posts: 1
Joined: Sun Jun 25, 2017 9:55 am

Re: Multi-console gamepad driver for GPIO

Sun Jun 25, 2017 10:07 am

Hi! New to this place, but started by PiStation project couple days ago. So far things have gone nicely, but I can't get Playstation controllers to work with GPIO-wiring. I've followed all of the guides correct, wirings are correct, but the Pi 3 does not recognize the pad at all. I'm assuming that the wirings are now correct like this:

PSX pad wirings.jpg
PSX pad wirings.jpg (55.11 KiB) Viewed 385 times
(this is just a temp test solution, wirings and soldering will be done better when I get this working ;) )


Some guides tell to use the 3.3V pin (PI-01) instead, but I had my doubts, since when I used the pad on that, the Analog Light didn't pop up at all. So I'm now using the PI-02 pin instead.

So, what possibilities there might be for this error ?

BornDead
Posts: 1
Joined: Wed Aug 16, 2017 10:25 am

Re: Multi-console gamepad driver for GPIO

Wed Aug 16, 2017 12:44 pm

marqs wrote:
Fri Dec 30, 2016 8:36 pm
Below is a list of changes you can apply to /usr/src/gamecon_gpio_rpi-1.2/gamecon_gpio_rpi.c to change gpio ids to following:

GPIO22: Gamepad3
GPIO23: Gamepad4
GPIO25: snes_clk
GPIO27: snes_latch

Code: Select all

lines 116-117:
static const int gc_status_bit[] = { 0x01, 0x02, (1<<22), (1<<23), 0x04, 0x08 };
static const int gc_gpio_ids[] = { 0, 1, 22, 23, 2, 3 };

lines 429-430:
#define GC_NES_CLOCK    (1<<25)
#define GC_NES_LATCH    (1<<27)

lines 1143-1144:
*(gpio+2) &= ~((7<<15) | (7<<21));
*(gpio+2) |= ((1<<15) | (1<<21));
Then recompile the driver by running make in /usr/src/gamecon_gpio_rpi-1.2 directory. Now you can load the modified by running "sudo insmod /usr/src/gamecon_gpio_rpi-1.2/gamecon_gpio_rpi.ko map=0,0,1,1".
Hello! I am trying to change the GPIO location for player 5 and 6 (default pin 2,3) to pin 22 and 23.
I have tried to change to this:

Code: Select all

/* GPIO pins 0, 1, 4, 7, 22, 23 */
static const int gc_status_bit[] = { 0x01, 0x02, 0x10, 0x80, (1<<22), (1<<23) };
static const int gc_gpio_ids[] = { 0, 1, 4, 7, 22, 23 };
But it´s not working, could you guide me how to fix it? Is there anything I need to edit on lines 1143-1144? All I changed is the code I wrote.

EDIT: I successfully figured it out myself by trial and error, but would like to learn how to define GPIO-pin number codes.
Now I have the following setup on my RPI3:
  • PIN01 | 5V
  • PIN06 | GROUND
  • PIN19 | CLOCK
  • PIN23 | LATCH
  • PIN07 | DATA3 (NES1)
  • PIN26 | DATA4 (NES2)
  • PIN29 | DATA5 (SNES1)
  • PIN31 | DATA6 (SNES2)
Image

The new code:

Code: Select all

/* GPIO pins 0, 1, 4, 7, 29, 31 */
static const int gc_status_bit[] = { 0x01, 0x02, 0x10, 0x80, 0x20, 0x40 };
static const int gc_gpio_ids[] = { 0, 1, 4, 7, 29, 31 };

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 20 guests