-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Raspberry Pi 500's RP2040 board support Fixes #2640 #2641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
- 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.
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
#ifndef PICO_DEFAULT_UART_RX_PIN | ||
#define PICO_DEFAULT_UART_RX_PIN 1 // Standard RX pin | ||
#endif |
There was a problem hiding this comment.
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.
// --- I2C --- | ||
#ifndef PICO_DEFAULT_I2C | ||
#define PICO_DEFAULT_I2C 0 | ||
#endif | ||
#ifndef PICO_DEFAULT_I2C_SDA_PIN | ||
#define PICO_DEFAULT_I2C_SDA_PIN 4 | ||
#endif | ||
#ifndef PICO_DEFAULT_I2C_SCL_PIN | ||
#define PICO_DEFAULT_I2C_SCL_PIN 5 | ||
#endif | ||
|
||
// --- SPI --- | ||
#ifndef PICO_DEFAULT_SPI | ||
#define PICO_DEFAULT_SPI 0 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_SCK_PIN | ||
#define PICO_DEFAULT_SPI_SCK_PIN 18 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_TX_PIN | ||
#define PICO_DEFAULT_SPI_TX_PIN 19 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_RX_PIN | ||
#define PICO_DEFAULT_SPI_RX_PIN 16 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_CSN_PIN | ||
#define PICO_DEFAULT_SPI_CSN_PIN 17 | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it makes no sense to define any PICO_DEFAULT_I2C
or PICO_DEFAULT_SPI
settings here.
#endif | ||
|
||
// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) | ||
#define PICO_SMPS_MODE_PIN 23 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your comments say that this is used as a matrix row?
// The GPIO Pin used to read VBUS to determine if the device is battery powered. | ||
#ifndef PICO_VBUS_PIN | ||
#define PICO_VBUS_PIN 24 | ||
#endif | ||
|
||
// The GPIO Pin used to monitor VSYS. Typically you would use this with ADC. | ||
#ifndef PICO_VSYS_PIN | ||
#define PICO_VSYS_PIN 29 | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before, you shouldn't be defining things if those pins are actually used by the keyboard matrix.
// --- USB CONFIGURATION --- | ||
// Crucial for Pi 500 keyboard function when Pi is off - ignores USB startup check | ||
#define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE 0 | ||
#define PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this doesn't do what you think it does - it's not disabling USB_RESET_BOOTSEL_ACTIVITY_LED, but setting it to GP0.
|
||
// --- BOOTLOADER CONFIGURATION --- | ||
// Disable double tap reset timeout for Pi 500 | ||
#define PICO_BOOTSEL_VIA_DOUBLE_RESET_ACTIVITY_LED 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment 🙂
(and look also at Chapter 6 of https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf )
// Rows (8): GP0, GP1, GP2, GP3, GP4, GP5, GP6, GP7 | ||
// Cols (18): GP27, GP8, GP9, GP10, GP11, GP12, GP13, GP14, GP23, GP24, GP22, GP20, GP29, GP18, GP15, GP21, GP28, GP26 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it might be useful to do e.g.
#define PI500_RP2040_MATRIX_ROW_0_PIN 0
#define PI500_RP2040_MATRIX_ROW_1_PIN 1
#define PI500_RP2040_MATRIX_COL_0_PIN 27
#define PI500_RP2040_MATRIX_COL_1_PIN 8
etc. ?
Sorry I didn't get the hint. |
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