Help for RETROGAME

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Ozrail99
 
Posts: 27
Joined: Mon Apr 21, 2014 9:08 am

Help for RETROGAME

Post by Ozrail99 »

Hey folks! We've built a Raspberry Pi video game console at our school's makerspace. We followed the directions as posted in the learning area. Everything works-except we can't seem to map the arrow keys to the joystick and the Z key to the button.. We've tried a variety of input output numbers from various google searches, but at best, could only get UP to work.

Our pin out setup is correct, I'm certain, we're using revision 2.

Here's where I feel the issue lies:
// Input Output (from /usr/include/linux/input.h)
{ 25, KEY_LEFT }, // Joystick (4 pins)
{ 9, KEY_RIGHT },
{ 10, KEY_UP },
{ 17, KEY_DOWN },
{ 23, KEY_LEFTCTRL }, // A/Fire/jump/primary
{ 7, KEY_LEFTALT }, // B/Bomb/secondary

Those numbers don't seem to work for us. We're using a Logitech keyboard, if that matters.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help for RETROGAME

Post by pburgess »

Most common issues with Retrogame:

Wiring! Let's see a clear photo (or several) of the wiring, especially where it connects to the Pi.

There's two different key tables in retrogame.c. The first is used only when there's a PiTFT display attached on the GPIO header, other is used for any conventional HDMI or composite monitor (the latter may include small TFT monitors, but these interface differently than a PiTFT).

The system's key mapping may be set up funny. Usually this only affects punctuation, but maybe not. Run 'sudo raspi-config', go to 'Internationalisation Options' and 'Keyboard,' make sure that's all set up for what you have (e.g. Generic 104-key).

User avatar
Ozrail99
 
Posts: 27
Joined: Mon Apr 21, 2014 9:08 am

Re: Help for RETROGAME

Post by Ozrail99 »

Will try to post a few pics- kind of hard here at the school- can't connect my phone. I reset everything, now we get a new error when we run sudo ./retrogame.

Pin Config failed: try sudo ./retrogame

User avatar
Ozrail99
 
Posts: 27
Joined: Mon Apr 21, 2014 9:08 am

Re: Help for RETROGAME

Post by Ozrail99 »

20160113_112733_resized.jpg
20160113_112733_resized.jpg (449.09 KiB) Viewed 624 times
20160113_112813_resized.jpg
20160113_112813_resized.jpg (455.44 KiB) Viewed 624 times

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help for RETROGAME

Post by pburgess »

Near as I can decipher from the photos, it looks like this is what's connected:
Black: GND
Orange: 17
White: GND
Gray: 23
Red: 10
Blue: 9
Yellow: 25

Your key table mentions GPIO 7, but I don't see anything connected there. Not catastrophic though, this should be mostly working.

Since you're using composite video out, make sure you're editing the ioStandard[] array. That would be the second table in the code.

The error when running retrogame could be due to several things:
- There might already be an instance of retrogame running in the background (started automatically at boot time via /etc/rc.local). If that's the case, hunt down the process and kill it, then run your new version.
- GPIO 8, 9, 10 are also SPI pins, and it's possible some other process has claimed them in the name of SPI (for example, in raspi-config, did you enable SPI and load the SPI kernel module by default? That might be a concern here.)

User avatar
Ozrail99
 
Posts: 27
Joined: Mon Apr 21, 2014 9:08 am

Re: Help for RETROGAME

Post by Ozrail99 »

Sorry for the delay-
I now get a "pin configuration failed, try sudo ./retrogame" error when i run sudo ./retrogame.

You wrote earlier "There's two different key tables in retrogame.c. The first is used only when there's a PiTFT display attached on the GPIO header, other is used for any conventional HDMI or composite monitor (the latter may include small TFT monitors, but these interface differently than a PiTFT)." I can see both tables but I'm at a loss as to how to make one table active over the other.
Do I enter the key combos after the int key as such?
struct {
int pin;
int key;{ 2, KEY_LEFT }

Or is there something I should enter to point at one table over the other, perhaps on this line?
} *io,

HELP!!

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help for RETROGAME

Post by pburgess »

The code will select between the two tables automatically when run; it senses whether there's a PiTFT in use (or not) and acts accordingly.

The key combos just replace the contents of the list already there...GPIO pin # on the left, key name on the right, with -1,-1 at the end of the list. It'll be persnickety about formatting (with all the curly braces and such) but just follow the example and everything should be good.

User avatar
Ozrail99
 
Posts: 27
Joined: Mon Apr 21, 2014 9:08 am

Re: Help for RETROGAME

Post by Ozrail99 »

I took the whole thing apart and triple checked the wiring- I even tried it in reverse in case the joystick was inverted. I still get the same "./retrogame Pin Config Failed try sudo ./retrogame" error message.

We're using a Rev 1 model B if that makes any difference.

Is this for sure a wiring error?

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Help for RETROGAME

Post by pburgess »

The pin config error usually has one of two causes:
- Not running retrogame as root (need to run using 'sudo retrogame', or launch on boot from /etc/rc.local).
- Something else has already claimed those pins...quite possibly another instance of retrogame (e.g. if system is configured to run it on boot), in which case you need to track it down and stop it (either using the 'ps' and 'kill' commands, or 'sudo killall -9 retrogame' may work).

User avatar
Ozrail99
 
Posts: 27
Joined: Mon Apr 21, 2014 9:08 am

Re: Help for RETROGAME

Post by Ozrail99 »

20160216_074102_resized.jpg
20160216_074102_resized.jpg (292.16 KiB) Viewed 467 times
I took it home and did a complete install, and it works fine. i think the issue may have been that we were using an RCA/VGA adapter. At any rate it's now out for students to mess with and hopefully be inspired to start a new project.
Attachments
20160216_074057_resized.jpg
20160216_074057_resized.jpg (367.16 KiB) Viewed 467 times

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”