Skip to content

Conversation

jhordies
Copy link

@jhordies jhordies commented Sep 1, 2025

This PR adds board support for the Raspberry Pi 500's embedded RP2040 microcontroller, enabling custom firmware development while maintaining compatibility with the original keyboard functionality.

Changes:

Add raspberry_pi_pi500.h board definition
Configure W25X10CL flash support
Document complete GPIO pin mapping for 8×18 keyboard matrix
Define system function pins (power control, LEDs, debug UART)
Enable USB operation independent of main Pi power state

Hardware Specifications:

Chip: RP2040 (same as Pico)
Flash: W25X10CL 1MB (DSPI mode)
USB: Connected to Pi 500 USB hub
Matrix: 8 rows × 18 columns keyboard matrix
System GPIO: GP16 (UART), GP17 (LED), GP19 (power), GP20 (power key), GP25 (Caps LED)
Available GPIO: None (all pins reserved)

Testing:
✅ Successful firmware compilation with
✅ USB device enumeration and communication
✅ System function compatibility (power, LEDs)
✅ Compatible with original keyboard firmware restoration

Use Cases:
This enables Pi 500 users to develop custom USB applications like MIDI controllers, HID devices, and keyboard firmware modifications while preserving hardware compatibility. Note that unlike standard Pico boards, no GPIO pins are available for general use.

Files Changed:
src/boards/include/boards/raspberry_pi_pi500_rp2040.h (new)

Usage:
-DBOARD=raspberry_pi_pi500_rp2040

⚠️ CRITICAL WARNING: Custom firmware must implement power button handling (GP19 control) or the Pi 500 power button will stop working, potentially making the device unbootable. Always include power management code from the original QMK firmware.

- W25X10CL flash configuration for DSPI mode
- USB standalone operation support
- Complete GPIO pin documentation with keyboard matrix mapping
- Debug UART configuration on GP16
- Hardware-specific boot and power management settings

Tested with TinyUSB MIDI example - successful enumeration and operation.
@lurch
Copy link
Contributor

lurch commented Sep 2, 2025

As I attempted to hint at in the linked issue, the Raspberry Pi 500 keyboard uses RP2040, not RP2350.

Also, IMHO it would be better if this header file just declared everything explicitly, rather than doing

#include "boards/pico2.h"

And the filename should perhaps clarify that this is only the keyboard part of the Pi 500, not the entire thing 😆

- Rename to raspberry_pi_pi500_rp2040.h for clarity
- Correct chip type from RP2350 to RP2040
- Remove pico2.h inheritance, use self-contained definitions
- Add comprehensive GPIO pin mapping documentation
- Include critical power management warning
- Configure W25X10CL flash support for RP2040
Comment on lines 27 to 29
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1 // Standard RX pin
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to your comments below, GP1 is used as a matrix row, so you shouldn't define it here.

@jhordies jhordies changed the title Add Raspberry Pi 500's RP2350 board support Fixes #2640 Add Raspberry Pi 500's RP2040 board support Fixes #2640 Sep 3, 2025
@jhordies
Copy link
Author

jhordies commented Sep 3, 2025

As I attempted to hint at in the linked issue, the Raspberry Pi 500 keyboard uses RP2040, not RP2350.

Also, IMHO it would be better if this header file just declared everything explicitly, rather than doing

#include "boards/pico2.h"

And the filename should perhaps clarify that this is only the keyboard part of the Pi 500, not the entire thing 😆

Sorry I didn't get the hint.
You are correct, and updated the code accordingly.

@lurch lurch linked an issue Sep 3, 2025 that may be closed by this pull request
@lurch
Copy link
Contributor

lurch commented Sep 12, 2025

@jhordies Do you have any interest in continuing to push this forwards?

- Fix mistake done in pico.h PICO_RP2040_B0_SUPPORTED 0 => 1
- Disable B0 support in pi500_rp2040
- Fix flash size 1M-Bit not 1Mb
- Add Matrix pin definition
@lurch
Copy link
Contributor

lurch commented Sep 12, 2025

Thanks! I'll take a look at this next week.

@lurch lurch self-requested a review September 12, 2025 13:24
@lurch lurch self-assigned this Sep 12, 2025
@jhordies
Copy link
Author

Thanks! I'll take a look at this next week.

Thanks, I tried to make a minimal version integrating your comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Raspberry Pi 500's RP2040 board support
3 participants