If you’re having problems with the Arcade Bonnet, we have a basic troubleshooting script that can help. This only tests the button and stick inputs, not audio.

The arcadeBonnet.py Python script should not be running at the same time. You can test for this with:

ps -ef | grep arcade

If you see a process ID related to this (other than the grep itself), stop it with the kill command. Once that’s stopped, we can proceed…

Begin by making sure that the Pi’s I2C interface is enabled. From the command line:

sudo raspi-config nonint do_i2c 0

(This can also be done via the interactive raspi-config menus, under “Interface Options.”)

You do not need to reboot after making this change.

Then install some I2C utilities:

sudo apt-get install i2c-tools

Finally, fetch the troubleshooting script…

curl https://raw.githubusercontent.com/adafruit/Adafruit-Retrogame/master/arcade_bonnet_test.sh >arcade_bonnet_test.sh

…and run it:

bash arcade-bonnet.sh

(This does not require a “sudo”, but there’s no harm either way.)

If the prerequisite steps are done and the Arcade Bonnet is detected, the script will continually show the status of all the inputs. Active buttons and joystick inputs are marked with a “*”. Try pressing each attached input and moving stick(s) around to confirm that each one “lights up” a corresponding item here. Press Control-C to stop.

Here’s how the output would look when no buttons are pressed and an attached analog stick is tilted right. A single * marks the analog R item.

If one or more items do not react as expected: this could be a wiring fault, perhaps a broken wire or poor solder connection. Or—this is extremely esoteric—but there are certain types of optical or Hall-effect joysticks or buttons that are not compatible with Arcade Bonnet’s touch-to-ground operation. Most simple switches and sticks should work though!

If the script exits immediately with a syntax error: the Arcade Bonnet hardware is not detected. Make sure it is properly aligned atop the Pi’s GPIO header, not off-by-one in any direction. If it’s correctly aligned, disconnect all button and stick inputs and try running again. If that still fails, this suggests a problem with the Bonnet, and you should request specific help in the Adafruit Forums.

#/bin/bash

# Arcade Bonnet troubleshooting tool. Checks whether prerequisite
# config and tools are present, and runs live status of inputs.

# Test if primary I2C enabled, offer help if needed
if [ ! -c /dev/i2c-1 ]
then
	echo "I2C not present. Enable with:"
	echo "  sudo raspi-config nonint do_i2c 0"
	echo "or use raspi-config 'Interface Options' menu"
	exit 1
fi

# Test if i2ctools installed, offer help if needed
if ! type i2cset >/dev/null 2>&1
then
	echo "i2c-tools not present. Install with:"
	echo "  sudo apt-get install i2c-tools"
	exit 1
fi

# MCP23017 I2C address default is 0x20, Arcade Bonnet uses 0x26:
MCP_ADDR=0x26

# registers
IODIRA=0x00
IODIRB=0x01
GPPUA=0x0C
GPPUB=0x0D
GPIOA=0x12
GPIOB=0x13

# set all pins to input
i2cset -y 1 $MCP_ADDR $IODIRA 0xFF
i2cset -y 1 $MCP_ADDR $IODIRB 0xFF

# enable internal pull up on all pins
i2cset -y 1 $MCP_ADDR $GPPUA 0xFF
i2cset -y 1 $MCP_ADDR $GPPUB 0xFF

# Display one input state, showing '*' if currently active
disp() {
	if [ $(($2 >> $3 & 0x01)) -ne 0 ]
	then
		echo " $1 :"
	else
		echo " $1 : *"
	fi
}

# Test all Arcade Bonnet inputs in a loop
while :
do
	# read pin state
	GPA=$(i2cget -y 1 $MCP_ADDR $GPIOA)
	GPB=$(i2cget -y 1 $MCP_ADDR $GPIOB)

	# report
	clear
	echo "===== BUTTONS ====="
	echo "raw value = $GPA"
	disp "1A" $GPA 0
	disp "1B" $GPA 1
	disp "1C" $GPA 2
	disp "1D" $GPA 3
	disp "1E" $GPA 4
	disp "1F" $GPA 5

	echo "==== JOYSTICKS ===="
	echo "raw value = $GPB"
	echo "4-WAY"
	disp "L" $GPB 3
	disp "R" $GPB 2
	disp "U" $GPB 1
	disp "D" $GPB 0
	echo "ANALOG"
	disp "L" $GPB 5
	disp "R" $GPB 4
	disp "U" $GPB 6
	disp "D" $GPB 7

	echo "== CTRL-C TO EXIT =="
done

This guide was first published on Feb 22, 2017. It was last updated on Jan 03, 2023.

This page (Troubleshooting) was last updated on Jan 03, 2023.

Text editor powered by tinymce.