Skip to content

copyrat90/gba-pico-gamepad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gba-pico-gamepad

Proof-of-concept Game Boy Advance (GBA) to USB controller, which uses Raspberry Pi Pico as a bridge.

How it's done

This project is essentially a modified version of GP2040-CE that enables communication with the Game Boy Advance using the GBA link cable.

In the original GP2040-CE, key presses were received using pull-up GPIO signals.
However, The GBA link cable only provides 4 pins for the communication, which is insufficient for the 10 keys on the GBA.
To overcome this limitation, GP2040-CE was modified to utilize SPI for receiving packets from the GBA.

To send key presses on the GBA via SPI, an example program from the gba-link-connection was used with a minor modification.

To run this program on the GBA, gba_03_multiboot is ported to the RPi Pico.
This allows for sending a program from RPi Pico to GBA via SPI and running it, eliminating the need for additional hardware such as a flash cart.

And that's about it.

Read this in Korean(한국어) with a little more detail

Usage

  1. Download the gba-pico-gamepad-v*.uf2 binary from the Release, and flash it to your RPi Pico.

  2. Cut your GBA link cable, and wire it to the RPi Pico as below.

    • RPi Pico 21 (SPI0 RX) pin <-> GBA SO pin
    • RPi Pico 23 (GND) pin <-> GBA GND pin
    • RPi Pico 24 (SPI0 SCK) pin <-> GBA SC pin
    • RPi Pico 25 (SPI0 TX) pin <-> GBA SI pin
    • Overall pinout
    • Raspberry Pi Pico Pinout
    • GBA Link cable Pinout
      • Your GBA Link cable colors are likely to be different.
        It is highly recommended to cut and open the shell to see your pinout.
      • GBA pinout
  3. Connect this cable to the GBA and turn it on without a cartridge.

    • The program is sent from RPi Pico to GBA via multiboot, and with a cartridge it will not work.
  4. Plug the USB Cable to your PC.
    It will start sending the program once the GBA is ready.

    • You can hold down certain key on boot to change Input Mode.
      • Note that the key binding is differ from the original.
      • Hold B on boot -> Nintendo Switch
      • Hold A on boot -> XInput
      • Hold L on boot -> DirectInput/PS3
      • Hold R on boot -> PS4
    • You can change the D-Pad Mode anytime with certain key combination.
    • GP2040-CE's Web Config is disabled.
  5. Enjoy your GBA as an USB gamepad.

    • If you accidentally pulled out your cable, you can re-plug it and press Start to reconnect.

Build

This is a build process for the Ubuntu 22.04.
You have to use WSL2 if you are on Windows.

  1. Install devkitARM and gba-dev package.

  2. Install the dependencies via command below.

    sudo apt install -y cmake xxd python3
  3. Run this command to build.

    Change the path if you have installed devkitARM somewhere else.

    export DEVKITPRO=/opt/devkitpro/
    export DEVKITARM=/opt/devkitpro/devkitARM/
    export PATH=$DEVKITARM/bin:/$DEVKITPRO/tools/bin/:$PATH
    export CC=$DEVKITARM/bin/arm-none-eabi-gcc
    export CXX=$DEVKITARM/bin/arm-none-eabi-g++
    
    ./build.sh
  4. If everything goes right, you should see the build/gba-pico-gamepad.uf2 binary.

Credits

This project is essentially an integration of the projects listed below.
Without them, this would not have been possible.

License

See the license of each project above.
/build.sh is 0BSD.