X-Hat and BTN7 + BTN8

Hey All,

I’ve built my new Picade unit just a week ago, and I’ve been looking into doing a couple mods to it - namely adding in buttons for volume control. I noticed on the Hack Header, there are two additional button headers (BTN7 and BTN8), so I figured using these would be an easy mod. However, I’ve not been able to get Retropie to recognize any button presses from these headers (yes, I have wired to the Ground terminals as well). I ensured my button worked properly as I plugged it in one of the standard button headers (BTN6) and confirmed the button is good.

Has anyone successfully mapped these button headers to either execute a script or act as a keyboard button?

The pinout is here, https://pinout.xyz/pinout/picade_x_hat#
Looks like they go to BCM 15 and 14, pins 10 and 8 of the GPIO.
Best guess is they aren’t programed in the installer by default. You’ll have to do some extra bits to get them working. Map those GPIO to a button in retropi or something?
I don’t own a Picade and have never used retropi etc. If I’m way off target that why. ;)

Thanks for the response :)

You are right, they weren’t programmed in the installer. So I downloaded the code, modified the dts to include button7 and button8 as BCM 15 and 14 respectively with their appropriate linux keycodes, then built and installed the overlay. However, it doesn’t seem to have made a difference, as the GPIO still reports no activity from these button presses (I test on the unit using gpio readall). I must be missing something small somewhere, but can’t quite put my finger on it.

Looks like you’ll have to ask somebody like Phil @gadgetoid from Pimoroni what else is needed to get them working.

Aha, got it working!

So, even though I had programmed in button7 and button8 in the installer, they still refused to register - so I decided just for fun to modify my config file to configure the overrides on the dtoverlay, since I had set up the overrides in my installer as well. So I set my dtoverlay=picade,button7=78,button8=74 and the buttons were then recognized.

Strange how it wasn’t working properly without the override set, but as long as it works, I’m happy.

Good sleuthing, and good to hear you got them working. It would have taken me a month of Sundays to figure that one out.

I’m also trying to get Buttons 7&8 working. When you say you modified the installer, which installer are you referring to? I downloaded the picadehat script but I don’t see any references to buttons in that.

There wasn’t any mentions of the buttons in the installer - I had to add them in. In the picade.dts file I added the following after the button6 definition:

button7: button7 {
	label = "Button 7";
	linux,code = <78>;
	gpios = <&gpio 15 1>;
};

button8: button8 {
	label = "Button 8";
	linux,code = <74>;
	gpios = <&gpio 14 1>;
};

And in addition to those, as I had mentioned, I had to update dtoverlay as well in the config.txt. My button config uses + and - as the linux key codes, so if you wanted different keys, you’d have to figure out what your keycode is that you want to use.

Thanks, that’s helpful. I’ll look into that.

Hi, Thanks for that. I got it mostly working but there seems to be an incompatibility with the Button 8 and the RPi4. Can I just ask what model you were using?

It seems that there is no input from Button 8, and then all of a sudden, you get a massive string of characters from it (as if the button is being held in) without anything being touched.

I’ll contact Pimoroni about it, but I suspect it’s a non-starter.

Cheers
Simon

Go into the Raspberry Pi Configuration Menu, Interfaces < I think, and make sure Serial is disabled. GPIO 14 is the UART TXD pin.

I use a Pi 3B+. Sorry I can’t be of much assistance when it comes to the Pi 4, hopefully you’re able to get that sorted out :)

Thanks for the suggestion, but it didn’t make a difference unfortunately. Just replied to another thread, that it seems I get the odd ‘-’ character every now and then without pressing anything.

Fixed it. I also needed to add the missing pins in the dts file.

brcm,pins = <5 6 8 9 10 11 12 14 15 16 20 22 23 24 25 27>;

Oops… Totally forgot I had to add those too.

It’s been a while since I made the changes on the file, so it was an oversight on my response :D