-
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
Open
jhordies
wants to merge
7
commits into
raspberrypi:develop
Choose a base branch
from
jhordies:add-pi500-board-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d567e0d
Add Raspberry Pi 500 board support
jhordiesluminus 1d3de12
Correct Pi 500 board support: RP2040 chip, proper naming
jhordiesluminus 8c2dcc0
PICO_RP2040_B0_SUPPORTED can be changed to 0, since all Pi 500s are u…
jhordiesluminus aed2dfd
Update Raspberry Pi 500 board support for minimal original intent.
jhordiesluminus 2d2164b
Fix flash size.
jhordiesluminus fe8763c
Adding UART TX GP16
jhordiesluminus 11e0ee6
Add Caps led as default led
jhordiesluminus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* | ||
* Copyright (c) 2024 Raspberry Pi (Trading) Ltd. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
// ----------------------------------------------------- | ||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO | ||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES | ||
// ----------------------------------------------------- | ||
|
||
#ifndef _BOARDS_RASPBERRY_PI_PI500_RP2040_H | ||
#define _BOARDS_RASPBERRY_PI_PI500_RP2040_H | ||
|
||
pico_board_cmake_set(PICO_PLATFORM, rp2040) | ||
|
||
// For board detection | ||
#define RASPBERRY_PI_PI500_RP2040 | ||
|
||
// --- UART --- | ||
#ifndef PICO_DEFAULT_UART | ||
#define PICO_DEFAULT_UART 0 | ||
#endif | ||
#ifndef PICO_DEFAULT_UART_TX_PIN | ||
#define PICO_DEFAULT_UART_TX_PIN 16 // Pi 500 debug UART on GP16 | ||
#endif | ||
#ifndef PICO_DEFAULT_UART_RX_PIN | ||
#define PICO_DEFAULT_UART_RX_PIN 1 // Standard RX pin | ||
#endif | ||
|
||
// --- LED --- | ||
#ifndef PICO_DEFAULT_LED_PIN | ||
#define PICO_DEFAULT_LED_PIN 17 // Pi 500 LED on GP17 | ||
#endif | ||
|
||
// --- 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 | ||
lurch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
// --- FLASH --- | ||
// Pi 500 uses W25X10CL flash (differs from standard Pico W25Q080) | ||
#define PICO_BOOT_STAGE2_CHOOSE_W25X10CL 1 | ||
|
||
#ifndef PICO_FLASH_SPI_CLKDIV | ||
#define PICO_FLASH_SPI_CLKDIV 2 | ||
#endif | ||
|
||
pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (1 * 1024 * 1024)) // 1MB W25X10CL | ||
#ifndef PICO_FLASH_SIZE_BYTES | ||
#define PICO_FLASH_SIZE_BYTES (1 * 1024 * 1024) | ||
#endif | ||
|
||
// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) | ||
#define PICO_SMPS_MODE_PIN 23 | ||
lurch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
#ifndef PICO_RP2040_B0_SUPPORTED | ||
#define PICO_RP2040_B0_SUPPORTED 1 | ||
jhordies marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
#endif | ||
|
||
// 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 | ||
lurch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
// --- 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 | ||
lurch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
// --- BOOTLOADER CONFIGURATION --- | ||
// Disable double tap reset timeout for Pi 500 | ||
#define PICO_BOOTSEL_VIA_DOUBLE_RESET_ACTIVITY_LED 0 | ||
lurch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
// --- PI 500 KEYBOARD MATRIX CONFIGURATION --- | ||
// Complete GPIO pin mapping for 8×18 keyboard matrix | ||
// 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 | ||
lurch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
// Matrix scanning: ROW2COL, no diodes (ghost keys possible with 3+ key combinations) | ||
|
||
// --- PI 500 SYSTEM PINS --- | ||
// These pins are reserved for Pi 500 hardware functions: | ||
// GP0-GP7: Keyboard matrix rows | ||
// GP8-GP15: Keyboard matrix columns (partial) | ||
// GP16: Debug UART TX | ||
// GP17: LED (heartbeat/debug) | ||
// GP18: Keyboard matrix column | ||
// GP19: Power button control (PWR_BTN) - CRITICAL for Pi power management | ||
// GP20: Power key detection column (separate from matrix) | ||
// GP21-GP24: Keyboard matrix columns | ||
// GP25: Caps Lock LED | ||
// GP26-GP29: Keyboard matrix columns | ||
|
||
// --- POWER MANAGEMENT WARNING --- | ||
// Custom firmware MUST implement power button handling via GP19 or the Pi 500 | ||
// power button will stop working, potentially making the device unbootable. | ||
// See QMK pi500.c for reference implementation. | ||
|
||
#endif |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.