Skip to content

Commit 5c39bb2

Browse files
committed
boards: Add initial support for the Raspberry Pi Pico 2
The Raspberry Pi Pico 2 is Raspberry Pi's first board fitted with their RP2350A SoC. This adds a minimal board definition, sufficient to build and run `samples/hello_world` and `samples/basic/blinky` on the board. Images can be run on the target using OpenOCD. Raspberry Pi's `picotool` can create a UF2 binary, which ensures that errata RP2350-E10 is avoided e.g. ``` > picotool uf2 convert build\rpi_pico2\hello_world\zephyr\zephyr.elf \ build\rpi_pico2\hello_world\zephyr\zephyr.uf2 \ --family rp2350-arm-s --abs-block` ``` Raspberry Pi Pico 2 is a low-cost, high-performance microcontroller board with flexible digital interfaces. Key features include: - RP2350A microcontroller chip designed by Raspberry Pi in the United Kingdom - Dual Cortex-M33 or Hazard3 processors at up to 150MHz - 520KB of SRAM, and 4MB of on-board flash memory - USB 1.1 with device and host support - Low-power sleep and dormant modes - Drag-and-drop programming using mass storage over USB - 26x multi-function GPIO pins including 3 that can be used for ADC - 2x SPI, 2x I2C, 2x UART, 3x 12-bit 500ksps Analogue to Digital Converter (ADC), 24x controllable PWM channels - 2x Timer with 4 alarms, 1x AON Timer - Temperature sensor - 3x Programmable IO (PIO) blocks, 12 state machines total for custom peripheral support - Flexible, user-programmable high-speed IO - Can emulate interfaces such as SD Card and VGA The Raspberry Pi Pico 2 comes as a castellated module which allows soldering direct to carrier boards. Only enable timer 0 for now. Timer 1 won't work correctly until the rpi_pico HAL has picked up the fix for `hardware_alarm_irq_handler`. See raspberrypi/pico-sdk#1949 . Added some documentation for the board itself (mostly aiming to refer to canonical sources of information rather duplicate). Add entries in the release notes where applicable. boards/raspberrypi/rpi_pico2/doc/img/rpi_pico2.webp is a cropped and compressed version of https://www.raspberrypi.com/documentation/microcontrollers/images/pico-2.png which is released under the CC-BY-SA-4.0 license. See https://github.com/raspberrypi/documentation/blob/develop/LICENSE.md Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com> Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
1 parent 05e0aad commit 5c39bb2

17 files changed

+412
-75
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2021 Yonatan Schachter
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Pico and Pico 2 boards (but not Pico W) have a common LED placement. */
8+
/ {
9+
leds {
10+
compatible = "gpio-leds";
11+
led0: led_0 {
12+
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
13+
label = "LED";
14+
};
15+
};
16+
17+
pwm_leds {
18+
compatible = "pwm-leds";
19+
status = "disabled";
20+
pwm_led0: pwm_led_0 {
21+
pwms = <&pwm 9 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
22+
label = "PWM_LED";
23+
};
24+
};
25+
26+
aliases {
27+
led0 = &led0;
28+
pwm-led0 = &pwm_led0;
29+
};
30+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (c) 2021, Yonatan Schachter
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/* The Pico and Pico 2 are pin compatible. */
7+
&pinctrl {
8+
uart0_default: uart0_default {
9+
group1 {
10+
pinmux = <UART0_TX_P0>;
11+
};
12+
group2 {
13+
pinmux = <UART0_RX_P1>;
14+
input-enable;
15+
};
16+
};
17+
18+
i2c0_default: i2c0_default {
19+
group1 {
20+
pinmux = <I2C0_SDA_P4>, <I2C0_SCL_P5>;
21+
input-enable;
22+
input-schmitt-enable;
23+
};
24+
};
25+
26+
i2c1_default: i2c1_default {
27+
group1 {
28+
pinmux = <I2C1_SDA_P6>, <I2C1_SCL_P7>;
29+
input-enable;
30+
input-schmitt-enable;
31+
};
32+
};
33+
34+
spi0_default: spi0_default {
35+
group1 {
36+
pinmux = <SPI0_CSN_P17>, <SPI0_SCK_P18>, <SPI0_TX_P19>;
37+
};
38+
group2 {
39+
pinmux = <SPI0_RX_P16>;
40+
input-enable;
41+
};
42+
};
43+
44+
pwm_ch4b_default: pwm_ch4b_default {
45+
group1 {
46+
pinmux = <PWM_4B_P25>;
47+
};
48+
};
49+
50+
adc_default: adc_default {
51+
group1 {
52+
pinmux = <ADC_CH0_P26>, <ADC_CH1_P27>, <ADC_CH2_P28>, <ADC_CH3_P29>;
53+
input-enable;
54+
};
55+
};
56+
};

boards/raspberrypi/rpi_pico/doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ hardware features:
9696
- :kconfig:option:`CONFIG_SPI`
9797
- :dtcompatible:`raspberrypi,pico-spi-pio`
9898

99+
.. _rpi_pico_pin_mapping:
100+
99101
Pin Mapping
100102
===========
101103

boards/raspberrypi/rpi_pico/rpi_pico-pinctrl.dtsi

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,4 @@
55

66
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>
77

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_P4>, <I2C0_SCL_P5>;
22-
input-enable;
23-
input-schmitt-enable;
24-
};
25-
};
26-
27-
i2c1_default: i2c1_default {
28-
group1 {
29-
pinmux = <I2C1_SDA_P6>, <I2C1_SCL_P7>;
30-
input-enable;
31-
input-schmitt-enable;
32-
};
33-
};
34-
35-
spi0_default: spi0_default {
36-
group1 {
37-
pinmux = <SPI0_CSN_P17>, <SPI0_SCK_P18>, <SPI0_TX_P19>;
38-
};
39-
group2 {
40-
pinmux = <SPI0_RX_P16>;
41-
input-enable;
42-
};
43-
};
44-
45-
pwm_ch4b_default: pwm_ch4b_default {
46-
group1 {
47-
pinmux = <PWM_4B_P25>;
48-
};
49-
};
50-
51-
adc_default: adc_default {
52-
group1 {
53-
pinmux = <ADC_CH0_P26>, <ADC_CH1_P27>, <ADC_CH2_P28>, <ADC_CH3_P29>;
54-
input-enable;
55-
};
56-
};
57-
};
8+
#include "../common/rpi_pico-pinctrl-common.dtsi"

boards/raspberrypi/rpi_pico/rpi_pico.dts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,4 @@
77
/dts-v1/;
88

99
#include "rpi_pico-common.dtsi"
10-
11-
/ {
12-
leds {
13-
compatible = "gpio-leds";
14-
led0: led_0 {
15-
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
16-
label = "LED";
17-
};
18-
};
19-
20-
pwm_leds {
21-
compatible = "pwm-leds";
22-
status = "disabled";
23-
pwm_led0: pwm_led_0 {
24-
pwms = <&pwm 9 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
25-
label = "PWM_LED";
26-
};
27-
};
28-
29-
aliases {
30-
led0 = &led0;
31-
pwm-led0 = &pwm_led0;
32-
};
33-
};
10+
#include "../common/rpi_pico-led.dtsi"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2024 Andrew Featherstone
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_RPI_PICO2
5+
6+
config USB_SELF_POWERED
7+
default n
8+
9+
endif # BOARD_RPI_PICO2
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2024 Andrew Featherstone
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_RPI_PICO2
5+
select SOC_RP2350A_M33 if BOARD_RPI_PICO2_RP2350A_M33
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: rpi_pico2
3+
full_name: Raspberry Pi Pico 2
4+
vendor: raspberrypi
5+
socs:
6+
- name: rp2350a
Binary file not shown.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
.. zephyr:board:: rpi_pico2
2+
3+
Overview
4+
********
5+
6+
The Raspberry Pi Pico 2 is the second-generation product in the Raspberry Pi
7+
Pico family. From the `Raspberry Pi website <https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html>`_ is referred to as Pico 2.
8+
9+
There are many limitations of the board currently. Including but not limited to:
10+
- The Zephyr build only supports configuring the RP2350A with the Cortex-M33 cores.
11+
- As with the Pico 1, there's no support for running any code on the second core.
12+
13+
Hardware
14+
********
15+
16+
- Dual Cortex-M33 or Hazard3 processors at up to 150MHz
17+
- 520KB of SRAM, and 4MB of on-board flash memory
18+
- USB 1.1 with device and host support
19+
- Low-power sleep and dormant modes
20+
- Drag-and-drop programming using mass storage over USB
21+
- 26 multi-function GPIO pins including 3 that can be used for ADC
22+
- 2 SPI, 2 I2C, 2 UART, 3 12-bit 500ksps Analogue to Digital - Converter (ADC), 24 controllable PWM channels
23+
- 2 Timer with 4 alarms, 1 AON Timer
24+
- Temperature sensor
25+
- 3 Programmable IO (PIO) blocks, 12 state machines total for custom peripheral support
26+
27+
- Flexible, user-programmable high-speed IO
28+
- Can emulate interfaces such as SD Card and VGA
29+
30+
Supported Features
31+
==================
32+
33+
The ``rpi_pico2/rp2350a/m33`` board target supports the following
34+
hardware features:
35+
36+
.. list-table::
37+
:header-rows: 1
38+
39+
* - Peripheral
40+
- Kconfig option
41+
- Devicetree compatible
42+
* - NVIC
43+
- N/A
44+
- :dtcompatible:`arm,v8m-nvic`
45+
* - ADC
46+
- :kconfig:option:`CONFIG_ADC`
47+
- :dtcompatible:`raspberrypi,pico-adc`
48+
* - Clock controller
49+
- :kconfig:option:`CONFIG_CLOCK_CONTROL`
50+
- :dtcompatible:`raspberrypi,pico-clock-controller`
51+
* - Counter
52+
- :kconfig:option:`CONFIG_COUNTER`
53+
- :dtcompatible:`raspberrypi,pico-timer`
54+
* - GPIO
55+
- :kconfig:option:`CONFIG_GPIO`
56+
- :dtcompatible:`raspberrypi,pico-gpio`
57+
* - HWINFO
58+
- :kconfig:option:`CONFIG_HWINFO`
59+
- N/A
60+
* - I2C
61+
- :kconfig:option:`CONFIG_I2C`
62+
- :dtcompatible:`snps,designware-i2c`
63+
* - PWM
64+
- :kconfig:option:`CONFIG_PWM`
65+
- :dtcompatible:`raspberrypi,pico-pwm`
66+
* - SPI
67+
- :kconfig:option:`CONFIG_SPI`
68+
- :dtcompatible:`raspberrypi,pico-spi`
69+
* - UART
70+
- :kconfig:option:`CONFIG_SERIAL`
71+
- :dtcompatible:`raspberrypi,pico-uart`
72+
73+
Connections and IOs
74+
===================
75+
76+
The default pin mapping is unchanged from the Pico 1 (see :ref:`rpi_pico_pin_mapping`).
77+
78+
Programming and Debugging
79+
*************************
80+
81+
As with the Pico 1, the SWD interface can be used to program and debug the
82+
device, e.g. using OpenOCD with the `Raspberry Pi Debug Probe <https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html>`_ .
83+
84+
References
85+
**********
86+
87+
.. target-notes::

0 commit comments

Comments
 (0)