Gamepad firmware for RP2040 microcontrollers supporting Nintendo Switch, XInput and DirectInput

Overview

GP2040 Firmware

GP2040 is a gamepad firmware for the RP2040 microcontroller that provides high performance and a rich feature set across multiple platforms. GP2040 is compatible with PC, PS3, PS4 (legacy support) and Nintendo Switch.

Documentation can be found at https://feralai.github.io/GP2040.

Features

  • Selectable input modes (XInput, DirectInput and Nintendo Switch)
  • Overclocked polling rate to 1000 Hz (1 ms) in all modes, with less than 1 ms of input latency
  • Multiple SOCD cleaning modes - Neutral, Up Priority (a.k.a. Hitbox), Second Input Priority
  • Left and Right stick emulation via D-pad inputs
  • Per-button RGB LED support
  • PWM and RGB player indicator LED support (XInput only)
  • Save options to internal memory

Take a look at the GP2040 Usage page for more details.

Installation

Prebuilt uf2 files are available in the Releases section for the following boards and controllers:

Several other working example configurations are located in the configs folder.

The instructions will slightly vary based on your device. These instructions are for a Raspberry Pi Pico.

  1. Download the latest GP2040.uf2 file from the Releases section for your board (e.g. GP2040-PiPico.uf2 for the Raspberry Pi Pico).
  2. Unplug your Pico.
  3. Hold the BOOTSEL button on the Pico and plug into your computer. A new removable drive named RPI-RP2 should appear in your file explorer.
  4. Drag and drop the GP2040.uf2 file into the removable drive. This will flash the board.
  5. The board is now running the GP2040 firmware and will appear as a controller on your computer.

Performance

Input latency is tested using the methodology outlined at WydD's inputlag.science website, using the default 1000 Hz (1 ms) polling rate in the firmware.

Version Mode Poll Rate Min Max Avg Stdev % on time %1f skip %2f skip
v0.3.1 All 1 ms 0.56 ms 1.32 ms 0.85 ms 0.24 ms 95.95% 4.05% 0%

Full results can be found in the GP2040 Firmware Latency Test Results Google Sheet.

Support

If you would like to discuss features, issues or anything else related to GP2040 please create an issue or join the OpenStick GP2040 Discord channel.

Acknowledgements

Comments
  • Arcade stick unresponsive on PC and Switch with GP2040 - any advice?

    Arcade stick unresponsive on PC and Switch with GP2040 - any advice?

    Hi there,

    I bought a HRAP3 on eBay with the Pi Pico board and GP2040 pre-installed, and it is currently unresponsive on PC, MiSTer and Switch, save for the L3 and R3 buttons, which light up when I test the stick under 'game controllers' on PC. The HRAP shows up as an Xbox 360 controller on PC, a console the firmware doesn't support as far as I'm aware, so I'm wondering if this is an issue with the xinput/dinput/console settings - could you please let me know how to switch between these without opening up the stick, if possible? I've tried uninstalling the device on my PC and seeing if I can get it to register as a generic controller instead, but this didn't help. Is there anything else I can try? (I'm completely unfamiliar with GP2040 itself, but would be up for reinstalling it and doing some tinkering if necessary - please point me in the right direction!)

    Thank you very much for your help!

    Mike

    opened by Klatrymadon 5
  • Use a a different button to change to PS3/D-INPUT mode

    Use a a different button to change to PS3/D-INPUT mode

    I don't think many sticks have a native button for RS and LS, wouldn't it be better to but it on a button that is always there and never plugged up like one of B1-4? For example I tend to only use 6 buttons, and I've known people in the past to only use 3 (for VF) or 4 (for SNK) and plug up the rest.

    Also, this is a cool project, I ordered a pico and am looking forward to trying it in my stick.

    opened by Kareeeeem 4
  • Additional Configuration options. Basic PIO LED Support.

    Additional Configuration options. Basic PIO LED Support.

    I've added optional configuration for default mode values so that they can be changed on a per board basis. I've also added optional LED support. It's very basic--blink the pressed button if LEDs are configured for that button--but it's enough to prove things out.

    The LED setup has two (future) problems:

    We're limited to a single LED per button. There are a number of things out there at the moment that have multiple per button. The big hold up is the inability to create an array with #defines, but I'm hesitant to start storing actual variables in the board configuration files. Open to suggestions here. TOML or something would be more muggle friendly, but it's a lot more work than just defining some constants.

    It needs to be migrated out of main.cpp into somewhere we can easily manage the current state for animations. Button presses should be telling this class "hey man, animate this button" and not worrying about handling the actual animation.

    opened by jbarket 4
  • Emulate analog sticks output with dpad

    Emulate analog sticks output with dpad

    say you are able to hold down a layer button to temporarily enable the dpad buttons to emulate analog stick(s) output. or a dip switch to change switch to analog stick(L/R) emulation.

    opened by megablue 2
  • EEPROM needs validation (CRC check)

    EEPROM needs validation (CRC check)

    There is a relatively common issue where if the Pico/RP2040 device has been previously flashed with something other than GP2040, the area of flash used for emulated EEPROM could contain invalid values causing the firmware to misbehave (locked to certain input type, buttons might not work, etc.).

    Add CRC check to the EEPROM data and perform an EEPROM reset if the CRC does not match when loaded.

    bug 
    opened by FeralAI 2
  • Question about memory

    Question about memory

    Hello, I'm thinking about getting a Raspberry Pico to test this, but it seems that there are different memory sizes available, from 2MB to 16MB. From what I've seen the uf2 file is a little less than 2MB, so would the 2MB flash memory be enough or should I get the one with 4MB+?

    opened by VenomFriend 1
  • Configurator - RGB LED Configuration

    Configurator - RGB LED Configuration

    Create a page in the config app to allow enabling and configuring LED support. This will require some refactoring since the LED code is conditionally included. Should include everything from the RGB LED section of the dev doc: https://feralai.github.io/GP2040/#/development?id=rgb-leds

    enhancement 
    opened by FeralAI 1
  • Software Module Interface

    Software Module Interface

    Define an interface for libraries to be able to plug into GP2040. Would likely have the following traits (plus more I'm sure):

    • Main module code will run on core1
    • Modules will likely need their own way to setup() and loop() on the core1 thread
    • May need to integrate defines in BoardConfig.h
    • Can rely upon receiving GamepadState to perform actions (flash LEDs, display status, make noise, etc.)
    enhancement 
    opened by FeralAI 1
  • EEPROM with Multicore Lockout

    EEPROM with Multicore Lockout

    EEPROM commit no longer commits, but sets a timer for when the next write should happen. Additional writes in that gap will push the timer out so we don't hammer flash memory. When time hits, we also lock out core1 to prevent any weirdness with data access across cores.

    opened by jbarket 1
  • Mapping image for Xbox360 controllers

    Mapping image for Xbox360 controllers

    Hi @FeralAI, I don't know if this is useful but here you have the image for the default mapping to Xbox360 controller in Windows just in case you want to use it on the documentation.

    You can close this issue.

    GP2040_to_Xbox

    Thank you for your work.

    (Same as https://gp2040.info/#/usage?id=buttons)

    opened by KabukiFlux 0
  • dpad mode randomly switching to left or right analog

    dpad mode randomly switching to left or right analog

    i have my input mode normally set to xinput with dpad mode to d-pad but it gets randomly switched to left or right analog while i'm using the controller.

    opened by gajowy123 0
  • -- GP2040 is no longer being maintained - Check out GP2040-CE which is the new supported version --

    -- GP2040 is no longer being maintained - Check out GP2040-CE which is the new supported version --

    Hey folks,

    The main GP2040 is no longer being maintained.

    We have been working hard at a community edition over at GP2040-CE (https://github.com/OpenStickFoundation/GP2040-CE).

    If you need help with either GP2040 or GP2040-CE please check us out on Discord via the new link here: https://discord.gg/qVcrGVDj2h

    opened by TheTrainGoes 0
  • Switch Mode is not recognized on Switch!

    Switch Mode is not recognized on Switch!

    1.On Win10, Switch Mode can be recognized as: POKKEN CONTROLLER (Vendor: 0f0d Product: 0092).But when I plugged it into the Switch, I couldn't recognize it!

    2.Can you increase support for Xbox 360 game console?

    opened by BDJoe360 2
  •  Display freezes after a few seconds

    Display freezes after a few seconds

    Hi, i have an SSD1306 128x64 OLED display, and it freezes about 10 seconds the stick is plugged in. Hot-plugging the OLED makes it work for another ten seconds or so.

    Also, after powering down the stick, if i plug it back in right away the display rarely comes up. Hot-plugging the OLED does nothing there.

    I have a couple more OLEDs on order from another seller and will try to figure out if the display itself is the issue.

    opened by butterrsoft 1
  • after use latest version dependency libs, init adc is not work

    after use latest version dependency libs, init adc is not work

    I use latest wizio-pico, and, patch the tinyusb_gamepad commit(Updated to support latest TinyUSB version #79), then, the init adc is not work.

    I init adc in Gamepad::setup method, like:

    adc_init(); adc_gpio_init(26); adc_gpio_init(27); adc_gpio_init(28);

    and, in Gamepad::read method: update joystick like:

    adc_select_input(0); state.lx = (adc_read() >> 4) << 8; adc_select_input(1); state.ly = (adc_read() >> 4) << 8;

    it worked before, but, now it not work, I am sure it not my hardware problem, and, not the code problem, it must be some latest lib update break something

    opened by fiefdx 2
Releases(v0.4.3)
A Nintendo Switch homebrew for importing and exporting Miis.

MiiPort A Nintendo Switch homebrew for importing and exporting Miis. Installation Download a release and then place the .nro file at sd:/switch/MiiPor

null 22 Aug 23, 2022
Moonlight port for Nintendo Switch

Moonlight-Switch Moonlight-Switch is a port of Moonlight Game Streaming Project for Nintendo Switch. Thanks a lot to Rock88 and his Moonlight-NX, lots

Vinogradov Daniil 253 Sep 22, 2022
Tesla cheat trainers for Grand Theft Auto: The Trilogy - The Definitive Edition for the Nintendo Switch.

nxGTA-Trainers This is a set of tools for cheating in Grand Theft Auto: The Trilogy - The Definitive Edition for the Nintendo Switch. While I will try

null 25 Sep 14, 2022
English Translation Mod for Air Nintendo Switch version

AIR-ENX English translation mod for Nintendo Switch version of "Air" 1.0.1 Current status: Alpha Chapters translation status: Dream 100% Summer 100% A

MasaGratoR 6 Sep 6, 2022
Nintendo Switch Emulator

yuzu yuzu is the world's most popular, open-source, Nintendo Switch emulator — started by the creators of Citra. It is written in C++ with portability

null 21.7k Sep 19, 2022
Read Books On Your Nintendo Switch

eBookReaderSwitch Features: Saves last page number Reads PDF, EPUB, CBZ, and XPS files Dark and light mode Landscape reading view Portrait reading vie

null 48 Aug 16, 2022
Use Nintendo Switch JoyCons as a virtual Xbox 360 controller in Windows

XJoy XJoy allows you to use a pair of Nintendo Joy-Cons as a virtual Xbox 360 controller on Windows. XJoy is made possible by ViGEm and hidapi. Suppor

DuroSoft 337 Sep 13, 2022
A decompilation of the Nintendo Switch version of Captain Toad: Treasure Tracker [v1.3.0].

cttt-decomp A decompilation of the Nintendo Switch version of Captain Toad: Treasure Tracker [v1.3.0]. Build Instructions Obtain a clean copy of a mai

shibbs 14 Aug 17, 2022
Play Nintendo Switch using an original N64 controller via an Arduino Uno!

N64 -> Arduino Uno -> Nintendo Switch Description By connecting an original N64 controller to an Arduino UNO R3 running this code, and plugging the US

null 18 Sep 16, 2022
Open source Splatoon 2 save editor for the Nintendo Switch (NX) built on top of the effective-spoon project

Open source Splatoon 2 save editor for the Nintendo Switch (NX) built on top of the effective-spoon project

Crusty ★ 6 Sep 16, 2022
Firmware for Acorn Archimedes RP2040-based podule

Acorn Archimedes Pipe Podule firmware v0.1 5 October 2021 This repository contains firmware for the Arc Pipe Podule. (PCB design files can be found in

Matt Evans 4 Oct 31, 2021
RPi Pico/RP2040 firmware for the Scoppy Oscilloscope

scoppy-pico RPi Pico/RP2040 firmware for the Scoppy Oscilloscope Installation and getting started instructions Scoppy Android app - Play Store Scoppy

null 51 Sep 13, 2022
STM32 firmware for a physical switch to set the GRUB boot selection

STM32 firmware for a physical switch to set the GRUB boot selection

Stephen Holdaway 311 Sep 9, 2022
Vectron VGA Plus generates a [email protected] VGA signal and has an interface that works with retro computers or microcontrollers.

Vectron VGA Plus Vectron VGA Plus generates a [email protected] VGA signal and has an interface that works with retro computers or microcontrollers. Screen

Nick Bild 31 Jul 27, 2022
LM75A temperature sensor library that you can use with STM32F10x series microcontrollers.

STM32F10x-LM75A-Library LM75A temperature sensor library that you can use with STM32F10x series microcontrollers. Launching the LM75A sensor in your a

null 11 May 2, 2022
HD44780 peripheral library for stm32 microcontrollers.

stm32-HD44780 This is a peripheral driver library for interfacing stm32 microcontrollers with the HD44780 display driver. The implementation uses the

Lorenzo Murarotto 17 Jan 20, 2022
A Tamagotchi P1 emulator for microcontrollers

MCUGotchi - A Tamagotchi P1 emulator for microcontrollers Synopsis MCUGotchi is a Tamagotchi P1 emulator for microcontrollers relying on the hardware

Jean-Christophe Rona 58 Aug 5, 2022
This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community

This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community. We will share documents, presentations and source code of two demo applications.

Machine Learning Tokyo 15 Oct 23, 2021
X-CUBE-AZRTOS-F4 (Azure RTOS Software Expansion for STM32Cube) provides a full integration of Microsoft Azure RTOS in the STM32Cube environment for the STM32F4 series of microcontrollers.

X-CUBE-AZRTOS-F4 Azure RTOS Software Expansion for STM32Cube With Azure RTOS complementing the extensive STM32Cube ecosystem providing free developmen

STMicroelectronics 25 Aug 12, 2022