-
Notifications
You must be signed in to change notification settings - Fork 8.1k
boards: waveshare: Add RP2350 Zero board support #97628
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
cetola
wants to merge
1
commit into
zephyrproject-rtos:main
Choose a base branch
from
cetola:rp2350_zero
base: main
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.
+454
−0
Open
Changes from all commits
Commits
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
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,16 @@ | ||
# Copyright (c) 2025 Stephano Cetola | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if BOARD_RP2350_ZERO | ||
|
||
config USB_SELF_POWERED | ||
default n | ||
|
||
if I2C_DW | ||
|
||
config I2C_DW_CLOCK_SPEED | ||
default 125 | ||
|
||
endif # I2C_DW | ||
|
||
endif # BOARD_RP2350_ZERO |
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,6 @@ | ||
# Copyright (c) 2025 Stephano Cetola | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_RP2350_ZERO | ||
select SOC_RP2350A_HAZARD3 if BOARD_RP2350_ZERO_RP2350A_HAZARD3 | ||
select SOC_RP2350A_M33 if BOARD_RP2350_ZERO_RP2350A_M33 |
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,24 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "") | ||
set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap") | ||
endif() | ||
|
||
board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]") | ||
if(CONFIG_ARM) | ||
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]") | ||
else() | ||
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350-riscv.cfg]") | ||
endif() | ||
|
||
# The adapter speed is expected to be set by interface configuration. | ||
# The Raspberry Pi's OpenOCD fork doesn't, so match their documentation at | ||
# https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#debugging-with-swd | ||
board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 5000") | ||
board_runner_args(probe-rs "--chip=RP235x") | ||
|
||
board_runner_args(uf2 "--board-id=RP2350") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/probe-rs.board.cmake) |
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,6 @@ | ||
board: | ||
name: rp2350_zero | ||
full_name: RP2350-Zero | ||
vendor: waveshare | ||
socs: | ||
- name: rp2350a |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,88 @@ | ||
.. zephyr:board:: rp2350_zero | ||
|
||
Overview | ||
******** | ||
|
||
RP2350-Zero, A Low-Cost, High-Performance Pico-Like MCU Board Based On Raspberry Pi Microcontroller RP2350. | ||
|
||
Hardware | ||
******** | ||
- RP2350A microcontroller chip designed by Raspberry Pi in the United Kingdom | ||
- Adopts unique dual-core and dual-architecture design: dual-core Arm Cortex-M33 processor and dual-core Hazard 3 RISC-V processor, flexible clock running up to 150 MHz | ||
- 520KB of SRAM, and 4MB of on-board Flash memory | ||
- Type-C connector, keeps it up to date, easier to use | ||
- Castellated module allows soldering directly to carrier boards | ||
- USB 1.1 with device and host support | ||
- Low-power sleep and dormant modes | ||
- Drag-and-drop programming using mass storage over USB | ||
- 29 × multi-function GPIO pins (20× via edge pinout, others via solder points) | ||
- 2 × SPI, 2 × I2C, 2 × UART, 4 × 12-bit ADC, 24 × controllable PWM channels | ||
- Accurate clock and timer on-chip | ||
- Temperature sensor | ||
- Accelerated floating-point libraries on-chip | ||
- 12 × Programmable I/O (PIO) state machines for custom peripheral support | ||
|
||
Supported Features | ||
================== | ||
|
||
.. zephyr:board-supported-hw:: | ||
|
||
Pin Mapping | ||
=========== | ||
|
||
The peripherals of the RP2350 SoC can be routed to various pins on the board. The configuration of these routes can be modified through DTS. Please refer to the datasheet to see the possible routings for each peripheral. | ||
|
||
For detailed hardware information, see the `RP2350-Zero – Waveshare Wiki <https://www.waveshare.com/wiki/RP2350-Zero>`_. | ||
|
||
|
||
Default Zephyr Peripheral Mapping: | ||
---------------------------------- | ||
|
||
.. rst-class:: rst-columns | ||
|
||
- UART0_TX : P0 | ||
- UART0_RX : P1 | ||
- I2C0_SDA : P4 | ||
- I2C0_SCL : P5 | ||
- I2C1_SDA : P6 | ||
- I2C1_SCL : P7 | ||
- ADC_CH0 : P26 | ||
- ADC_CH1 : P27 | ||
- ADC_CH2 : P28 | ||
- ADC_CH3 : P29 | ||
|
||
Programming and Debugging | ||
************************* | ||
|
||
.. zephyr:board-supported-runners:: | ||
|
||
Flashing | ||
======== | ||
|
||
Using UF2 | ||
--------- | ||
|
||
Here is an example of building the sample for driving the built-in RGB led. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/drivers/led/led_strip | ||
:board: rp2350_zero/rp2350/m33 | ||
:goals: build | ||
:compact: | ||
|
||
You can flash the RP2350-Zero with an UF2 file. One option is to use West (Zephyr’s meta-tool). To enter the UF2 flashing mode just keep the ``BOOT`` button pressed while you connect the USB port, it will appear on the host as a mass storage device. Alternatively, with the board already connected via USB you can keep the ``BOOT`` button pressed, press and release ``RESET``, release ``BOOT``. At this point you can flash the image file by running: | ||
|
||
.. code-block:: bash | ||
|
||
west flash | ||
|
||
Alternatively, you can locate the generated file at ``build/zephyr/zephyr.uf2 file`` and simply drag-and-drop to the device after entering the UF2 flashing mode. | ||
|
||
References | ||
********** | ||
|
||
- `Official Documentation`_ | ||
- `WS2812 datasheet`_ | ||
|
||
.. _Official Documentation: https://www.waveshare.com/wiki/RP2350-Zero | ||
.. _WS2812 datasheet: https://cdn-shop.adafruit.com/datasheets/WS2812.pdf |
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,63 @@ | ||
/* | ||
* Copyright (c) 2025 Stephano Cetola | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
&pinctrl { | ||
uart0_default: uart0_default { | ||
group1 { | ||
pinmux = <UART0_TX_P0>; | ||
}; | ||
|
||
group2 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newline gaps missing e.g. line 11, fix in whole PR |
||
pinmux = <UART0_RX_P1>; | ||
input-enable; | ||
}; | ||
}; | ||
|
||
i2c0_default: i2c0_default { | ||
group1 { | ||
pinmux = <I2C0_SDA_P4>, <I2C0_SCL_P5>; | ||
input-enable; | ||
input-schmitt-enable; | ||
}; | ||
}; | ||
|
||
i2c1_default: i2c1_default { | ||
group1 { | ||
pinmux = <I2C1_SDA_P6>, <I2C1_SCL_P7>; | ||
input-enable; | ||
input-schmitt-enable; | ||
}; | ||
}; | ||
|
||
spi0_default: spi0_default { | ||
group1 { | ||
pinmux = <SPI0_CSN_P21>, <SPI0_SCK_P22>, <SPI0_TX_P23>; | ||
}; | ||
|
||
group2 { | ||
pinmux = <SPI0_RX_P20>; | ||
input-enable; | ||
}; | ||
}; | ||
|
||
pwm_ch4b_default: pwm_ch4b_default { | ||
group1 { | ||
pinmux = <PWM_4B_P25>; | ||
}; | ||
}; | ||
|
||
adc_default: adc_default { | ||
group1 { | ||
pinmux = <ADC_CH0_P26>, <ADC_CH1_P27>, <ADC_CH2_P28>, <ADC_CH3_P29>; | ||
input-enable; | ||
}; | ||
}; | ||
|
||
ws2812_pio0_default: ws2812_pio0_default { | ||
ws2812 { | ||
pinmux = <PIO0_P16>; | ||
}; | ||
}; | ||
}; |
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,157 @@ | ||
/* | ||
* Copyright (c) 2025 Stephano Cetola | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include <freq.h> | ||
|
||
#include <zephyr/dt-bindings/i2c/i2c.h> | ||
#include <zephyr/dt-bindings/pwm/pwm.h> | ||
#include <zephyr/dt-bindings/led/led.h> | ||
|
||
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2350a-pinctrl.h> | ||
#include "rp2350_zero-pinctrl.dtsi" | ||
|
||
/ { | ||
chosen { | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zephyr,console = &uart0; | ||
zephyr,shell-uart = &uart0; | ||
}; | ||
|
||
aliases { | ||
watchdog0 = &wdt0; | ||
led-strip = &ws2812; | ||
}; | ||
|
||
wszero_header: connector { | ||
compatible = "gpio-connector"; | ||
#gpio-cells = <2>; | ||
gpio-map-mask = <0xffffffff 0xffffffc0>; | ||
gpio-map-pass-thru = <0 0x3f>; | ||
gpio-map = <0 0 &gpio0 0 0>, /* GP0 */ | ||
<1 0 &gpio0 1 0>, /* GP1 */ | ||
<2 0 &gpio0 2 0>, /* GP2 */ | ||
<3 0 &gpio0 3 0>, /* GP3 */ | ||
<4 0 &gpio0 4 0>, /* GP4 */ | ||
<5 0 &gpio0 5 0>, /* GP5 */ | ||
<6 0 &gpio0 6 0>, /* GP6 */ | ||
<7 0 &gpio0 7 0>, /* GP7 */ | ||
<8 0 &gpio0 8 0>, /* GP8 */ | ||
<9 0 &gpio0 9 0>, /* GP9 */ | ||
<10 0 &gpio0 10 0>, /* GP10 */ | ||
<11 0 &gpio0 11 0>, /* GP11 */ | ||
<12 0 &gpio0 12 0>, /* GP12 */ | ||
<13 0 &gpio0 13 0>, /* GP13 */ | ||
<14 0 &gpio0 14 0>, /* GP14 */ | ||
<15 0 &gpio0 15 0>, /* GP15 */ | ||
<16 0 &gpio0 16 0>, /* GP16 */ | ||
<17 0 &gpio0 17 0>, /* GP17 */ | ||
<18 0 &gpio0 18 0>, /* GP18 */ | ||
<19 0 &gpio0 19 0>, /* GP19 */ | ||
<20 0 &gpio0 20 0>, /* GP20 */ | ||
<21 0 &gpio0 21 0>, /* GP21 */ | ||
<22 0 &gpio0 22 0>, /* GP22 */ | ||
<26 0 &gpio0 26 0>, /* GP26 */ | ||
<27 0 &gpio0 27 0>, /* GP27 */ | ||
<28 0 &gpio0 28 0>, /* GP28 */ | ||
<29 0 &gpio0 29 0>; /* GP29 */ | ||
}; | ||
}; | ||
|
||
&flash0 { | ||
reg = <0x10000000 DT_SIZE_M(4)>; | ||
}; | ||
|
||
&uart0 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart0_default>; | ||
pinctrl-names = "default"; | ||
}; | ||
|
||
&i2c0 { | ||
status = "okay"; | ||
pinctrl-0 = <&i2c0_default>; | ||
pinctrl-names = "default"; | ||
clock-frequency = <I2C_BITRATE_STANDARD>; | ||
}; | ||
|
||
&i2c1 { | ||
status = "okay"; | ||
pinctrl-0 = <&i2c1_default>; | ||
pinctrl-names = "default"; | ||
clock-frequency = <I2C_BITRATE_FAST>; | ||
}; | ||
|
||
&spi0 { | ||
clock-frequency = <DT_FREQ_M(8)>; | ||
status = "okay"; | ||
pinctrl-0 = <&spi0_default>; | ||
pinctrl-names = "default"; | ||
}; | ||
|
||
&wdt0 { | ||
status = "okay"; | ||
}; | ||
|
||
&gpio0 { | ||
status = "okay"; | ||
}; | ||
|
||
&adc { | ||
status = "okay"; | ||
pinctrl-0 = <&adc_default>; | ||
pinctrl-names = "default"; | ||
}; | ||
|
||
&pio0 { | ||
status = "okay"; | ||
|
||
pio-ws2812 { | ||
compatible = "worldsemi,ws2812-rpi_pico-pio"; | ||
status = "okay"; | ||
pinctrl-0 = <&ws2812_pio0_default>; | ||
pinctrl-names = "default"; | ||
bit-waveform = <3>, <3>, <4>; | ||
|
||
ws2812: ws2812 { | ||
status = "okay"; | ||
gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; | ||
chain-length = <1>; | ||
color-mapping = <LED_COLOR_ID_RED | ||
LED_COLOR_ID_GREEN | ||
LED_COLOR_ID_BLUE>; | ||
reset-delay = <280>; | ||
frequency = <800000>; | ||
}; | ||
}; | ||
}; | ||
|
||
&pio1 { | ||
status = "okay"; | ||
}; | ||
|
||
&pwm { | ||
pinctrl-0 = <&pwm_ch4b_default>; | ||
pinctrl-names = "default"; | ||
divider-int-0 = <255>; | ||
}; | ||
|
||
&timer0 { | ||
status = "okay"; | ||
}; | ||
|
||
&wdt0 { | ||
status = "okay"; | ||
}; | ||
|
||
zephyr_udc0: &usbd { | ||
status = "okay"; | ||
}; | ||
|
||
pico_spi: &spi0 {}; | ||
pico_i2c0: &i2c0 {}; | ||
pico_i2c1: &i2c1 {}; | ||
pico_serial: &uart0 {}; |
11 changes: 11 additions & 0 deletions
11
boards/waveshare/rp2350_zero/rp2350_zero_rp2350a_hazard3.dts
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,11 @@ | ||
/* | ||
* Copyright (c) 2025 Stephano Cetola | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
|
||
#include <raspberrypi/rpi_pico/rp2350a.dtsi> | ||
#include <riscv/raspberrypi/hazard3.dtsi> | ||
#include "rp2350_zero.dtsi" |
Oops, something went wrong.
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.
It's safe to assume probe-rs also works for this target, please consider adding it by copying from other files, like here: https://github.com/zephyrproject-rtos/zephyr/pull/94542/files
Uh oh!
There was an error while loading. Please reload this page.
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.
Sounds good, added this. I'll see if I can get a probe-rs debug probe and test this out as well.