Skip to content

Commit 5a9cc90

Browse files
committed
boards: adafruit: Add Metro rp2350 board
Add initial Adafruit Metro RP2350 board definition. Signed-off-by: Peter Johanson <[email protected]>
1 parent 3d9ac79 commit 5a9cc90

11 files changed

+402
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Pete Johanson
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_ADAFRUIT_METRO_RP2350
5+
select SOC_RP2350B_M33 if BOARD_ADAFRUIT_METRO_RP2350_RP2350B_M33
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2025 Pete Johanson
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_ADAFRUIT_METRO_RP2350
5+
6+
config USB_SELF_POWERED
7+
default n
8+
9+
endif # BOARD_ADAFRUIT_METRO_RP2350
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2025 Pete Johanson
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2350b-pinctrl.h>
7+
8+
&pinctrl {
9+
uart0_default: uart0_default {
10+
group1 {
11+
pinmux = <UART0_TX_P0>;
12+
};
13+
group2 {
14+
pinmux = <UART0_RX_P1>;
15+
input-enable;
16+
};
17+
};
18+
19+
i2c0_default: i2c0_default {
20+
group1 {
21+
pinmux = <I2C0_SDA_P20>;
22+
input-enable;
23+
};
24+
25+
group2 {
26+
pinmux = <I2C0_SCL_P21>;
27+
};
28+
};
29+
30+
adc_default: adc_default {
31+
group1 {
32+
pinmux = <ADC_CH1_P41>, <ADC_CH2_P42>, <ADC_CH3_P43>,
33+
<ADC_CH4_P44>, <ADC_CH5_P45>, <ADC_CH6_P46>;
34+
input-enable;
35+
};
36+
};
37+
38+
pwm_default: pwm_default {
39+
group1 {
40+
pinmux = <PWM_1B_P3>, <PWM_2B_P5>, <PWM_3A_P6>, <PWM_4B_P9>, <PWM_5A_P10>,
41+
<PWM_5B_P11>;
42+
};
43+
};
44+
45+
pio0_spi0_default: pio0_spi0_default {
46+
/* gpio 10 is used for chip select, not assigned to the PIO */
47+
group1 {
48+
pinmux = <PIO0_P11>, <PIO0_P12>;
49+
};
50+
};
51+
52+
pio1_ws2812_default: pio1_ws2812_default {
53+
group1 {
54+
pinmux = <PIO1_P25>;
55+
};
56+
};
57+
58+
};
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
/*
2+
* Copyright (c) 2025 Pete Johanson
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
/* The build system assumes that there's a cpucluster-specific file.
10+
*
11+
* This file provides composition of the device tree:
12+
* 1. The common features of the SoC
13+
* 2. Core-specific configuration.
14+
* 3. Board-specific configuration.
15+
*/
16+
#include <raspberrypi/rpi_pico/rp2350b.dtsi>
17+
#include <raspberrypi/rpi_pico/m33.dtsi>
18+
19+
#include <freq.h>
20+
21+
#include <zephyr/dt-bindings/i2c/i2c.h>
22+
#include <zephyr/dt-bindings/led/led.h>
23+
#include <zephyr/dt-bindings/pwm/pwm.h>
24+
25+
#include "adafruit_metro_rp2350-pinctrl.dtsi"
26+
27+
/ {
28+
chosen {
29+
zephyr,sram = &sram0;
30+
zephyr,flash = &flash0;
31+
zephyr,console = &uart0;
32+
zephyr,shell-uart = &uart0;
33+
zephyr,code-partition = &code_partition;
34+
};
35+
36+
aliases {
37+
watchdog0 = &wdt0;
38+
led-strip = &ws2812;
39+
led0 = &user_led;
40+
};
41+
42+
leds {
43+
compatible = "gpio-leds";
44+
45+
user_led: user_led {
46+
gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
47+
label = "USER_LED";
48+
};
49+
};
50+
51+
uno_header: connector {
52+
compatible = "arduino_header-r3";
53+
#gpio-cells = <2>;
54+
gpio-map-mask = <0xffffffff 0xffffffc0>;
55+
gpio-map-pass-thru = <0 0x3f>;
56+
gpio-map =
57+
#if 0
58+
<0 0 &gpio0 26 0>, /* A0 */
59+
<1 0 &gpio0 27 0>, /* A1 */
60+
<2 0 &gpio0 28 0>, /* A2 */
61+
<3 0 &gpio0 29 0>, /* A3 */
62+
<4 0 &gpio0 24 0>, /* A4 */
63+
<5 0 &gpio0 25 0>, /* A5 */
64+
#endif
65+
<6 0 &gpio0 1 0>, /* D0 */
66+
<7 0 &gpio0 0 0>, /* D1 */
67+
<8 0 &gpio0 2 0>, /* D2 */
68+
<9 0 &gpio0 3 0>, /* D3 */
69+
<10 0 &gpio0 4 0>, /* D4 */
70+
<11 0 &gpio0 5 0>, /* D5 */
71+
<12 0 &gpio0 6 0>, /* D6 */
72+
<13 0 &gpio0 7 0>, /* D7 */
73+
<14 0 &gpio0 8 0>, /* D8 */
74+
<15 0 &gpio0 9 0>, /* D9 */
75+
<16 0 &gpio0 10 0>, /* D10 */
76+
<17 0 &gpio0 11 0>, /* D11 */
77+
<18 0 &gpio0 22 0>, /* D12 */
78+
<19 0 &gpio0 23 0>, /* D13 */
79+
<20 0 &gpio0 16 0>, /* D14 */
80+
<21 0 &gpio0 17 0>; /* D15 */
81+
};
82+
83+
arduino_adc: analog-connector {
84+
compatible = "arduino,uno-adc";
85+
#io-channel-cells = <1>;
86+
io-channel-map = <0 &adc 0>, /* A0 = P0.3 = AIN1 */
87+
<1 &adc 1>, /* A1 = P0.4 = AIN2 */
88+
<2 &adc 2>, /* A2 = P0.28 = AIN4 */
89+
<3 &adc 3>; /* A3 = P0.29 = AIN5 */
90+
};
91+
};
92+
93+
&flash0 {
94+
reg = <0x10000000 DT_SIZE_M(16)>;
95+
96+
partitions {
97+
compatible = "fixed-partitions";
98+
#address-cells = <1>;
99+
#size-cells = <1>;
100+
101+
/* Reserved memory for an image definition block. The block is much
102+
* smaller than 256 bytes, but in practice the linker places the vector
103+
* table at a much larger alignment offset.
104+
*/
105+
image_def: partition@0 {
106+
label = "image_def";
107+
reg = <0x00000000 0x100>;
108+
read-only;
109+
};
110+
111+
/*
112+
* Usable flash. Starts at 0x100, after the image definition block.
113+
* The partition size is 4MB minus the 0x100 bytes taken by the
114+
* image definition.
115+
*/
116+
code_partition: partition@100 {
117+
label = "code-partition";
118+
reg = <0x100 (DT_SIZE_M(16) - 0x100)>;
119+
read-only;
120+
};
121+
};
122+
};
123+
124+
&uart0 {
125+
current-speed = <115200>;
126+
status = "okay";
127+
pinctrl-0 = <&uart0_default>;
128+
pinctrl-names = "default";
129+
};
130+
131+
&gpio0 {
132+
status = "okay";
133+
};
134+
135+
&i2c0 {
136+
clock-frequency = <I2C_BITRATE_STANDARD>;
137+
pinctrl-0 = <&i2c0_default>;
138+
pinctrl-names = "default";
139+
status = "okay";
140+
};
141+
142+
&adc {
143+
pinctrl-0 = <&adc_default>;
144+
pinctrl-names = "default";
145+
status = "okay";
146+
};
147+
148+
&pwm {
149+
pinctrl-0 = <&pwm_default>;
150+
pinctrl-names = "default";
151+
divider-int-0 = <255>;
152+
};
153+
154+
&timer0 {
155+
status = "okay";
156+
};
157+
158+
zephyr_udc0: &usbd {
159+
status = "okay";
160+
};
161+
162+
&pio0 {
163+
status = "okay";
164+
165+
uno_spi: pio0_spi0 {
166+
compatible = "raspberrypi,pico-spi-pio";
167+
clocks = < &clocks RPI_PICO_CLKID_CLK_SYS >;
168+
#address-cells = <1>;
169+
#size-cells = <0>;
170+
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
171+
clk-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
172+
mosi-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
173+
miso-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
174+
pinctrl-0 = <&pio0_spi0_default>;
175+
pinctrl-names = "default";
176+
};
177+
};
178+
179+
&pio1 {
180+
status = "okay";
181+
182+
pio-ws2812 {
183+
compatible = "worldsemi,ws2812-rpi_pico-pio";
184+
status = "okay";
185+
pinctrl-0 = <&pio1_ws2812_default>;
186+
pinctrl-names = "default";
187+
bit-waveform = <3>, <3>, <4>;
188+
189+
ws2812: ws2812 {
190+
status = "okay";
191+
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
192+
chain-length = <1>;
193+
color-mapping = <LED_COLOR_ID_GREEN
194+
LED_COLOR_ID_RED
195+
LED_COLOR_ID_BLUE>;
196+
reset-delay = <280>;
197+
frequency = <800000>;
198+
};
199+
};
200+
};
201+
202+
203+
uno_serial: &uart0 {};
204+
uno_i2c: &i2c0 {};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
identifier: adafruit_metro_rp2350/rp2350b/m33
2+
name: Adafruit Metro RP2350 (Cortex-M33)
3+
type: mcu
4+
arch: arm
5+
flash: 16384
6+
ram: 520
7+
toolchain:
8+
- zephyr
9+
- gnuarmemb
10+
supported:
11+
- adc
12+
- clock
13+
- counter
14+
- dma
15+
- gpio
16+
- hwinfo
17+
- i2c
18+
- pwm
19+
- spi
20+
- uart
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This configuration is orthogonal to whether the Cortex-M33 or Hazard3 cores
2+
# are in use, but Zephyr does not support providing a qualifier-agnostic
3+
# _defconfig file.
4+
CONFIG_BUILD_OUTPUT_HEX=y
5+
CONFIG_BUILD_OUTPUT_UF2=y
6+
CONFIG_CLOCK_CONTROL=y
7+
CONFIG_CONSOLE=y
8+
CONFIG_GPIO=y
9+
CONFIG_RESET=y
10+
CONFIG_SERIAL=y
11+
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=150000000
12+
CONFIG_UART_CONSOLE=y
13+
CONFIG_UART_INTERRUPT_DRIVEN=y
14+
CONFIG_USE_DT_CODE_PARTITION=y
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "")
4+
set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap")
5+
endif()
6+
7+
board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]")
8+
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]")
9+
10+
# The adapter speed is expected to be set by interface configuration.
11+
# The Raspberry Pi's OpenOCD fork doesn't, so match their documentation at
12+
# https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#debugging-with-swd
13+
board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 5000")
14+
15+
board_runner_args(uf2 "--board-id=RP2350")
16+
17+
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
18+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: adafruit_metro_rp2350
3+
full_name: Adafruit Metro RP2350
4+
vendor: adafruit
5+
socs:
6+
- name: rp2350b
59.8 KB
Loading
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.. zephyr:board:: adafruit_metro_rp2350
2+
3+
Overview
4+
********
5+
6+
Choo! Choo! This is the RP2350 Metro Line, making all station stops at "Dual Cortex M33 mountain",
7+
"528K RAM round-about" and "16 Megabytes of Flash town". This train is piled high with hardware that
8+
complements the Raspberry Pi RP2350 chip to make it an excellent development board for projects that
9+
want Arduino-shape-compatibility or just need the extra space and debugging ports.
10+
11+
The Adafruit Metro RP2350 is the second Metro board to use the Rasperry Pi Pico family.
12+
13+
There are many limitations of the board currently. Including but not limited to:
14+
- The Zephyr build only supports configuring the RP2350B with the Cortex-M33 cores.
15+
- As with other RP2040/RP2350 devices, there's no support for running any code on the second core.
16+
17+
Hardware
18+
********
19+
20+
- RP2350 main chip, 150MHz clock, 3.3V logic
21+
- 16 MB of QSPI flash for program storage
22+
- 37 Available GPIO: 23 on the socket/SPI headers, 12 on HSTX port, and another 2 for USB host. 6 of which are also analog inputs
23+
- Micro SD card socket wired up for SPI interfacing, also has extra pins connected for advanced-user SDIO interfacing (note that there's no code for SDIO in Arduino/Python, so this is a super-cutting-edge setup)
24+
- 5V Buck Converter featuring TPS563201 6~17V DC input and up to 2A output
25+
- Onboard RGB NeoPixel
26+
- Onboard #23 LED
27+
- Stemma QT port for I2C peripherals and sensors
28+
- 22-pin 3-lane differential HSTX FPC port with 'Pi 5' compatible pinout, makes for quick DVI video output. Or, this also provides 12 extra GPIO that can be used for more pins.
29+
- Reset and Boot buttons on PCB edge
30+
- Pico Probe debug port - 3 pin JST SH compatible
31+
- USB Type C power and data
32+
- 5.5mm / 2.1mm DC jack for 6-17VDC power
33+
- On/off switch for DC jack
34+
- RX / TX switch for swapping D0 and D1 locations
35+
- USB Host breakout pads - with controllable 5V power and D+/D- for bitbang USB Host.
36+
- GPIO pin numbers match classic Arduino pins, other than GPIO 12 and 13 as those are needed for HSTX connectivity
37+
38+
Supported Features
39+
==================
40+
41+
.. zephyr:board-supported-hw::
42+
43+
Connections and IOs
44+
===================
45+
46+
The default pin mapping is unchanged from the Pico 1 (see :ref:`rpi_pico_pin_mapping`).
47+
48+
Programming and Debugging
49+
*************************
50+
51+
As with other RP3250 devices, the SWD interface can be used to program and debug the
52+
device, e.g. using OpenOCD with the `Raspberry Pi Debug Probe <https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html>`_ .
53+
54+
References
55+
**********
56+
57+
.. target-notes::

0 commit comments

Comments
 (0)