boards: Add support for DFRobot Beetle RP2350

Tested with the commands mentioned in index.rst

Product photo from
https://www.dfrobot.com/product-2913.html

Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
This commit is contained in:
Jonas Berg
2026-01-03 02:29:47 +01:00
committed by Benjamin Cabé
parent 8907c9ab8d
commit 0c169bb5ea
15 changed files with 464 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
# Copyright (c) 2026 Jonas Berg
# SPDX-License-Identifier: Apache-2.0
config BOARD_BEETLE_RP2350
select SOC_RP2350A_HAZARD3 if BOARD_BEETLE_RP2350_RP2350A_HAZARD3
select SOC_RP2350A_M33 if BOARD_BEETLE_RP2350_RP2350A_M33

View File

@@ -0,0 +1,9 @@
# Copyright (c) 2025 Stephano Cetola
# SPDX-License-Identifier: Apache-2.0
if BOARD_BEETLE_RP2350
config USB_SELF_POWERED
default n
endif # BOARD_BEETLE_RP2350

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2026 Jonas Berg
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2350a-pinctrl.h>
&pinctrl {
adc_default: adc_default {
group1 {
pinmux = <ADC_CH0_P26>, <ADC_CH1_P27>;
input-enable;
};
};
i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_P4>, <I2C0_SCL_P5>;
input-enable;
};
};
spi0_default: spi0_default {
group1 {
pinmux = <SPI0_TX_P19>, <SPI0_SCK_P18>;
};
group2 {
pinmux = <SPI0_RX_P16>;
input-enable;
};
};
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_P0>;
};
group2 {
pinmux = <UART0_RX_P1>;
input-enable;
};
};
};

View File

@@ -0,0 +1,120 @@
/*
* Copyright (c) 2025 Stephano Cetola
* Copyright (c) 2026 Jonas Berg
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <freq.h>
#include <zephyr/dt-bindings/i2c/i2c.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/led/led.h>
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2350a-pinctrl.h>
#include "beetle_rp2350-pinctrl.dtsi"
/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
};
aliases {
led0 = &red_led;
watchdog0 = &wdt0;
};
zephyr,user {
io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>;
};
leds: leds {
compatible = "gpio-leds";
red_led: red_led {
gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
};
};
&flash0 {
reg = <0x10000000 DT_SIZE_M(2)>;
};
&gpio0 {
status = "okay";
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
&i2c0 {
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_STANDARD>;
};
&spi0 {
pinctrl-0 = <&spi0_default>;
pinctrl-names = "default";
status = "okay";
};
&adc {
status = "okay";
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
#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>;
};
channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
&timer0 {
status = "okay";
};
&wdt0 {
status = "okay";
};
zephyr_udc0: &usbd {
status = "okay";
};

View File

@@ -0,0 +1,12 @@
/*
* Copyright (c) 2026 Jonas Berg
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <raspberrypi/rpi_pico/rp2350a.dtsi>
#include <riscv/raspberrypi/hazard3.dtsi>
#include "beetle_rp2350.dtsi"

View File

@@ -0,0 +1,22 @@
identifier: beetle_rp2350/rp2350a/hazard3
name: DFRobot Beetle RP2350 (Hazard3)
type: mcu
arch: riscv
flash: 2048
ram: 520
toolchain:
- zephyr
supported:
- adc
- clock
- counter
- dma
- flash
- gpio
- hwinfo
- i2c
- pwm
- spi
- uart
- usbd
- watchdog

View File

@@ -0,0 +1,13 @@
# Copyright (c) 2026 Jonas Berg
# SPDX-License-Identifier: Apache-2.0
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_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_USE_DT_CODE_PARTITION=y

View File

@@ -0,0 +1,12 @@
/*
* Copyright (c) 2026 Jonas Berg
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <raspberrypi/rpi_pico/rp2350a.dtsi>
#include <raspberrypi/rpi_pico/m33.dtsi>
#include "beetle_rp2350.dtsi"

View File

@@ -0,0 +1,23 @@
identifier: beetle_rp2350/rp2350a/m33
name: DFRobot Beetle RP2350 (Cortex M33)
type: mcu
arch: arm
flash: 2048
ram: 520
toolchain:
- zephyr
- gnuarmemb
supported:
- adc
- clock
- counter
- dma
- flash
- gpio
- hwinfo
- i2c
- pwm
- spi
- uart
- usbd
- watchdog

View File

@@ -0,0 +1,13 @@
# Copyright (c) 2026 Jonas Berg
# SPDX-License-Identifier: Apache-2.0
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_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_USE_DT_CODE_PARTITION=y

View File

@@ -0,0 +1,27 @@
# SPDX-License-Identifier: Apache-2.0
# Adapted from boards/raspberrypi/rpi_pico2/board.cmake
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]")
if(CONFIG_ARM)
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]")
else()
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350-riscv.cfg]")
endif()
# 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(probe-rs "--chip=RP235x")
board_runner_args(jlink "--device=RP2350_M33_0")
board_runner_args(uf2 "--board-id=RP2350")
# Default runner should be listed first
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/probe-rs.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

View File

@@ -0,0 +1,6 @@
board:
name: beetle_rp2350
full_name: Beetle RP2350
vendor: dfrobot
socs:
- name: rp2350a

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,145 @@
.. zephyr:board:: beetle_rp2350
Overview
********
The `DFRobot Beetle RP2350`_ board is based on the RP2350A microcontroller from Raspberry Pi Ltd.
The board has two 8-pin headers and a USB type C connector.
Hardware
********
- Microcontroller Raspberry Pi RP2350A, with a max frequency of 150 MHz
- Dual ARM Cortex M33 cores, and dual RISC-V Hazard3 cores.
- 520 kByte SRAM
- 2 Mbyte QSPI flash
- 9 GPIO pins
- 2 ADC pins
- I2C
- UART
- SPI
- USB type C connector
- Lithium battery charger
- Reset and boot buttons
- User LED
Default Zephyr Peripheral Mapping
=================================
+---------------+--------+------------+
| Description | Pin | Comments |
+===============+========+============+
| User LED | GPIO25 | Alias led0 |
+---------------+--------+------------+
GPIO header:
+-------+--------+-----------------+
| Label | Pin | Default pin mux |
+=======+========+=================+
| 0 | GPIO0 | UART0 TX |
+-------+--------+-----------------+
| 1 | GPIO1 | UART0 RX |
+-------+--------+-----------------+
| 4 | GPIO4 | I2C0 SDA |
+-------+--------+-----------------+
| 5 | GPIO5 | I2C0 SCL |
+-------+--------+-----------------+
| 8 | GPIO8 | |
+-------+--------+-----------------+
| 9 | GPIO9 | |
+-------+--------+-----------------+
| 16 | GPIO16 | SPI0 MISO |
+-------+--------+-----------------+
| 18 | GPIO18 | SPI0 SCK |
+-------+--------+-----------------+
| 19 | GPIO19 | SPI0 MOSI |
+-------+--------+-----------------+
| 26 | GPIO26 | ADC0 |
+-------+--------+-----------------+
| 27 | GPIO27 | ADC1 |
+-------+--------+-----------------+
See also `pinout`_ and `schematic`_.
Supported Features
==================
.. zephyr:board-supported-hw::
Programming and Debugging
*************************
.. zephyr:board-supported-runners::
By default programming is done via the USB connector. Press and hold the BOOT button, and then
press the RST button, and the device will appear as a USB mass storage unit.
Building your application will result in a :file:`build/zephyr/zephyr.uf2` file.
Drag and drop the file to the USB mass storage unit, and the board will be reprogrammed.
It is also possible to program and debug the board via the SWDIO and SWCLK pins in the DEBUG
connector. You must solder a 3-pin or 4-pin header to the back of the board in order to use
this feature. A separate programming hardware tool is required, and for example
the :command:`openocd` software is used. You might need to use Raspberry Pi's forked
version of OpenOCD. Typically the ``OPENOCD`` and ``OPENOCD_DEFAULT_PATH`` values should be
set when building, and the ``--runner openocd`` argument should be used when flashing.
For more details on programming RP2040-based and RP2350-based boards,
see :ref:`rpi_pico_programming_and_debugging`.
Flashing the M33 core
=====================
To run the :zephyr:code-sample:`blinky` sample:
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky/
:board: beetle_rp2350/rp2350a/m33
:goals: build flash
Try also the :zephyr:code-sample:`hello_world` and
:zephyr:code-sample:`adc_dt` samples.
Use the shell to control the GPIO pins:
.. zephyr-app-commands::
:zephyr-app: samples/sensor/sensor_shell
:board: beetle_rp2350/rp2350a/m33
:gen-args: -DCONFIG_GPIO=y -DCONFIG_GPIO_SHELL=y
:goals: build flash
To set one of the GPIO pins high, use these commands in the shell:
.. code-block:: shell
gpio conf gpio0 8 o
gpio set gpio0 8 1
Flashing the Hazard3 core
=========================
The RP2350A microcontroller has two ARM M33 cores and two RISC-V Hazard3 cores.
To flash one of the Hazard3 cores, use the board argument ``beetle_rp2350/rp2350a/hazard3``.
The sample :zephyr:code-sample:`blinky` has been verified for this core.
Use the USB mass storage programming method described above.
References
**********
.. target-notes::
.. _DFRobot Beetle RP2350:
https://www.dfrobot.com/product-2913.html
.. _pinout:
https://wiki.dfrobot.com/SKU_DFR1188_Beetle_RP2350#target_4
.. _schematic:
https://dfimg.dfrobot.com/5d57611a3416442fa39bffca/wiki/f18e5f3a683e6d8a9c8582ac6f89b023.pdf

View File

@@ -0,0 +1,11 @@
# Copyright (c) 2022 Tokita, Hiroshi <tokita.hiroshi@gmail.com>
# SPDX-License-Identifier: Apache-2.0
# Checking and set 'adapter speed'.
# Set the adapter 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
}
}