Skip to content
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

Add initial support for the Raspberry Pi Pico 2 #77368

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f92cc94
drivers: clock_control: rpi_pico: Add support for the RP2350.
ajf58 Aug 21, 2024
6c2e435
soc: rp2350: Add initial support for the Raspberry Pi RP2350
ajf58 Aug 21, 2024
ee8d1f7
drivers: hwinfo: rp2350: Add initial support for RP2350
ajf58 Aug 23, 2024
c353720
drivers: clock_control: rpi_pico: Start tick generators for timers
ajf58 Sep 1, 2024
35c4cfc
drivers: watchdog: rpi_pico: Add support for RP2350
soburi Sep 2, 2024
24e57fa
drivers: counter: rpi_pico_timer: Add support for RP2350
ajf58 Sep 25, 2024
073139a
pinctrl: raspberrypi: rp2350: Add support for RP2350X
ajf58 Sep 9, 2024
ba1b5e7
rp2350: Fix for storing larger pinctrl alt func
petejohanson Nov 4, 2024
fb5048f
boards: Add initial support for the Raspberry Pi Pico 2
ajf58 Aug 21, 2024
2cc9d23
UF2: Enable support for Raspberry Pi RP2350
oscardagrach Sep 20, 2024
443e397
samples: rpi_pico2: Add ADC-related samples for rpi_pico2
ajf58 Aug 31, 2024
830b4f4
tests: drivers: adc_api: Add support for the Raspberry Pi Pico 2
ajf58 Sep 3, 2024
0530c53
doc: rpi_pico2: Document Raspberry Pi Pico 2 and related changes
ajf58 Aug 31, 2024
9a41e3e
boards: raspberrypi: rpi_pico2: Add OpenOCD runner configuration
ajf58 Sep 27, 2024
03d4037
tests: gpio_api_1pin: rpi_pico2: Support using external pulldowns
ajf58 Oct 4, 2024
b32a31e
rpi_pico2: rp2350: Add PIO support and extend samples
Oct 15, 2024
c63ca09
rpi_pico2: rp2350: Add DMA support
ajf58 Oct 16, 2024
e31b959
drivers: dma: rpi_pico: Refactor DMA files for Raspberry Pi SoCs
ajf58 Oct 17, 2024
d3e0359
tests: drivers: dma: Increase test coverage for RP2350A
ajf58 Oct 19, 2024
c15aba4
samples: drivers: led: pwm: Add rpi_pico2 board
ajf58 Oct 19, 2024
8c6d543
rp2350: Define and implement a cpucluster of Cortex-M33s
ajf58 Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Kconfig.zephyr
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,8 @@ config BUILD_OUTPUT_UF2_FAMILY_ID
default "0xada52840" if SOC_NRF52840_QIAA
default "0x4fb2d5bd" if SOC_SERIES_IMXRT10XX || SOC_SERIES_IMXRT11XX
default "0x2abc77ec" if SOC_SERIES_LPC55XXX
default "0xe48bff56" if SOC_SERIES_RP2XXX
default "0xe48bff56" if SOC_SERIES_RP2040
soburi marked this conversation as resolved.
Show resolved Hide resolved
default "0xe48bff57" if SOC_SERIES_RP2350
default "0x68ed2b88" if SOC_SERIES_SAMD21
default "0x55114460" if SOC_SERIES_SAMD51
default "0x647824b6" if SOC_SERIES_STM32F0X
Expand Down
30 changes: 30 additions & 0 deletions boards/raspberrypi/common/rpi_pico-led.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2021 Yonatan Schachter
*
* SPDX-License-Identifier: Apache-2.0
*/

/* Pico and Pico 2 boards (but not Pico W) have a common LED placement. */
/ {
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
label = "LED";
};
};

pwm_leds {
compatible = "pwm-leds";
status = "disabled";
pwm_led0: pwm_led_0 {
pwms = <&pwm 9 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
label = "PWM_LED";
};
};

aliases {
led0 = &led0;
pwm-led0 = &pwm_led0;
};
};
56 changes: 56 additions & 0 deletions boards/raspberrypi/common/rpi_pico-pinctrl-common.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2021, Yonatan Schachter
* SPDX-License-Identifier: Apache-2.0
*/

/* The Pico and Pico 2 are pin compatible. */
&pinctrl {
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_P0>;
};
group2 {
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_P17>, <SPI0_SCK_P18>, <SPI0_TX_P19>;
};
group2 {
pinmux = <SPI0_RX_P16>;
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;
};
};
};
2 changes: 2 additions & 0 deletions boards/raspberrypi/rpi_pico/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ hardware features:
- :kconfig:option:`CONFIG_SPI`
- :dtcompatible:`raspberrypi,pico-spi-pio`

.. _rpi_pico_pin_mapping:

Pin Mapping
===========

Expand Down
51 changes: 1 addition & 50 deletions boards/raspberrypi/rpi_pico/rpi_pico-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,4 @@

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

&pinctrl {
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_P0>;
};
group2 {
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_P17>, <SPI0_SCK_P18>, <SPI0_TX_P19>;
};
group2 {
pinmux = <SPI0_RX_P16>;
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;
};
};
};
#include "../common/rpi_pico-pinctrl-common.dtsi"
25 changes: 1 addition & 24 deletions boards/raspberrypi/rpi_pico/rpi_pico.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,4 @@
/dts-v1/;

#include "rpi_pico-common.dtsi"

/ {
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
label = "LED";
};
};

pwm_leds {
compatible = "pwm-leds";
status = "disabled";
pwm_led0: pwm_led_0 {
pwms = <&pwm 9 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
label = "PWM_LED";
};
};

aliases {
led0 = &led0;
pwm-led0 = &pwm_led0;
};
};
#include "../common/rpi_pico-led.dtsi"
2 changes: 1 addition & 1 deletion boards/raspberrypi/rpi_pico/rpi_pico_rp2040_w.dts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/* Assign GPIO24 to SIO (GPIO) for use as an interrupt source */
group1 {
/* Lacking a specific SIO pin definition, use the RP2040_PINMUX macro */
pinmux = <RP2040_PINMUX(24, RP2_PINCTRL_GPIO_FUNC_SIO)>;
pinmux = <RP2XXX_PINMUX(24, RP2_PINCTRL_GPIO_FUNC_SIO)>;
input-enable;
};
};
Expand Down
9 changes: 9 additions & 0 deletions boards/raspberrypi/rpi_pico2/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024 Andrew Featherstone
# SPDX-License-Identifier: Apache-2.0

if BOARD_RPI_PICO2

config USB_SELF_POWERED
default n

endif # BOARD_RPI_PICO2
5 changes: 5 additions & 0 deletions boards/raspberrypi/rpi_pico2/Kconfig.rpi_pico2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Andrew Featherstone
# SPDX-License-Identifier: Apache-2.0

config BOARD_RPI_PICO2
select SOC_RP2350A_M33 if BOARD_RPI_PICO2_RP2350A_M33
18 changes: 18 additions & 0 deletions boards/raspberrypi/rpi_pico2/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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]")
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]")

# 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(uf2 "--board-id=RP2350")

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
6 changes: 6 additions & 0 deletions boards/raspberrypi/rpi_pico2/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: rpi_pico2
ajf58 marked this conversation as resolved.
Show resolved Hide resolved
full_name: Raspberry Pi Pico 2
vendor: raspberrypi
socs:
- name: rp2350a
Binary file not shown.
93 changes: 93 additions & 0 deletions boards/raspberrypi/rpi_pico2/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.. zephyr:board:: rpi_pico2

Overview
********

The Raspberry Pi Pico 2 is the second-generation product in the Raspberry Pi
Pico family. From the `Raspberry Pi website <https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html>`_ is referred to as Pico 2.

There are many limitations of the board currently. Including but not limited to:
- The Zephyr build only supports configuring the RP2350A with the Cortex-M33 cores.
- As with the Pico 1, there's no support for running any code on the second core.

Hardware
********

- 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
- 26 multi-function GPIO pins including 3 that can be used for ADC
- 2 SPI, 2 I2C, 2 UART, 3 12-bit 500ksps Analogue to Digital - Converter (ADC), 24 controllable PWM channels
yonsch marked this conversation as resolved.
Show resolved Hide resolved
- 2 Timer with 4 alarms, 1 AON Timer
- Temperature sensor
- 3 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

Supported Features
==================

The ``rpi_pico2/rp2350a/m33`` board target supports the following
hardware features:

.. list-table::
:header-rows: 1

* - Peripheral
- Kconfig option
- Devicetree compatible
* - NVIC
- N/A
- :dtcompatible:`arm,v8m-nvic`
* - ADC
- :kconfig:option:`CONFIG_ADC`
- :dtcompatible:`raspberrypi,pico-adc`
* - Clock controller
- :kconfig:option:`CONFIG_CLOCK_CONTROL`
- :dtcompatible:`raspberrypi,pico-clock-controller`
* - Counter
- :kconfig:option:`CONFIG_COUNTER`
- :dtcompatible:`raspberrypi,pico-timer`
* - DMA
- :kconfig:option:`CONFIG_DMA`
- :dtcompatible:`raspberrypi,pico-dma`
* - GPIO
- :kconfig:option:`CONFIG_GPIO`
- :dtcompatible:`raspberrypi,pico-gpio`
* - HWINFO
- :kconfig:option:`CONFIG_HWINFO`
- N/A
* - I2C
- :kconfig:option:`CONFIG_I2C`
- :dtcompatible:`snps,designware-i2c`
* - PWM
- :kconfig:option:`CONFIG_PWM`
- :dtcompatible:`raspberrypi,pico-pwm`
* - SPI
- :kconfig:option:`CONFIG_SPI`
- :dtcompatible:`raspberrypi,pico-spi`
* - UART
- :kconfig:option:`CONFIG_SERIAL`
- :dtcompatible:`raspberrypi,pico-uart`
* - UART (PIO)
- :kconfig:option:`CONFIG_SERIAL`
- :dtcompatible:`raspberrypi,pico-uart-pio`

Connections and IOs
===================

The default pin mapping is unchanged from the Pico 1 (see :ref:`rpi_pico_pin_mapping`).

Programming and Debugging
*************************

As with the Pico 1, the SWD interface can be used to program and debug the
device, e.g. using OpenOCD with the `Raspberry Pi Debug Probe <https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html>`_ .

References
**********

.. target-notes::
8 changes: 8 additions & 0 deletions boards/raspberrypi/rpi_pico2/rpi_pico2-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024, Andrew Featherstone
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2350a-pinctrl.h>

#include "../common/rpi_pico-pinctrl-common.dtsi"
Loading
Loading