boards: pimoroni: pico_plus2: Add Pimoroni Pico Plus2 board

Pinoroni Pico Plus2 is an RP2350B based board that has
more rich I/O, RAM, and Flash than the original Raspberry Pi Pico2.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
TOKITA Hiroshi 2024-08-22 20:27:29 +09:00 committed by Benjamin Cabé
commit 70fc4a3e57
28 changed files with 542 additions and 5 deletions

10
boards/pimoroni/index.rst Normal file
View file

@ -0,0 +1,10 @@
.. _boards-pimoroni:
Pimoroni Ltd.
#############
.. toctree::
:maxdepth: 1
:glob:
**/*

View file

@ -0,0 +1,9 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0
if BOARD_PICO_PLUS2
config USB_SELF_POWERED
default n
endif # BOARD_PICO_PLUS2

View file

@ -0,0 +1,5 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0
config BOARD_PICO_PLUS2
select SOC_RP2350B_M33 if BOARD_PICO_PLUS2_RP2350B_M33

View file

@ -0,0 +1,14 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(openocd --cmd-pre-init "source [find interface/cmsis-dap.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)

View file

@ -0,0 +1,6 @@
board:
name: pico_plus2
full_name: Pimoroni Pico Plus2
vendor: pimoroni
socs:
- name: rp2350b

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -0,0 +1,59 @@
.. zephyr:board:: pico_plus2
Overview
********
The `Pimoroni Pico Plus 2`_ is a compact and versatile board featuring the Raspberry Pi RP2350B SoC.
It includes USB Type-C, Qwiic/STEMMA QT connectors, SP/CE connectors, a debug connector,
a reset button, and a BOOT button.
Hardware
********
- Dual Cortex-M33 or Hazard3 processors at up to 150MHz
- 520KB of SRAM, and 4MB of on-board flash memory
- 16MB of on-board QSPI flash (supports XiP)
- 8MB of PSRAM
- USB 1.1 with device and host support
- Low-power sleep and dormant modes
- Drag-and-drop programming using mass storage over USB
- 48 multi-function GPIO pins including 8 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
- 2 Timer with 4 alarms, 1 AON Timer
- Temperature sensor
- 3 Programmable IO (PIO) blocks, 12 state machines total for custom peripheral support
- USB-C connector for power, programming, and data transfer
- Qwiic/STEMMA QT(Qw/ST) connector
- SP/CE connector
- 3-pin debug connector, this can use with `Raspberry Pi Debug Probe`_.
- Reset button and BOOT button (BOOT button also usable as a user switch)
Supported Features
==================
.. zephyr:board-supported-hw::
You can use peripherals that are made by using the PIO.
See :ref:`rpi_pico_pio_based_features`
Programming and Debugging
*************************
The overall explanation regarding flashing and debugging is the same as or ``rpi_pico``.
See :ref:`rpi_pico_flashing_using_openocd` and :ref:`rpi_pico_flashing_using_uf2`
in ``rpi_pico`` documentation.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: pico_plus2
:goals: build flash
:gen-args: -DOPENOCD=/usr/local/bin/openocd
.. target-notes::
.. _Pimoroni Pico Plus 2:
https://shop.pimoroni.com/products/pimoroni-pico-plus-2
.. _Raspberry Pi Debug Probe:
https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html

View file

@ -0,0 +1,51 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2350b-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;
};
};
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_P40>, <ADC_CH1_P41>, <ADC_CH2_P42>, <ADC_CH3_P43>;
input-enable;
};
};
};

View file

@ -0,0 +1,178 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
*
* 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/input/input-event-codes.h>
#include "pico_plus2-pinctrl.dtsi"
/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,code-partition = &code_partition;
};
aliases {
watchdog0 = &wdt0;
led0 = &led0;
pwm-led0 = &pwm_led0;
sw0 = &user_sw;
};
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";
};
};
buttons {
compatible = "gpio-keys";
user_sw: user_sw {
gpios = <&gpio0_hi 13 (GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_0>;
};
};
pico_header: connector {
compatible = "raspberrypi,pico-header";
#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 */
};
};
&flash0 {
reg = <0x10000000 DT_SIZE_M(16)>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserved memory for an image definition block. The block is much
* smaller than 256 bytes, but in practice the linker places the vector
* table at a much larger alignment offset.
*/
image_def: partition@0 {
label = "image_def";
reg = <0x00000000 0x100>;
read-only;
};
/*
* Usable flash. Starts at 0x100, after the image definition block.
* The partition size is 16MB minus the 0x100 bytes taken by the
* image definition.
*/
code_partition: partition@100 {
label = "code-partition";
reg = <0x100 (DT_SIZE_M(16) - 0x100)>;
read-only;
};
};
};
&uart0 {
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
gpio0_lo: &gpio0 {
status = "okay";
};
&gpio0_hi {
status = "okay";
};
&spi0 {
clock-frequency = <DT_FREQ_M(8)>;
pinctrl-0 = <&spi0_default>;
pinctrl-names = "default";
status = "okay";
};
&i2c0 {
clock-frequency = <I2C_BITRATE_STANDARD>;
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
status = "okay";
};
&adc {
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
status = "okay";
};
&pwm {
pinctrl-0 = <&pwm_ch4b_default>;
pinctrl-names = "default";
divider-int-0 = <255>;
};
&timer0 {
status = "okay";
};
zephyr_udc0: &usbd {
status = "okay";
};
pico_spi: &spi0 {};
pico_i2c0: &i2c0 {};
pico_i2c1: &i2c1 {};
pico_serial: &uart0 {};
stemma_qt_i2c: &i2c0 {};

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
/* The build system assumes that there's a cpucluster-specific file.
*
* This file provides composition of the device tree:
* 1. The common features of the SoC
* 2. Core-specific configuration.
* 3. Board-specific configuration.
*/
#include <raspberrypi/rpi_pico/rp2350b.dtsi>
#include <raspberrypi/rpi_pico/m33.dtsi>
/* there's nothing specific to the Cortex-M33 cores vs the (not yet
* implemented) Hazard3 cores.
*/
#include "pico_plus2.dtsi"

View file

@ -0,0 +1,20 @@
identifier: pico_plus2/rp2350b/m33
name: Pimoroni Pico Plus 2 (Cortex-M33)
type: mcu
arch: arm
flash: 16384
ram: 8192
toolchain:
- zephyr
- gnuarmemb
supported:
- adc
- clock
- counter
- dma
- gpio
- hwinfo
- i2c
- pwm
- spi
- uart

View file

@ -0,0 +1,14 @@
# This configuration is orthogonal to whether the Cortex-M33 or Hazard3 cores
# are in use, but Zephyr does not support providing a qualifier-agnostic
# _defconfig file.
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_CLOCK_CONTROL=y
CONFIG_CONSOLE=y
CONFIG_GPIO=y
CONFIG_RESET=y
CONFIG_SERIAL=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=150000000
CONFIG_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_USE_DT_CODE_PARTITION=y

View file

@ -0,0 +1,11 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0
# Checking and set 'adapter speed'.
# Set the adaptor speed, if unset, and given as an argument.
proc set_adapter_speed_if_not_set { speed } {
puts "checking adapter speed..."
if { [catch {adapter speed} ret] } {
adapter speed $speed
}
}

View file

@ -513,6 +513,7 @@ phicomm PHICOMM Co., Ltd.
phosense Beijing Phosense Electronic Technology Co., Ltd. phosense Beijing Phosense Electronic Technology Co., Ltd.
phytec PHYTEC phytec PHYTEC
picochip Picochip Ltd picochip Picochip Ltd
pimoroni Pimoroni Ltd.
pine64 Pine64 pine64 Pine64
pineriver Shenzhen PineRiver Designs Co., Ltd. pineriver Shenzhen PineRiver Designs Co., Ltd.
pixart PixArt Imaging Inc. pixart PixArt Imaging Inc.

View file

@ -0,0 +1,24 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
*/
/ {
zephyr,user {
io-channels = <&adc 0>;
};
};
&adc {
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};

View file

@ -54,7 +54,11 @@ struct counter_alarm_cfg alarm_cfg;
#elif defined(CONFIG_COUNTER_SNPS_DW) #elif defined(CONFIG_COUNTER_SNPS_DW)
#define TIMER DT_NODELABEL(timer0) #define TIMER DT_NODELABEL(timer0)
#elif defined(CONFIG_COUNTER_TIMER_RPI_PICO) #elif defined(CONFIG_COUNTER_TIMER_RPI_PICO)
#ifdef CONFIG_SOC_SERIES_RP2040
#define TIMER DT_NODELABEL(timer) #define TIMER DT_NODELABEL(timer)
#elif CONFIG_SOC_SERIES_RP2350
#define TIMER DT_NODELABEL(timer0)
#endif
#elif defined(CONFIG_COUNTER_TIMER_MAX32) #elif defined(CONFIG_COUNTER_TIMER_MAX32)
#define TIMER DT_NODELABEL(counter0) #define TIMER DT_NODELABEL(counter0)
#elif defined(CONFIG_COUNTER_RA_AGT) #elif defined(CONFIG_COUNTER_RA_AGT)

View file

@ -0,0 +1,15 @@
/ {
leds {
status = "disabled";
};
pwm_leds {
status = "okay";
};
};
&pwm {
status = "okay";
divider-frac-4 = <15>;
divider-int-4 = <255>;
};

View file

@ -0,0 +1 @@
CONFIG_ADC=y

View file

@ -0,0 +1,9 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 TOKITA Hiroshi
*/
&die_temp {
status = "okay";
};

View file

@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 TOKITA Hiroshi
*/
/ {
zephyr,user {
io-channels = <&adc 0>, <&adc 1>;
};
};
&adc {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2023 Tokita, Hiroshi <tokita.hiroshi@fujitsu.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
tst_dma0: &dma {
status = "okay";
};

View file

@ -0,0 +1,8 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 TOKITA Hiroshi
*/
/* Pico Plus2 is pin-compatible with the RPi-Pico2, so reuse. */
#include "rpi_pico2_rp2350a_m33.overlay"

View file

@ -0,0 +1 @@
CONFIG_SKIP_PULL_TEST=y

View file

@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Pico Plus2 is pin-compatible with the RPi-Pico, so reuse. */
#include "rpi_pico.overlay"

View file

@ -0,0 +1 @@
CONFIG_SPI_PL022_DMA=y

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2022 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/dma/rpi-pico-dma-rp2040.h>

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/dma/rpi-pico-dma-rp2350.h>

View file

@ -173,35 +173,45 @@ tests:
extra_configs: extra_configs:
- CONFIG_SPI_PL022_INTERRUPT=y - CONFIG_SPI_PL022_INTERRUPT=y
- CONFIG_SPI_PL022_DMA=n - CONFIG_SPI_PL022_DMA=n
platform_allow: rpi_pico platform_allow:
- rpi_pico
- pico_plus2/rp2350b/m33
drivers.spi.pl022_spi_dma.loopback: drivers.spi.pl022_spi_dma.loopback:
extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022_dma.overlay" extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022_dma.overlay"
extra_configs: extra_configs:
- CONFIG_SPI_PL022_INTERRUPT=n - CONFIG_SPI_PL022_INTERRUPT=n
- CONFIG_SPI_PL022_DMA=y - CONFIG_SPI_PL022_DMA=y
- CONFIG_DMA=y - CONFIG_DMA=y
platform_allow: rpi_pico platform_allow:
- rpi_pico
- pico_plus2/rp2350b/m33
drivers.spi.pl022_spi_dma_and_interrupt.loopback: drivers.spi.pl022_spi_dma_and_interrupt.loopback:
extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022_dma.overlay" extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022_dma.overlay"
extra_configs: extra_configs:
- CONFIG_SPI_PL022_INTERRUPT=y - CONFIG_SPI_PL022_INTERRUPT=y
- CONFIG_SPI_PL022_DMA=y - CONFIG_SPI_PL022_DMA=y
- CONFIG_DMA=y - CONFIG_DMA=y
platform_allow: rpi_pico platform_allow:
- rpi_pico
- pico_plus2/rp2350b/m33
drivers.spi.pl022_spi_dma_no_dma_props.loopback: drivers.spi.pl022_spi_dma_no_dma_props.loopback:
extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022.overlay" extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022.overlay"
extra_configs: extra_configs:
- CONFIG_SPI_PL022_INTERRUPT=n - CONFIG_SPI_PL022_INTERRUPT=n
- CONFIG_SPI_PL022_DMA=y - CONFIG_SPI_PL022_DMA=y
- CONFIG_DMA=y - CONFIG_DMA=y
platform_allow: rpi_pico platform_allow:
- rpi_pico
- pico_plus2/rp2350b/m33
drivers.spi.pl022_spi_dma_and_interrupt_no_dma_props.loopback: drivers.spi.pl022_spi_dma_and_interrupt_no_dma_props.loopback:
extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022.overlay" extra_args: DTC_OVERLAY_FILE="boards/rpi_pico_pl022.overlay"
extra_configs: extra_configs:
- CONFIG_SPI_PL022_INTERRUPT=y - CONFIG_SPI_PL022_INTERRUPT=y
- CONFIG_SPI_PL022_DMA=y - CONFIG_SPI_PL022_DMA=y
- CONFIG_DMA=y - CONFIG_DMA=y
platform_allow: rpi_pico platform_allow:
- rpi_pico
- pico_plus2/rp2350b/m33
drivers.spi.pio_spi.loopback: drivers.spi.pio_spi.loopback:
extra_args: extra_args:
- DTC_OVERLAY_FILE="boards/rpi_pico_pio.overlay" - DTC_OVERLAY_FILE="boards/rpi_pico_pio.overlay"