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

Re: Multi-console gamepad driver for GPIO

Tue Dec 03, 2013 8:36 pm

mdorme wrote:Hi,

First of all, many thanks for this great job !
Any update on the ugly workaround ?
Since then, two new kernels were already deployed (updated yesterday and got 3.10.21+).
Would it be possible to post the latest headers for 3.10.21+ ?
I presume building thoses packages is not straighforward, could some howto be posted for this ?

Thanks in advance.
M.
Hi,

been quite busy at work, haven't had much time to look at this. I can think of two solutions, which both have their good and bad sides:

1. Create a script that clones/tracks the RPi kernel git locally, and generates headers automatically during gamecon/db9 installation.
+Stays up to date with RPi kernel
-High overhead: needs >1GB space and update/build takes some time on Pi

2. Stop generating customs headers, force the user to install a kernel version which has the headers in the official repo
+No need for continuous custom header .debs
-No way to use the most recent kernel / rpi-update
-Needs modication of /boot/config.txt to include "kernel="-flag

I don't personally like either of these options, but the latter is more realistic.

The build procedure is actually quite straightforward, but it should be automated to trigger on a kernel update...

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

Re: Multi-console gamepad driver for GPIO

Thu Dec 05, 2013 10:09 pm

marqs wrote:The build procedure is actually quite straightforward, but it should be automated to trigger on a kernel update...
Until a better solution is found, I automated the builds with a simple script added to daily cron on a server. This should remove the need of manual updates - at least until next major kernel release (e.g. 3.11).

mdorme
Posts: 2
Joined: Tue Dec 03, 2013 12:13 pm

Re: Multi-console gamepad driver for GPIO

Fri Dec 06, 2013 8:51 am

marqs wrote:
marqs wrote:The build procedure is actually quite straightforward, but it should be automated to trigger on a kernel update...
Until a better solution is found, I automated the builds with a simple script added to daily cron on a server. This should remove the need of manual updates - at least until next major kernel release (e.g. 3.11).
Many thanks marqs !

santrell
Posts: 5
Joined: Sat Dec 14, 2013 9:59 am

Re: Multi-console gamepad driver for GPIO

Sun Dec 15, 2013 9:41 pm

Can anybody help me figure out a way to install gamecon without the retropie, please. Plus my pi is not connected to the internet I transfer via USB.

I have downloaded the drivers manually and tried to run them but I got dependence problem. So I downloaded that and transfered that (dkms) via USB and got another dependencies problem.

If push come to shove, even though I'm new to programming, I'm willing to try to write a driver for my to psx controllers

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

Re: Multi-console gamepad driver for GPIO

Sun Dec 15, 2013 11:02 pm

santrell wrote:Can anybody help me figure out a way to install gamecon without the retropie, please. Plus my pi is not connected to the internet I transfer via USB.

I have downloaded the drivers manually and tried to run them but I got dependence problem. So I downloaded that and transfered that (dkms) via USB and got another dependencies problem.

If push come to shove, even though I'm new to programming, I'm willing to try to write a driver for my to psx controllers
The module build process unfortunately requires a bunch of packages, especially if you are using Raspbian (not deb-packaged) kernel. Getting a pre-built gamecon module would be the easiest solution if you are not planning to update your FW regularly. However, finding one to match your current kernel can be problematic.

Laba
Posts: 2
Joined: Mon Jan 13, 2014 11:16 am

Re: Multi-console gamepad driver for GPIO

Mon Jan 13, 2014 11:21 am

Hi,

I'm trying to connect PS2 controller to retropie but I can't get past "ERROR: could not insert 'gamecon_gpio_rpi': Exec format error" -error.

Here's print of versions I'm running.

Code: Select all

pi@raspberrypi ~/RetroPie-Setup $ uname -r
3.10.25+
pi@raspberrypi ~/RetroPie-Setup $ dpkg -l |grep linux-headers
ii  linux-headers-3.10.25+                3.10.25+-2                             armhf        Linux kernel headers for 3.10.25+ on armhf

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

Re: Multi-console gamepad driver for GPIO

Mon Jan 13, 2014 5:00 pm

Laba wrote:Hi,

I'm trying to connect PS2 controller to retropie but I can't get past "ERROR: could not insert 'gamecon_gpio_rpi': Exec format error" -error.

Here's print of versions I'm running.

Code: Select all

pi@raspberrypi ~/RetroPie-Setup $ uname -r
3.10.25+
pi@raspberrypi ~/RetroPie-Setup $ dpkg -l |grep linux-headers
ii  linux-headers-3.10.25+                3.10.25+-2                             armhf        Linux kernel headers for 3.10.25+ on armhf
Hmm, this has changed Module.symvers and probably made 3.10.25+ -headers incompatible. I'll update the header generation script to trigger on the changes within the same version to avoid these issues in the future. Meanwhile, 3.10.26+ seems to work so try updating firmware and gamecon.

Laba
Posts: 2
Joined: Mon Jan 13, 2014 11:16 am

Re: Multi-console gamepad driver for GPIO

Wed Jan 15, 2014 9:23 am

Thanks, marqs

I got it working when I updated kernel to 3.10.26+ and updated gamecon drivers from retropie-setup. Retropie setup upgraded only to 3.10.26+ so I needed to run update script manually with hash to newest kernel.

Code: Select all

sudo rpi-update 1d78a22d866b69454c062443db9d4b42f00f0215

santrell
Posts: 5
Joined: Sat Dec 14, 2013 9:59 am

Re: Multi-console gamepad driver for GPIO

Thu Jan 16, 2014 6:51 pm

thanks marqs, for the info. Sorry for the late reply. But I just read the post today and I'm going to look into what you said about pre built module.

Ps: the ma reason for me doing this (skipping retropie and all) is,because before I could install it, I had ran out of space. And since I had already installed pisnes, I figured I could just get gamecon and configure it to suit my needs. STILL OUT OF SPACE AND DON'T KNOW WHERE TO GO. I BOUGHT THE PI TO TEACH MY SELF PROGRAMMING PASS MY BEGINNER LEVEL. THANKS IN ADVANCE.

User avatar
DougieLawson
Posts: 35542
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Multi-console gamepad driver for GPIO

Thu Jan 16, 2014 7:00 pm

If your system is built on the stock Raspbian.

sudo apt-get purge wolfram*
will get you 500MB of free space
sudo apt-get purge oracle-java*
will get another 90MB

sudo raspi-config # and the option to expand the filesystem may get some spare space

sudo apt-get autoclean && sudo apt-get autoremove

sudo cd /var/log && sudo find . -name "*gz" | sudo xargs rm # will clean up old logfiles
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Multi-console gamepad driver for GPIO

Thu Jan 16, 2014 7:41 pm

DougieLawson wrote:sudo cd /var/log && sudo find . -name "*gz" | sudo xargs rm # will clean up old logfiles
You cannot sudo cd. No need anyway, because find is not restricted to searching in ".":

Code: Select all

sudo find /var/log -name "*.gz" -delete
Removing old logfiles may not be such a good idea by itself. If they were big they will get big again, so you should either fix the thing that is logging excessively, or reduce the retention in /etc/logrotate.conf.

santrell
Posts: 5
Joined: Sat Dec 14, 2013 9:59 am

Re: Multi-console gamepad driver for GPIO

Thu Jan 16, 2014 7:50 pm

@DougieLawson - I don't know if wheezy is stock or not, but thanks a lot for the info. I may just get up and go test it.

santrell
Posts: 5
Joined: Sat Dec 14, 2013 9:59 am

Re: Multi-console gamepad driver for GPIO

Thu Jan 16, 2014 8:14 pm

@jojopi - can you please inform or give me a example of what you mean by saying " reduce the retention in /etc/logrotate.conf. " I think I know what you mean when you talk about finding what programs is causing the excessively large log on 2gb sd card( i think it may be this mistake I made(back in my website days) with a all in one apache server I don't know how to fully remove). But do you have a example for me to study. T.I.A - THANKS IN ADVANCE.

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: Multi-console gamepad driver for GPIO

Fri Jan 17, 2014 7:26 am

Most log files are rotated weekly and retained for four weeks, compressed after the second week; equivalent to logrotate settings:

Code: Select all

    weekly
    rotate 4
    compress
    delaycompress
That is not a particularly high level of retention, but it can be reduced if you want to minimize disk usage. Switching from "weekly" to "daily" rotation will also reduce usage somewhat (even if you also increase the "rotate" number to keep the same total retention period) because it means the logs are compressed sooner.

Many packages have their own logrotate settings for their log files. apache2 in particular sets a default retention of 52 weeks in /etc/logrotate.d/apache2. Settings in /etc/logrotate.d/* override the defaults in /etc/logrotate.conf. In fact, the defaults do not apply to many log files at all, because the standard system log files are named explicitly in /etc/logrotate.d/rsyslog.

If the Pi is regularly powered off overnight then you should "sudo apt-get install anacron". That package runs at boot time any cron jobs that were missed while the machine was off. Without it, logrotate may never happen at all, meaning that all log files grow indefinitely.

santrell
Posts: 5
Joined: Sat Dec 14, 2013 9:59 am

Re: Multi-console gamepad driver for GPIO

Wed Feb 26, 2014 1:38 am

Thanks

Apology11
Posts: 1
Joined: Sat Mar 08, 2014 4:47 pm

Re: Multi-console gamepad driver for GPIO

Sat Mar 08, 2014 4:58 pm

I´m pretty much a noob on this so:

I tried to install the newest headers for 3.10.33 and I got this:

Code: Select all

sudo dpkg -i linux-headers-3.10.33+_3.10.33+-2_armhf.deb
Vormals nicht ausgewähltes Paket linux-headers-3.10.33+ wird gewählt.
(Lese Datenbank ... 95706 Dateien und Verzeichnisse sind derzeit installiert.)
Entpacken von linux-headers-3.10.33+ (aus linux-headers-3.10.33+_3.10.33+-2_armhf.deb) ...
linux-headers-3.10.33+ (3.10.33+-2) wird eingerichtet ...
--2014-03-08 16:47:38--  https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
Auflösen des Hostnamen »github.com (github.com)«... 192.30.252.131
Verbindungsaufbau zu github.com (github.com)|192.30.252.131|:443... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 302 Found
Platz: https://raw.github.com/raspberrypi/firmware/master/extra/Module.symvers[folge]
--2014-03-08 16:47:49--  https://raw.github.com/raspberrypi/firmware/master/extra/Module.symvers
Auflösen des Hostnamen »raw.github.com (raw.github.com)«... 185.31.17.133
Verbindungsaufbau zu raw.github.com (raw.github.com)|185.31.17.133|:443... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 200 OK
Länge: 493294 (482K) [text/plain]
In »»/usr/src/linux-headers-3.10.33+/Module.symvers«« speichern.

100%[======================================>] 493.294     24,5K/s   in 12s

»Last-modified«-Kopfzeile fehlt -- Zeitstempel abgeschaltet.
2014-03-08 16:48:09 (39,7 KB/s) - »»/usr/src/linux-headers-3.10.33+/Module.symvers«« gespeichert [493294/493294]

make: Entering directory `/usr/src/linux-headers-3.10.33+'
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
make: Leaving directory `/usr/src/linux-headers-3.10.33+'
make: Entering directory `/usr/src/linux-headers-3.10.33+'
  WRAP    arch/arm/include/generated/asm/auxvec.h
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/cputime.h
  WRAP    arch/arm/include/generated/asm/current.h
  WRAP    arch/arm/include/generated/asm/emergency-restart.h
  WRAP    arch/arm/include/generated/asm/errno.h
  WRAP    arch/arm/include/generated/asm/exec.h
  WRAP    arch/arm/include/generated/asm/ioctl.h
  WRAP    arch/arm/include/generated/asm/ipcbuf.h
  WRAP    arch/arm/include/generated/asm/irq_regs.h
  WRAP    arch/arm/include/generated/asm/kdebug.h
  WRAP    arch/arm/include/generated/asm/local.h
  WRAP    arch/arm/include/generated/asm/local64.h
  WRAP    arch/arm/include/generated/asm/msgbuf.h
  WRAP    arch/arm/include/generated/asm/param.h
  WRAP    arch/arm/include/generated/asm/parport.h
  WRAP    arch/arm/include/generated/asm/poll.h
  WRAP    arch/arm/include/generated/asm/resource.h
  WRAP    arch/arm/include/generated/asm/sections.h
  WRAP    arch/arm/include/generated/asm/segment.h
  WRAP    arch/arm/include/generated/asm/sembuf.h
  WRAP    arch/arm/include/generated/asm/serial.h
  WRAP    arch/arm/include/generated/asm/shmbuf.h
  WRAP    arch/arm/include/generated/asm/siginfo.h
  WRAP    arch/arm/include/generated/asm/sizes.h
  WRAP    arch/arm/include/generated/asm/socket.h
  WRAP    arch/arm/include/generated/asm/sockios.h
  WRAP    arch/arm/include/generated/asm/termbits.h
  WRAP    arch/arm/include/generated/asm/termios.h
  WRAP    arch/arm/include/generated/asm/timex.h
  WRAP    arch/arm/include/generated/asm/trace_clock.h
  WRAP    arch/arm/include/generated/asm/types.h
  WRAP    arch/arm/include/generated/asm/unaligned.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  Generating include/generated/mach-types.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
grep: scripts/../arch/x86/syscalls/syscall_32.tbl: Datei oder Verzeichnis nicht gefunden
  HOSTCC  scripts/genksyms/genksyms.o
  SHIPPED scripts/genksyms/lex.lex.c
  SHIPPED scripts/genksyms/keywords.hash.c
  SHIPPED scripts/genksyms/parse.tab.h
  HOSTCC  scripts/genksyms/lex.lex.o
  SHIPPED scripts/genksyms/parse.tab.c
  HOSTCC  scripts/genksyms/parse.tab.o
  HOSTLD  scripts/genksyms/genksyms
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/bin2c
  HOSTCC  scripts/sortextable
scripts/sortextable.c:31:32: fatal error: tools/be_byteshift.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
make[1]: *** [scripts/sortextable] Fehler 1
make: *** [scripts] Fehler 2
make: Leaving directory `/usr/src/linux-headers-3.10.33+'
"Datei oder Verzeichnis nicht gefunden" is "file or folder not found" in german.

I guess it has something to do with "#include <tools/be_byteshift.h>" in "scripts/sortextable.c ", but how do I solve this?

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

Re: Multi-console gamepad driver for GPIO

Sat Mar 08, 2014 9:08 pm

Apology11 wrote:I guess it has something to do with "#include <tools/be_byteshift.h>" in "scripts/sortextable.c ", but how do I solve this?
That seems to due to one missing include-directory in the headers. Did that really stop installation process? I just wonder as scripts/sortextable.c hasn't been updated in a while. Anyway, I updated the header generation script so that the error doesn't take place anymore.

Thorin Oakenshield
Posts: 3
Joined: Tue Apr 01, 2014 11:46 am

Re: Multi-console gamepad driver for GPIO

Tue Apr 01, 2014 12:04 pm

Hi! Who knows how to connect a ps one controller in raspberry pi? Thanks in advance.

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

Re: Multi-console gamepad driver for GPIO

Tue Apr 01, 2014 4:55 pm

Thorin Oakenshield wrote:Hi! Who knows how to connect a ps one controller in raspberry pi? Thanks in advance.
The connection instructions are found in the wikipage and also in the driver readme (/usr/share/doc/gamecon_gpio_rpi/README.gz). Depending on your pad type, you may need to increase access delay if the the pad events are not registered.

DDG12296
Posts: 7
Joined: Sat Nov 17, 2012 6:43 pm

Re: Multi-console gamepad driver for GPIO

Tue Apr 29, 2014 11:52 am

I have hooked up two PSx controllers to the GPIO pins as the wiki describes and after trying for several days I have finally gotten to the point where sudo modprobe gamecon_gpio_rpi map=0,0,0,0,7,7 psx-delay=14 works although I have one more major issue. I tried jstest /dev/input/js0 and jstest /dev/input/js1 and the analog lights come on but the buttons and joysticks still do nothing. I have tried changing the psx-delay to several different numbers but still nothing happens. Can someone please explain to me how to find the problem with the button recognition? Also I tried to test the voltage across the pins and it accidentally reset the entire machine (updated Linux headers, rebooted, gamecon failed again) so I had to do the whole process over from the retropie image to the gamecon driver loading. Is there a chance I actually fried my controller, or is there something that I just haven't done? Thanks in advance, Derek.

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

Re: Multi-console gamepad driver for GPIO

Wed Apr 30, 2014 6:52 am

DDG12296 wrote:I have hooked up two PSx controllers to the GPIO pins as the wiki describes and after trying for several days I have finally gotten to the point where sudo modprobe gamecon_gpio_rpi map=0,0,0,0,7,7 psx-delay=14 works although I have one more major issue. I tried jstest /dev/input/js0 and jstest /dev/input/js1 and the analog lights come on but the buttons and joysticks still do nothing. I have tried changing the psx-delay to several different numbers but still nothing happens. Can someone please explain to me how to find the problem with the button recognition? Also I tried to test the voltage across the pins and it accidentally reset the entire machine (updated Linux headers, rebooted, gamecon failed again) so I had to do the whole process over from the retropie image to the gamecon driver loading. Is there a chance I actually fried my controller, or is there something that I just haven't done? Thanks in advance, Derek.
I'd start with only 1 controller connected, in the unlikely case that 2 draw more current than can be provided by Pi (are the controllers official or 3rd-party?). You could also try connecting the data pin to a GPIO which does not have fixed pullups, e.g. GPIO 4, and with high psx_delay (note the underscore, not dash): sudo modprobe gamecon_gpio_rpi map=0,0,7 psx_delay=25

Marv007
Posts: 9
Joined: Sat May 03, 2014 7:24 pm

Re: Multi-console gamepad driver for GPIO

Sat May 03, 2014 7:40 pm

Hi all,

I've been fiddling around with 4 NES controllers and I can't get them all to work properly. I will try to explain what happened, please note that I only tried connecting 1 controller at once. No controller works at all at 3.3V, I use a 500 ohm resistor and a 1N4148 to protect from overvoltage.

The first controller works flawlessly. The others don't. Only the A button works and results in the proper button readings in jstest, it states A as ON and everything else as OFF. The other buttons don't result in any change at all. I read somewhere in this thread that this could be due to clock and latch being switched. I tried to switch them but that didn't work. I can't remember what the result was exactly.

Then I tried to reproduce these problems with the first controller. When I try to switch clock and latch all buttons turn to 'ON' when pressing A. Nothing shows up when pressing anything else. When I properly connect clock only, nothing works. When I properly connect latch only, the same happens as when they are switched.

I checked the wiring multiple times and I've reconnected them over and over again.

Does anyone have an idea what I could have done wrong?

Thanks!

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

Re: Multi-console gamepad driver for GPIO

Sun May 04, 2014 5:23 pm

Marv007 wrote:Hi all,

I've been fiddling around with 4 NES controllers and I can't get them all to work properly. I will try to explain what happened, please note that I only tried connecting 1 controller at once. No controller works at all at 3.3V, I use a 500 ohm resistor and a 1N4148 to protect from overvoltage.

The first controller works flawlessly. The others don't. Only the A button works and results in the proper button readings in jstest, it states A as ON and everything else as OFF. The other buttons don't result in any change at all. I read somewhere in this thread that this could be due to clock and latch being switched. I tried to switch them but that didn't work. I can't remember what the result was exactly.

Then I tried to reproduce these problems with the first controller. When I try to switch clock and latch all buttons turn to 'ON' when pressing A. Nothing shows up when pressing anything else. When I properly connect clock only, nothing works. When I properly connect latch only, the same happens as when they are switched.

I checked the wiring multiple times and I've reconnected them over and over again.

Does anyone have an idea what I could have done wrong?

Thanks!
You've probably done nothing wrong as there have been a few similar reports. I'm beginning to wonder if there's either some bug in the driver or an issue with the interface when multiple controllers are connected (extra load thus longer transition times etc.).

If it's not too much hassle, could you try following to help finding out the root cause: connect 1 controller physically, but keep the driver configured for four. Then connect the 3 leftover GPIO input data pins either a) to ground b) to the same GPIO pin where the single controller output is connected. With jstest, "controllers" 2-4 should report buttons as a) all on b) identically as controller 1. If that doesn't work as described, then the issue is in the driver, otherwise there's some second order effect when connecting multiple controllers.

Marv007
Posts: 9
Joined: Sat May 03, 2014 7:24 pm

Re: Multi-console gamepad driver for GPIO

Mon May 05, 2014 10:07 am

marqs wrote: You've probably done nothing wrong as there have been a few similar reports. I'm beginning to wonder if there's either some bug in the driver or an issue with the interface when multiple controllers are connected (extra load thus longer transition times etc.).

If it's not too much hassle, could you try following to help finding out the root cause: connect 1 controller physically, but keep the driver configured for four. Then connect the 3 leftover GPIO input data pins either a) to ground b) to the same GPIO pin where the single controller output is connected. With jstest, "controllers" 2-4 should report buttons as a) all on b) identically as controller 1. If that doesn't work as described, then the issue is in the driver, otherwise there's some second order effect when connecting multiple controllers.
Thanks for the answer marqs. However I did not try to connect multiple controller at a time. I only connect 1 controller at a time and then switch the connectors to test them all, one at a time. Also I don't configure the driver for multiple, just 1. E.g.
modprobe gamecon_gpio_rpi map=2
or when I tried switching GPIO input pin:
modprobe gamecon_gpio_rpi map=0,2

The only difference between the working controller and the others is that I cutoff the connector of the first controller. The first controller was my first experimental one. After that I bought 2 NES connectors to make a solid connection but I can't get them to work. I did check all the wires and they should be okay. I opened the controllers and all wires are the same, all connected to the same pins. I measured the wires directly from the inside of the controller to the Pi to be sure they are connected to the right pin.

I really don't understand what's wrong.

I do plan to connect multiple controllers at the same time. But I want them to independently work correctly before trying that ;)

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

Re: Multi-console gamepad driver for GPIO

Mon May 05, 2014 4:02 pm

Marv007 wrote:Thanks for the answer marqs. However I did not try to connect multiple controller at a time. I only connect 1 controller at a time and then switch the connectors to test them all, one at a time. Also I don't configure the driver for multiple, just 1. E.g.
modprobe gamecon_gpio_rpi map=2
or when I tried switching GPIO input pin:
modprobe gamecon_gpio_rpi map=0,2

The only difference between the working controller and the others is that I cutoff the connector of the first controller. The first controller was my first experimental one. After that I bought 2 NES connectors to make a solid connection but I can't get them to work. I did check all the wires and they should be okay. I opened the controllers and all wires are the same, all connected to the same pins. I measured the wires directly from the inside of the controller to the Pi to be sure they are connected to the right pin.

I really don't understand what's wrong.

I do plan to connect multiple controllers at the same time. But I want them to independently work correctly before trying that ;)
Ok, thanks for elaborating. In that case, I bet RPi cannot properly drive high the clock inputs of those 3 controllers. If they don't work at all with 5V, then perhaps some of the ICs require more than 3.3V to the data pins for proper logic high. It seems that latching works correctly (as the first button, 'A', is reported ok) but clock generation causes oscillation which shifts the 4021 shift-register too many times, so that '0' appears in the output after first pulse (causing all other buttons read as 'off').

This should be fixed by adding a 3.3V->5V shifter (e.g. 74HCT244) to latch and clock outputs of Pi. Increasing the drive strength of GPIO pads could also be a sufficient fix. That can be done with the following:

Code: Select all

wget http://www.niksula.hut.fi/~mhiienka/Rpi/set_gpio_str.c
gcc set_gpio_str.c -o set_gpio_str
sudo ./set_gpio_str 7

Return to “Gaming”