maflu2409
Posts: 1
Joined: Thu Apr 23, 2015 7:37 pm

Re: Multi-console gamepad driver for GPIO

Thu Apr 23, 2015 8:09 pm

Hello
at first thank you for your awesome work!
I have run into some glitches, and i hope you can help me with solving them.

I have installed Raspbian on my Raspberry Pi 2
Kernel is 3.18.11-v7- armv7l with the dkms-extensions installed.

So far so good, both of my PS2 Controllers work, but
When starting mupen64 the controller continuously draws to the bottom-right corner.

Configuring with input station and analog button pressed is also pretty tricky because the left analog-stick is not properly detected.
I tried setting psx_delay to 25 and to 30. In an radical attempt to solve it even to 50 still no use.

While going through testing with jstest and crawling through the configuration-files, I also noticed, that the left analog-stick ist not recognized as an axis, but rather as a dpad like button.

I know that this kind of configuration is standart on the xbox controller, but may it be possible, that dpad and left-analog stick are interchanged?

BTW.
Playing Games that do not need the analog stick works like a charm.

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

Re: Multi-console gamepad driver for GPIO

Fri Apr 24, 2015 10:50 pm

maflu2409 wrote:Hello
at first thank you for your awesome work!
I have run into some glitches, and i hope you can help me with solving them.

I have installed Raspbian on my Raspberry Pi 2
Kernel is 3.18.11-v7- armv7l with the dkms-extensions installed.

So far so good, both of my PS2 Controllers work, but
When starting mupen64 the controller continuously draws to the bottom-right corner.

Configuring with input station and analog button pressed is also pretty tricky because the left analog-stick is not properly detected.
I tried setting psx_delay to 25 and to 30. In an radical attempt to solve it even to 50 still no use.

While going through testing with jstest and crawling through the configuration-files, I also noticed, that the left analog-stick ist not recognized as an axis, but rather as a dpad like button.

I know that this kind of configuration is standart on the xbox controller, but may it be possible, that dpad and left-analog stick are interchanged?

BTW.
Playing Games that do not need the analog stick works like a charm.
Hi,

are you sure that the left stick is not detected as the second axis? From my testing, I recall that D-pad was always the first axis, and the sticks were second and third axis (when the controller was in analog mode). It'd be possible to change the order by tweaking the driver, but emulators etc. should allow mapping the axis freely. If the left stick is really not detected as axis (right stick is?), then there's something wrong with the driver or controller (official or 3rd-party?).

pawelkrak
Posts: 35
Joined: Wed Jan 16, 2013 3:46 pm

Re: Multi-console gamepad driver for GPIO

Tue May 12, 2015 3:10 pm

Hello !!

Im new user of RPI2 with new RetroPie image 3.0 beta 2.

I have big problem with install db9_gpio_rpi. Every chance to install i got error.
When used modprobe i have msg: db9_gpio_rpi module not found. Im ran

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

and can't install from main retropie script db9 drivers :( "db9_gpio_driver installation FAILED - every time :( ")
GameCON drive was installed succesfully

I have in usr/src/db9_gpio_rpi-1.0/ db9_gpio_rpi.c
dkms.conf
Makefile

I'd like to use Amiga Joystick with GPIO. XBOX 360 pad works good but joystick mayby work better :D

Thankyou and waiting for help ;)

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

Re: Multi-console gamepad driver for GPIO

Tue May 12, 2015 4:37 pm

pawelkrak wrote:I have in usr/src/db9_gpio_rpi-1.0/ db9_gpio_rpi.c
dkms.conf
Makefile

I'd like to use Amiga Joystick with GPIO. XBOX 360 pad works good but joystick mayby work better :D

Thankyou and waiting for help ;)
Can you run "make" at /usr/src/db9_gpio_rpi-1.0/ -directory and paste the output here? It looks like the driver package was fetched and unpacked correctly, but there was problem when building it.

pawelkrak
Posts: 35
Joined: Wed Jan 16, 2013 3:46 pm

Re: Multi-console gamepad driver for GPIO

Tue May 12, 2015 5:35 pm

Hi marqs

thankyou for your reply but now im configured myself (used GOOGLE) and all work.

what i do:

1st manually install : dpkg -i linux-headers-3.18.13-v7+_3.18.13-v7+-2_armhf.deb
2nd manually install: dpkg -i db9-gpio-rpi-dkms_1.0_all.deb

after installation : modprobe --first-time db9_gpio_rpi map=8,0 -> its for Amiga Computer

and all found in kernel :). The last step was add to etc/modules db9_gpio_rpi map=8,0 -> for automatical start everytime when RP2 power ON.

Now conclusion: In UAE4ALL joystick work ok. No lags, in ATARI 800 i have autofire when pushed LEFT and UP triger. I dont have idea where to correct it..

I hope to help someone who have some problems like me :)

cheers :D

pawelkrak
Posts: 35
Joined: Wed Jan 16, 2013 3:46 pm

Re: Multi-console gamepad driver for GPIO

Tue May 12, 2015 8:33 pm

another problem found. When real amiga joystick is connected and configured like gamepad #2, my xbox pad is configured like gamepad #3 but all games with libreto used gamepad #2. When dissabled amiga joystick then xbox360 pad is #2, when connected amiga joy then xbox pad is #3 but all emulators used gamepad #2. So my question is: where i can change param to define right pad values ?

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

Re: Multi-console gamepad driver for GPIO

Tue May 12, 2015 9:14 pm

pawelkrak wrote:another problem found. When real amiga joystick is connected and configured like gamepad #2, my xbox pad is configured like gamepad #3 but all games with libreto used gamepad #2. When dissabled amiga joystick then xbox360 pad is #2, when connected amiga joy then xbox pad is #3 but all emulators used gamepad #2. So my question is: where i can change param to define right pad values ?
I think both of your issues can be resolved by configuring controllers in retroarch / emulators. You could try "retroarch-joyconfig"-command line tool or editing retroarch.cfg directly (check. e.g. input_player1_joypad_index).

pawelkrak
Posts: 35
Joined: Wed Jan 16, 2013 3:46 pm

Re: Multi-console gamepad driver for GPIO

Thu May 14, 2015 6:04 am

Hi.

I reconfigured manually, saved and now work. Thanku for your tip ;)

Regards

mccarthy
Posts: 16
Joined: Tue Feb 25, 2014 6:27 pm

Re: Multi-console gamepad driver for GPIO

Wed May 27, 2015 6:12 pm

Hi there,
I'm a little bit lost here. I would like to use GPIO9 for my SNES-Pad (DATA).
Is this possible? I've tried something like gamecon_gpio_rpi map=0,0,0,0,0,1, but needless to say, it didn't work.
Of I'm using a PI2 if that's important.
How about "pad5" and "pad6" where do I have to connect these to?
Cheers

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Wed May 27, 2015 8:17 pm

mccarthy wrote:Hi there,
I'm a little bit lost here. I would like to use GPIO9 for my SNES-Pad (DATA).
Is this possible? I've tried something like gamecon_gpio_rpi map=0,0,0,0,0,1, but needless to say, it didn't work.
Of I'm using a PI2 if that's important.
How about "pad5" and "pad6" where do I have to connect these to?
Cheers
Ok, if you are using a Pi2, the only pad choices available to you are pads 3, 4, 5, and 6. I have a SNES pad set up and I use pads 3 and 4. Try this:

Controller one: Pad 3, GPIO 4 (pin 7)
Controller two: Pad 4, GPIO 7 (pin 26)

and use

Code: Select all

gamecon_gpio_rpi map=0,0,1,1
For future reference:

Pad 5, GPIO 2 (pin 3)
Pad 6, GPIO 3 (pin 5)

More info
Last edited by bcrawford on Thu May 28, 2015 9:16 pm, edited 1 time in total.

mccarthy
Posts: 16
Joined: Tue Feb 25, 2014 6:27 pm

Re: Multi-console gamepad driver for GPIO

Wed May 27, 2015 8:21 pm

Thanks for your help. Let's say I would like to use Pad5 only. Do I have to use map=1,0,0,0 or map=1? Or map=0,0,0,0,1?

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Thu May 28, 2015 1:05 am

mccarthy wrote:Thanks for your help. Let's say I would like to use Pad5 only. Do I have to use map=1,0,0,0 or map=1? Or map=0,0,0,0,1?
You can use map=0,0,0,0,1,0

The pad layout is as follows:

map=x1,x2,x3,x4,x5,x6

x1 -> pad 1 (rev 1 pi's)
x2 -> pad 2 (rev 1 pi's)
x3 -> pad 3 (rev 1 & 2 pi's)
x4 -> pad 4 (rev 1 & 2 pi's)
x5 -> pad 5 (rev 2 pi's)
x6 -> pad 6 (rev 2 pi's)

mccarthy
Posts: 16
Joined: Tue Feb 25, 2014 6:27 pm

Re: Multi-console gamepad driver for GPIO

Thu May 28, 2015 8:40 am

Many thanks for your patience, but I'm afraid that it doesn't work either.
map 0,0,1,0 works like a charm, but plugging DATA into GPIO2 und using map=0,0,0,0,1,0 doesn't work. I've updated the kernel, reinstalled the headers and reinstalled the module. I made sure that it was loaded correctly, but nothing. I've even tested GPIO2 with a switch to proof that it isn't damaged or something like that. It's perfectly fine.
The thing is, that I need to replug it, because I want to use the DB9 module at the same time :/
Kind regards

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Thu May 28, 2015 1:29 pm

mccarthy wrote:Many thanks for your patience, but I'm afraid that it doesn't work either.
map 0,0,1,0 works like a charm, but plugging DATA into GPIO2 und using map=0,0,0,0,1,0 doesn't work. I've updated the kernel, reinstalled the headers and reinstalled the module. I made sure that it was loaded correctly, but nothing. I've even tested GPIO2 with a switch to proof that it isn't damaged or something like that. It's perfectly fine.
The thing is, that I need to replug it, because I want to use the DB9 module at the same time :/
Kind regards
Hmmm, that's strange. So map=0,0,1,0 works for you. Which pin are you plugged into in that case?

mccarthy
Posts: 16
Joined: Tue Feb 25, 2014 6:27 pm

Re: Multi-console gamepad driver for GPIO

Thu May 28, 2015 1:54 pm

It's GPIO4, if I'm not mistaken.
It's driving me crazy, there's no plausible answer for this behaviour.

bcrawford
Posts: 20
Joined: Fri May 10, 2013 8:22 pm

Re: Multi-console gamepad driver for GPIO

Thu May 28, 2015 2:08 pm

mccarthy wrote:It's GPIO4, if I'm not mistaken.
It's driving me crazy, there's no plausible answer for this behaviour.
Here's an image with the pin locations and names so you can double check your work (just to be safe). Is it possible to use GPIO 3 without affecting your db9 configuration? or GPIO 7?

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

Re: Multi-console gamepad driver for GPIO

Thu May 28, 2015 9:08 pm

Db9 and gamecon drivers haven't been really tested operating together at the same time, even though in theory that should work if:
1. You configure db9 to use only pad2 (map=0,X) if you are also using SNES controller
2. You configure gamecon for pad5 or pad6 as SNES controller.

The only difference in the driver is that GPIO2 and GPIO3 use on-board pull-up resistors whereas GPIO4 and GPIO7 use programmable pull-up resistors.

mccarthy
Posts: 16
Joined: Tue Feb 25, 2014 6:27 pm

Re: Multi-console gamepad driver for GPIO

Thu May 28, 2015 10:37 pm

I was kind of blind. If I use Pad 3 and 4, I'll use Player2 with db9 and everything is OK, at least I hope so.
I'll report any progress.
Thanks for the help guys.
Cheers

User avatar
Flausch
Posts: 12
Joined: Wed May 13, 2015 9:15 am
Location: Würzburg, Germany

Re: Multi-console gamepad driver for GPIO

Mon Jun 08, 2015 11:12 am

I did not find any info at which rate the driver reads/updates its input.

I am using db9_gpio_rpi with two competition pro joysticks on rpi2 and when using these with vice (c64 emulator), I had the feeling that with fast games there is some lag/some input events got lost.
This may highly subjective, but it did not feel like a real C64.

Is there a method to debug/measure this or increase the update rate of the driver?

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

Re: Multi-console gamepad driver for GPIO

Mon Jun 08, 2015 3:03 pm

Flausch wrote:I did not find any info at which rate the driver reads/updates its input.

I am using db9_gpio_rpi with two competition pro joysticks on rpi2 and when using these with vice (c64 emulator), I had the feeling that with fast games there is some lag/some input events got lost.
This may highly subjective, but it did not feel like a real C64.

Is there a method to debug/measure this or increase the update rate of the driver?
The driver reads the input every 10ms. In order to increase this, you need to recompile kernel with higher tick rate (default CONFIG_HZ is 100 I think) and also modify the driver (see DB9_REFRESH_TIME in db9_gpio_rpi.c). There's probably other tricks which may better help reducing latency, e.g. turning off vsync in emulator, disabling CPU dynamic frequency scaling etc. Did you try if keyboard control is as laggy?

matock
Posts: 6
Joined: Tue Oct 01, 2013 8:00 am

Re: Multi-console gamepad driver for GPIO

Wed Jun 17, 2015 10:39 am

Hi all,

I have the error below when I try to compile the db9_gpio_rpi driver.

---------------------------
DKMS make.log for db9_gpio_rpi-1.0 for kernel 3.18.11+ (armv6l)
mardi 16 juin 2015, 23:54:13 (UTC+0200)
make -C /lib/modules/3.18.11+/build M=/var/lib/dkms/db9_gpio_rpi/1.0/build modules
make[1]: Entering directory '/usr/src/linux-headers-3.18.11+'

ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.

CC [M] /var/lib/dkms/db9_gpio_rpi/1.0/build/db9_gpio_rpi.o
In file included from <command-line>:0:0:
././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h: Aucun fichier ou dossier de ce type
compilation terminated.
scripts/Makefile.build:263: recipe for target '/var/lib/dkms/db9_gpio_rpi/1.0/build/db9_gpio_rpi.o' failed
make[2]: *** [/var/lib/dkms/db9_gpio_rpi/1.0/build/db9_gpio_rpi.o] Error 1
Makefile:1381: recipe for target '_module_/var/lib/dkms/db9_gpio_rpi/1.0/build' failed
make[1]: *** [_module_/var/lib/dkms/db9_gpio_rpi/1.0/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.18.11+'
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2
---------------------------

I have a RPi-1 model B with the last RetroPie 3 beta 3.

The installation of the driver via the retroPie-Setup was fine. But as I need to reassign GPIO ports in the db9_gpio_rpi.c file, I need to recompile it. I did it previously with RetroPie 1.8 and it worked perfectly.

I saw that the driver is now in version 1.0 (instead of 0.7). But in the dkms.conf file it is still mentioned 0.7. Then, I tried to update to 1.0 and to recompile, but with no more success.

What I did exactly is:

dkms remove db9_gpio_rpi/1.0 --all (to remove the previous installation of the driver)
dkms install db9_gpio_rpi/1.0 (to recompile)

Is something wrong?

Many thank you for your help.
matock

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

Re: Multi-console gamepad driver for GPIO

Wed Jun 17, 2015 11:49 am

matock wrote:Hi all,

I have the error below when I try to compile the db9_gpio_rpi driver.

...
I have a RPi-1 model B with the last RetroPie 3 beta 3.

The installation of the driver via the retroPie-Setup was fine. But as I need to reassign GPIO ports in the db9_gpio_rpi.c file, I need to recompile it. I did it previously with RetroPie 1.8 and it worked perfectly.

I saw that the driver is now in version 1.0 (instead of 0.7). But in the dkms.conf file it is still mentioned 0.7. Then, I tried to update to 1.0 and to recompile, but with no more success.

What I did exactly is:

dkms remove db9_gpio_rpi/1.0 --all (to remove the previous installation of the driver)
dkms install db9_gpio_rpi/1.0 (to recompile)

Is something wrong?

Many thank you for your help.
matock
That should work - perhaps you have mismatching firmware and kernel headers? You could try updating to latest firmware (3.18.16+) and then install matching headers manually or automatically via retropie db9/gamecon installation.

matock
Posts: 6
Joined: Tue Oct 01, 2013 8:00 am

Re: Multi-console gamepad driver for GPIO

Sun Jun 21, 2015 8:11 pm

Thank you marqs for your reply.

I updated from 3.18.11+ to 3.18.16+ (with rpi-update), and now I'm able to recompile the db9_gpio_rpi driver with success. BUT...

When I try to load the driver (with "modprobe --first-time db9_gpio_rpi map=3,3"), I have the error:
ERROR: could not insert 'db9_gpio_rpi': Exec format error

I decided to restart from the beginning: I removed all the drivers (db9 & gamecon) and I totally refreshed RetroPie from the menu (option 1 Binary-based installation). Now, I can't install GPIO drivers at all. It fails at the end with the message "Gamecon driver installation FAILED". None driver is installed, neither db9 nor gamecom. The source files are not in /usr/src/.

I'm totally lost. Is somebody was able to install the GPIO drivers with RetroPie v3?

Very thank you for your help.

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

Re: Multi-console gamepad driver for GPIO

Sun Jun 21, 2015 9:30 pm

matock wrote:Thank you marqs for your reply.

I updated from 3.18.11+ to 3.18.16+ (with rpi-update), and now I'm able to recompile the db9_gpio_rpi driver with success. BUT...

When I try to load the driver (with "modprobe --first-time db9_gpio_rpi map=3,3"), I have the error:
ERROR: could not insert 'db9_gpio_rpi': Exec format error

I decided to restart from the beginning: I removed all the drivers (db9 & gamecon) and I totally refreshed RetroPie from the menu (option 1 Binary-based installation). Now, I can't install GPIO drivers at all. It fails at the end with the message "Gamecon driver installation FAILED". None driver is installed, neither db9 nor gamecom. The source files are not in /usr/src/.

I'm totally lost. Is somebody was able to install the GPIO drivers with RetroPie v3?

Very thank you for your help.
Try to remove all linux headers before installing drivers via retropie:

Code: Select all

apt-get purge linux-headers*
If that doesn't help, you could paste RetroPie installation log here for further info why the installation fails.

matock
Posts: 6
Joined: Tue Oct 01, 2013 8:00 am

Re: Multi-console gamepad driver for GPIO

Mon Jun 22, 2015 5:47 pm

Hi marqs,

I removed the headers, as you explained, but no success.

I restarted from a fresh install v3-beta3. The firmware is 3.18.11+ and the install fails at the end (cf. 1st log attached). After a rpi-update the firmware is now 4.0.5+. With this update, the install fails immediately (cf. 2nd log attached).
I restarted also from a fresh install v3-beta4. The firmware is already in 4.0.5+ and it fails immediately as above.
rps-log-files.zip
1st log -> rps-3.8.11-beta3.log
2nd log -> rps-4.0.5-beta4.log
(5.09 KiB) Downloaded 205 times
This new firmware is online since last night. So, I'm blocked because I can not reproduce the test conditions from 2 days ago, with the 3.18.16+.

May be I have to wait until v3 is more stable. But if you have new advices for me I'm ready to test.

Thank you.

Return to “Gaming”