From 808ef8a45868b3233840fdd70d7a2e0623439866 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 22 Aug 2024 20:27:29 +0900 Subject: [PATCH] pimoroni pico_plus2 --- boards/pimoroni/pico_plus2/Kconfig.defconfig | 9 + boards/pimoroni/pico_plus2/Kconfig.pico_plus2 | 5 + boards/pimoroni/pico_plus2/board.cmake | 36 +++ boards/pimoroni/pico_plus2/board.yml | 5 + boards/pimoroni/pico_plus2/doc/index.rst | 303 ++++++++++++++++++ .../pico_plus2/pico_plus2-common.dtsi | 137 ++++++++ .../pico_plus2/pico_plus2-pinctrl.dtsi | 52 +++ boards/pimoroni/pico_plus2/pico_plus2.dts | 43 +++ boards/pimoroni/pico_plus2/pico_plus2.yaml | 14 + .../pimoroni/pico_plus2/pico_plus2_defconfig | 11 + .../pimoroni/pico_plus2/support/openocd.cfg | 11 + .../adc/adc_dt/boards/pico_plus2.overlay | 24 ++ samples/drivers/counter/alarm/src/main.c | 4 + .../drivers/led_pwm/boards/pico_plus2.overlay | 15 + .../die_temp_polling/boards/pico_plus2.conf | 1 + .../boards/pico_plus2.overlay | 9 + 16 files changed, 679 insertions(+) create mode 100644 boards/pimoroni/pico_plus2/Kconfig.defconfig create mode 100644 boards/pimoroni/pico_plus2/Kconfig.pico_plus2 create mode 100644 boards/pimoroni/pico_plus2/board.cmake create mode 100644 boards/pimoroni/pico_plus2/board.yml create mode 100644 boards/pimoroni/pico_plus2/doc/index.rst create mode 100644 boards/pimoroni/pico_plus2/pico_plus2-common.dtsi create mode 100644 boards/pimoroni/pico_plus2/pico_plus2-pinctrl.dtsi create mode 100644 boards/pimoroni/pico_plus2/pico_plus2.dts create mode 100644 boards/pimoroni/pico_plus2/pico_plus2.yaml create mode 100644 boards/pimoroni/pico_plus2/pico_plus2_defconfig create mode 100644 boards/pimoroni/pico_plus2/support/openocd.cfg create mode 100644 samples/drivers/adc/adc_dt/boards/pico_plus2.overlay create mode 100644 samples/drivers/led_pwm/boards/pico_plus2.overlay create mode 100644 samples/sensor/die_temp_polling/boards/pico_plus2.conf create mode 100644 samples/sensor/die_temp_polling/boards/pico_plus2.overlay diff --git a/boards/pimoroni/pico_plus2/Kconfig.defconfig b/boards/pimoroni/pico_plus2/Kconfig.defconfig new file mode 100644 index 000000000000000..35cdf92705462f1 --- /dev/null +++ b/boards/pimoroni/pico_plus2/Kconfig.defconfig @@ -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 diff --git a/boards/pimoroni/pico_plus2/Kconfig.pico_plus2 b/boards/pimoroni/pico_plus2/Kconfig.pico_plus2 new file mode 100644 index 000000000000000..57bcb7804ce72d6 --- /dev/null +++ b/boards/pimoroni/pico_plus2/Kconfig.pico_plus2 @@ -0,0 +1,5 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_PICO_PLUS2 + select SOC_RP2350B diff --git a/boards/pimoroni/pico_plus2/board.cmake b/boards/pimoroni/pico_plus2/board.cmake new file mode 100644 index 000000000000000..552caca1c441068 --- /dev/null +++ b/boards/pimoroni/pico_plus2/board.cmake @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: Apache-2.0 + +# This configuration allows selecting what debug adapter debugging rpi_pico +# by a command-line argument. +# It is mainly intended to support both the 'picoprobe' and 'raspberrypi-swd' +# adapter described in "Getting started with Raspberry Pi Pico". +# And any other SWD debug adapter might also be usable with this configuration. + +# Set RPI_PICO_DEBUG_ADAPTER to select debug adapter by command-line arguments. +# e.g.) west build -b rpi_pico -- -DRPI_PICO_DEBUG_ADAPTER=raspberrypi-swd +# The value is treated as a part of an interface file name that +# the debugger's configuration file. +# The value must be the 'stem' part of the name of one of the files +# in the openocd interface configuration file. +# The setting is store to CMakeCache.txt. +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 "transport select swd") +board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]") + +# The adapter speed is expected to be set by interface configuration. +# But if not so, set 2000 to adapter speed. +board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 2000") + +board_runner_args(jlink "--device=RP2350_M0_0") +board_runner_args(uf2 "--board-id=RP2350") +board_runner_args(pyocd "--target=rp2350") + +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) +include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) +include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) diff --git a/boards/pimoroni/pico_plus2/board.yml b/boards/pimoroni/pico_plus2/board.yml new file mode 100644 index 000000000000000..e31153ca51a14ce --- /dev/null +++ b/boards/pimoroni/pico_plus2/board.yml @@ -0,0 +1,5 @@ +board: + name: pico_plus2 + vendor: pimoroni + socs: + - name: rp2350b diff --git a/boards/pimoroni/pico_plus2/doc/index.rst b/boards/pimoroni/pico_plus2/doc/index.rst new file mode 100644 index 000000000000000..a2c3468e34f040c --- /dev/null +++ b/boards/pimoroni/pico_plus2/doc/index.rst @@ -0,0 +1,303 @@ +.. _rpi_pico: + +Raspberry Pi Pico +################# + +Overview +******** + +The Raspberry Pi Pico and Pico W are small, low-cost, versatile boards from +Raspberry Pi. They are equipped with an RP2040 SoC, an on-board LED, +a USB connector, and an SWD interface. The Pico W additionally contains an +Infineon CYW43439 2.4 GHz Wi-Fi/Bluetooth module. The USB bootloader allows the +ability to flash without any adapter, in a drag-and-drop manner. +It is also possible to flash and debug the boards with their SWD interface, +using an external adapter. + +Hardware +******** +- Dual core Arm Cortex-M0+ processor running up to 133MHz +- 264KB on-chip SRAM +- 2MB on-board QSPI flash with XIP capabilities +- 26 GPIO pins +- 3 Analog inputs +- 2 UART peripherals +- 2 SPI controllers +- 2 I2C controllers +- 16 PWM channels +- USB 1.1 controller (host/device) +- 8 Programmable I/O (PIO) for custom peripherals +- On-board LED +- 1 Watchdog timer peripheral +- Infineon CYW43439 2.4 GHz Wi-Fi chip (Pico W only) + + +.. figure:: img/rpi_pico.jpg + :align: center + :alt: Raspberry Pi Pico + + +.. figure:: img/rpi_pico_w.jpg + :align: center + :alt: Raspberry Pi Pico W + + Raspberry Pi Pico (above) and Pico W (below) + (Images courtesy of Raspberry Pi) + +Supported Features +================== + +The rpi_pico board configuration supports the following +hardware features: + +.. list-table:: + :header-rows: 1 + + * - Peripheral + - Kconfig option + - Devicetree compatible + * - NVIC + - N/A + - :dtcompatible:`arm,v6m-nvic` + * - UART + - :kconfig:option:`CONFIG_SERIAL` + - :dtcompatible:`raspberrypi,pico-uart` + * - GPIO + - :kconfig:option:`CONFIG_GPIO` + - :dtcompatible:`raspberrypi,pico-gpio` + * - ADC + - :kconfig:option:`CONFIG_ADC` + - :dtcompatible:`raspberrypi,pico-adc` + * - I2C + - :kconfig:option:`CONFIG_I2C` + - :dtcompatible:`snps,designware-i2c` + * - SPI + - :kconfig:option:`CONFIG_SPI` + - :dtcompatible:`raspberrypi,pico-spi` + * - USB Device + - :kconfig:option:`CONFIG_USB_DEVICE_STACK` + - :dtcompatible:`raspberrypi,pico-usbd` + * - HWINFO + - :kconfig:option:`CONFIG_HWINFO` + - N/A + * - Watchdog Timer (WDT) + - :kconfig:option:`CONFIG_WATCHDOG` + - :dtcompatible:`raspberrypi,pico-watchdog` + * - PWM + - :kconfig:option:`CONFIG_PWM` + - :dtcompatible:`raspberrypi,pico-pwm` + * - Flash + - :kconfig:option:`CONFIG_FLASH` + - :dtcompatible:`raspberrypi,pico-flash` + * - Clock controller + - :kconfig:option:`CONFIG_CLOCK_CONTROL` + - :dtcompatible:`raspberrypi,pico-clock-controller` + * - UART (PIO) + - :kconfig:option:`CONFIG_SERIAL` + - :dtcompatible:`raspberrypi,pico-uart-pio` + * - SPI (PIO) + - :kconfig:option:`CONFIG_SPI` + - :dtcompatible:`raspberrypi,pico-spi-pio` + +Pin Mapping +=========== + +The peripherals of the RP2040 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. + +External pin mapping on the Pico W is identical to the Pico, but note that internal +RP2040 GPIO lines 23, 24, 25, and 29 are routed to the Infineon module on the W. +Since GPIO 25 is routed to the on-board LED on the Pico, but to the Infineon module +on the Pico W, the "blinky" sample program does not work on the W (use hello_world for +a simple test program instead). + +Default Zephyr Peripheral Mapping: +---------------------------------- + +.. rst-class:: rst-columns + +- UART0_TX : P0 +- UART0_RX : P1 +- I2C0_SDA : P4 +- I2C0_SCL : P5 +- I2C1_SDA : P14 +- I2C1_SCL : P15 +- SPI0_RX : P16 +- SPI0_CSN : P17 +- SPI0_SCK : P18 +- SPI0_TX : P19 +- ADC_CH0 : P26 +- ADC_CH1 : P27 +- ADC_CH2 : P28 +- ADC_CH3 : P29 + +Programmable I/O (PIO) +********************** +The RP2040 SoC comes with two PIO periherals. These are two simple +co-processors that are designed for I/O operations. The PIOs run +a custom instruction set, generated from a custom assembly language. +PIO programs are assembled using `pioasm`, a tool provided by Raspberry Pi. + +Zephyr does not (currently) assemble PIO programs. Rather, they should be +manually assembled and embedded in source code. An example of how this is done +can be found at `drivers/serial/uart_rpi_pico_pio.c`. + +Sample: SPI via PIO +==================== + +The :zephyr_file:`samples/sensor/bme280/README.rst` sample includes a +demonstration of using the PIO SPI driver to communicate with an +environmental sensor. The PIO SPI driver supports using any +combination of GPIO pins for an SPI bus, as well as allowing up to +four independent SPI buses on a single board (using the two SPI +devices as well as both PIO devices). + +Programming and Debugging +************************* + +Flashing +======== + +Using SEGGER JLink +------------------ + +You can Flash the rpi_pico with a SEGGER JLink debug probe as described in +:ref:`Building, Flashing and Debugging `. + +Here is an example of building and flashing the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: rpi_pico + :goals: build + +.. code-block:: bash + + west flash --runner jlink + +Using OpenOCD +------------- + +To use CMSIS-DAP, You must configure **udev**. + +Create a file in /etc/udev.rules.d with any name, and write the line below. + +.. code-block:: bash + + ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="660", GROUP="plugdev", TAG+="uaccess" + +This example is valid for the case that the user joins to `plugdev` groups. + +The Raspberry Pi Pico has an SWD interface that can be used to program +and debug the on board RP2040. This interface can be utilized by OpenOCD. +To use it with the RP2040, OpenOCD version 0.12.0 or later is needed. + +If you are using a Debian based system (including RaspberryPi OS, Ubuntu. and more), +using the `pico_setup.sh`_ script is a convenient way to set up the forked version of OpenOCD. + +Depending on the interface used (such as JLink), you might need to +checkout to a branch that supports this interface, before proceeding. +Build and install OpenOCD as described in the README. + +Here is an example of building and flashing the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: rpi_pico + :goals: build flash + :gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=cmsis-dap + +Set the environment variables **OPENOCD** to `/usr/local/bin/openocd` +and **OPENOCD_DEFAULT_PATH** to `/usr/local/share/openocd/scripts`. This should work +with the OpenOCD that was installed with the default configuration. +This configuration also works with an environment that is set up by the `pico_setup.sh`_ script. + +**RPI_PICO_DEBUG_ADAPTER** specifies what debug adapter is used for debugging. + +If **RPI_PICO_DEBUG_ADAPTER** was not assigned, `cmsis-dap` is used by default. +The other supported adapters are `raspberrypi-swd`, `jlink` and `blackmagicprobe`. +How to connect `cmsis-dap` and `raspberrypi-swd` is described in `Getting Started with Raspberry Pi Pico`_. +Any other SWD debug adapter maybe also work with this configuration. + +The value of **RPI_PICO_DEBUG_ADAPTER** is cached, so it can be omitted from +`west flash` and `west debug` if it was previously set while running `west build`. + +**RPI_PICO_DEBUG_ADAPTER** is used in an argument to OpenOCD as `"source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]"`. +Thus, **RPI_PICO_DEBUG_ADAPTER** needs to be assigned the file name of the debug adapter. + +You can also flash the board with the following +command that directly calls OpenOCD (assuming a SEGGER JLink adapter is used): + +.. code-block:: console + + $ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' -c 'program path/to/zephyr.elf verify reset exit' + +Using UF2 +--------- + +If you don't have an SWD adapter, you can flash the Raspberry Pi Pico with +a UF2 file. By default, building an app for this board will generate a +`build/zephyr/zephyr.uf2` file. If the Pico is powered on with the `BOOTSEL` +button pressed, it will appear on the host as a mass storage device. The +UF2 file should be drag-and-dropped to the device, which will flash the Pico. + +Debugging +========= + +The SWD interface can also be used to debug the board. To achieve this, you can +either use SEGGER JLink or OpenOCD. + +Using SEGGER JLink +------------------ + +Use a SEGGER JLink debug probe and follow the instruction in +:ref:`Building, Flashing and Debugging`. + + +Using OpenOCD +------------- + +Install OpenOCD as described for flashing the board. + +Here is an example for debugging the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: rpi_pico + :maybe-skip-config: + :goals: debug + :gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=raspberrypi-swd + +As with flashing, you can specify the debug adapter by specifying **RPI_PICO_DEBUG_ADAPTER** +at `west build` time. No needs to specify it at `west debug` time. + +You can also debug with OpenOCD and gdb launching from command-line. +Run the following command: + +.. code-block:: console + + $ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' + +On another terminal, run: + +.. code-block:: console + + $ gdb-multiarch + +Inside gdb, run: + +.. code-block:: console + + (gdb) tar ext :3333 + (gdb) file path/to/zephyr.elf + +You can then start debugging the board. + +.. target-notes:: + +.. _pico_setup.sh: + https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh + +.. _Getting Started with Raspberry Pi Pico: + https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf diff --git a/boards/pimoroni/pico_plus2/pico_plus2-common.dtsi b/boards/pimoroni/pico_plus2/pico_plus2-common.dtsi new file mode 100644 index 000000000000000..120ab95d98eb156 --- /dev/null +++ b/boards/pimoroni/pico_plus2/pico_plus2-common.dtsi @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include "pico_plus2-pinctrl.dtsi" +#include + +#include + + +/ { + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,code-partition = &code_partition; + }; + + aliases { + watchdog0 = &wdt0; + }; + + 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; + }; + }; +}; + +&clocks { + pinctrl-0 = <&clocks_default>; + pinctrl-names = "default"; +}; + +&uart0 { + current-speed = <115200>; + status = "okay"; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + clock-frequency = ; + status = "okay"; + pinctrl-0 = <&spi0_default>; + pinctrl-names = "default"; +}; + +&wdt0 { + status = "okay"; +}; + +&adc { + status = "okay"; + pinctrl-0 = <&adc_default>; + pinctrl-names = "default"; +}; + +zephyr_udc0: &usbd { + status = "okay"; +}; + +&pwm { + pinctrl-0 = <&pwm_ch4b_default>; + pinctrl-names = "default"; + divider-int-0 = <255>; +}; + +pico_serial: &uart0 {}; diff --git a/boards/pimoroni/pico_plus2/pico_plus2-pinctrl.dtsi b/boards/pimoroni/pico_plus2/pico_plus2-pinctrl.dtsi new file mode 100644 index 000000000000000..c449fcb15dc284a --- /dev/null +++ b/boards/pimoroni/pico_plus2/pico_plus2-pinctrl.dtsi @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart0_default: uart0_default { + group1 { + pinmux = ; + }; + group2 { + pinmux = ; + input-enable; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , ; + input-enable; + input-schmitt-enable; + }; + }; + + spi0_default: spi0_default { + group1 { + pinmux = , , ; + }; + group2 { + pinmux = ; + input-enable; + }; + }; + + pwm_ch4b_default: pwm_ch4b_default { + group1 { + pinmux = ; + }; + }; + + adc_default: adc_default { + group1 { + pinmux = , , , ; + input-enable; + }; + }; + + clocks_default: clocks_default { + }; +}; diff --git a/boards/pimoroni/pico_plus2/pico_plus2.dts b/boards/pimoroni/pico_plus2/pico_plus2.dts new file mode 100644 index 000000000000000..fc80be523e084c0 --- /dev/null +++ b/boards/pimoroni/pico_plus2/pico_plus2.dts @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "pico_plus2-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"; + }; + }; + + buttons { + compatible = "gpio-keys"; + user_sw: user_sw { + gpios = <&gpio0 45 (GPIO_ACTIVE_LOW)>; + zephyr,code = ; + }; + }; + + aliases { + led0 = &led0; + pwm-led0 = &pwm_led0; + sw0 = &user_sw; + }; +}; diff --git a/boards/pimoroni/pico_plus2/pico_plus2.yaml b/boards/pimoroni/pico_plus2/pico_plus2.yaml new file mode 100644 index 000000000000000..7a2847ed76cb762 --- /dev/null +++ b/boards/pimoroni/pico_plus2/pico_plus2.yaml @@ -0,0 +1,14 @@ +identifier: pico_plus2 +name: Pimoroni Pico Plus2 +type: mcu +arch: arm +flash: 16384 +ram: 8192 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - clock + - gpio + - uart diff --git a/boards/pimoroni/pico_plus2/pico_plus2_defconfig b/boards/pimoroni/pico_plus2/pico_plus2_defconfig new file mode 100644 index 000000000000000..7623cb96853fe9b --- /dev/null +++ b/boards/pimoroni/pico_plus2/pico_plus2_defconfig @@ -0,0 +1,11 @@ +CONFIG_CLOCK_CONTROL=y +CONFIG_CONSOLE=y +CONFIG_GPIO=y +CONFIG_RESET=y +CONFIG_SERIAL=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 +CONFIG_UART_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_BUILD_OUTPUT_UF2=y +CONFIG_BUILD_OUTPUT_HEX=y diff --git a/boards/pimoroni/pico_plus2/support/openocd.cfg b/boards/pimoroni/pico_plus2/support/openocd.cfg new file mode 100644 index 000000000000000..82666bb53314ce7 --- /dev/null +++ b/boards/pimoroni/pico_plus2/support/openocd.cfg @@ -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 + } +} diff --git a/samples/drivers/adc/adc_dt/boards/pico_plus2.overlay b/samples/drivers/adc/adc_dt/boards/pico_plus2.overlay new file mode 100644 index 000000000000000..abf2d227844b99f --- /dev/null +++ b/samples/drivers/adc/adc_dt/boards/pico_plus2.overlay @@ -0,0 +1,24 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 TOKITA Hiroshi + */ + +/ { + 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 = ; + zephyr,resolution = <12>; + }; +}; diff --git a/samples/drivers/counter/alarm/src/main.c b/samples/drivers/counter/alarm/src/main.c index e9fe0e67902fd72..e70a86a68f730a8 100644 --- a/samples/drivers/counter/alarm/src/main.c +++ b/samples/drivers/counter/alarm/src/main.c @@ -52,7 +52,11 @@ struct counter_alarm_cfg alarm_cfg; #elif defined(CONFIG_COUNTER_SNPS_DW) #define TIMER DT_NODELABEL(timer0) #elif defined(CONFIG_COUNTER_TIMER_RPI_PICO) +#ifdef CONFIG_SOC_SERIES_RP2040 #define TIMER DT_NODELABEL(timer) +#elif CONFIG_SOC_SERIES_RP2350 +#define TIMER DT_NODELABEL(timer0) +#endif #else #error Unable to find a counter device node in devicetree #endif diff --git a/samples/drivers/led_pwm/boards/pico_plus2.overlay b/samples/drivers/led_pwm/boards/pico_plus2.overlay new file mode 100644 index 000000000000000..565dcd6fbbab9ee --- /dev/null +++ b/samples/drivers/led_pwm/boards/pico_plus2.overlay @@ -0,0 +1,15 @@ +/ { + leds { + status = "disabled"; + }; + + pwm_leds { + status = "okay"; + }; +}; + +&pwm { + status = "okay"; + divider-frac-4 = <15>; + divider-int-4 = <255>; +}; diff --git a/samples/sensor/die_temp_polling/boards/pico_plus2.conf b/samples/sensor/die_temp_polling/boards/pico_plus2.conf new file mode 100644 index 000000000000000..488a81dca52041f --- /dev/null +++ b/samples/sensor/die_temp_polling/boards/pico_plus2.conf @@ -0,0 +1 @@ +CONFIG_ADC=y diff --git a/samples/sensor/die_temp_polling/boards/pico_plus2.overlay b/samples/sensor/die_temp_polling/boards/pico_plus2.overlay new file mode 100644 index 000000000000000..38f5ece1c98a1be --- /dev/null +++ b/samples/sensor/die_temp_polling/boards/pico_plus2.overlay @@ -0,0 +1,9 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 TOKITA Hiroshi + */ + +&die_temp { + status = "okay"; +};