Please be aware of all shipping deadlines before placing your order - we cannot guarantee orders will arrive before Christmas!

CUPCADE: "A" button not working.
Moderators: adafruit_support_bill, adafruit

CUPCADE: "A" button not working.

by DestroJames on Fri May 02, 2014 3:24 pm

Just finished the Cupcade build. Thanks for a great project.

I am doing a dry run and screen, sound, joystick and buttons all are working okay, but only the A button isn't working.
I checked the button and wire goes to ground and 21/27 on T cobbler correctly.

I am trying to find out the meaning of #21 (v1) / #27 (v2) on the cobbler.
Could it mean that I have an older version of Pi that uses a different pin?

If so, is there any way I can re-map the pin?
DestroJames
 
Posts: 4
Joined: Wed Apr 17, 2013 6:25 pm

Re: CUPCADE: "A" button not working.

by pburgess on Fri May 02, 2014 10:45 pm

The GPIO header changed slightly from "version 1" Pis to version 2. It's easy to spot the difference: v2 boards have two mounting holes (one near the USB jack, the other just below the Raspberry Pi logo). Some info on the pin changes here:

http://elinux.org/RPi_Low-level_periphe ... .28GPIO.29

If you have a v1 board, the "A" button and left & right on the joystick won't work. But it's fixable if you don't mind editing a little code.

As I recall the "retrogame" source (which handles the GPIO to keyboard conversion) is in /usr/local/src/retrogame. Or, if it's not there, you can download it by typing:
Code: Select all | TOGGLE FULL SIZE
wget https://github.com/adafruit/Adafruit-Retrogame/archive/master.zip

There's a table starting around line 94. Each line is a GPIO pin number and a corresponding key. Change the pin numbers 2, 3 and 27 to 0, 1 and 21, respectively. Recompile with:
Code: Select all | TOGGLE FULL SIZE
make CFLAGS=-DCUPCADE
sudo make install

Rather than tracking down and restarting retrogame, it's easiest just to reboot.
Code: Select all | TOGGLE FULL SIZE
sudo reboot


If I'm wrong and you have a rev2 board (the vast majority of them are), then it's probably a wonky connection somewhere...either with the soldering, or something not right in the jumper wires or the button (in which case we'll get you a replacement). If you don't have a multimeter to test the button with, it's easy to check just by physically swapping the "A" and "B" buttons...does the problem now move to "B"? If so, bum button. If not, suspicious wire or soldering.

And thank you for doing the dry run first! I'd feel terrible if you'd squeezed it all into the case only to encounter gremlins.
User avatar
pburgess
 
Posts: 2760
Joined: Sun Oct 26, 2008 2:29 am

Re: CUPCADE: "A" button not working.

by DestroJames on Mon May 05, 2014 1:06 pm

Your solution worked!

Since "Y" on the stick worked at the game select screen, I assumed the joystick was working at first, but I found that X axis didn't work once I got a game loaded. Also, my Pi didn't have any mounting holes.

So I followed the instruction and (all source files were already present) now all controls work. I have to wrestle with the enclosure at a later time, so no Jousting yet, but I wanted to report all is working great now.

Thanks a lot for your quick reply!
DestroJames
 
Posts: 4
Joined: Wed Apr 17, 2013 6:25 pm

Re: CUPCADE: "A" button not working.

by cherybomb on Wed May 07, 2014 8:09 pm

hi
I followed the step to install retrogame, but I have this error.
Attachments
lcd.png
lcd.png (12.55 KiB) Viewed 226 times
cherybomb
 
Posts: 3
Joined: Sun Feb 26, 2012 9:25 am

Re: CUPCADE: "A" button not working.

by pburgess on Thu May 08, 2014 1:44 am

cherybomb: I need to know more about how you got to this step. Are you building a Cupcade from the kit, or getting the software running on your own setup? Did you download the preconfigured Cupcade SD image, or are you working from another OS such as Raspbian? What version of the Raspberry Pi board do you have? Does it have mounting holes, or is it one of the early models? (uncommon)
User avatar
pburgess
 
Posts: 2760
Joined: Sun Oct 26, 2008 2:29 am

Re: CUPCADE: "A" button not working.

by cherybomb on Sun May 11, 2014 11:18 pm

Hi
I use
-RPI model b
-I configure pitft on raspian
cherybomb
 
Posts: 3
Joined: Sun Feb 26, 2012 9:25 am

Re: CUPCADE: "A" button not working.

by pburgess on Tue May 13, 2014 3:28 am

Looks like the two programs haven't been compiled before trying to install; it's running some other version, probably the original MAME-on-Pi tutorial, which uses a different pinout. So...in the retrogame directory, first type:
Code: Select all | TOGGLE FULL SIZE
make clean; make CFLAGS=-DCUPCADE

and if that works, then type:
Code: Select all | TOGGLE FULL SIZE
sudo make install

If you have an early Model B board (one without mounting holes), there will be some changes needed in the retrogame code.
User avatar
pburgess
 
Posts: 2760
Joined: Sun Oct 26, 2008 2:29 am

Re: CUPCADE: "A" button not working.

by cherybomb on Sun Jul 20, 2014 8:06 pm

How to change the code??
cherybomb
 
Posts: 3
Joined: Sun Feb 26, 2012 9:25 am

Re: CUPCADE: "A" button not working.

by pburgess on Mon Jul 21, 2014 3:58 pm

This post explains changing the retrogame code for V1 Pi boards:

viewtopic.php?f=19&t=53557&p=273255&hilit=retrogame+v1#p270779

This is -only- necessary if you have a V1 board (no mounting holes).
User avatar
pburgess
 
Posts: 2760
Joined: Sun Oct 26, 2008 2:29 am