Skip to content

boards: Adding board definition for rpi_pico_w #57437

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

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions boards/arm/rpi_pico/Kconfig.board
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
config BOARD_RPI_PICO
bool "Raspberry Pi Pico Board"
depends on SOC_RP2040

config BOARD_RPI_PICO_W
bool "Raspberry Pi Pico W Board"
depends on SOC_RP2040
7 changes: 4 additions & 3 deletions boards/arm/rpi_pico/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright (c) 2021 Yonatan Schachter
# SPDX-License-Identifier: Apache-2.0

if BOARD_RPI_PICO
if BOARD_RPI_PICO || BOARD_RPI_PICO_W

config BOARD
default "rpi_pico"
default "rpi_pico" if BOARD_RPI_PICO
default "rpi_pico_w" if BOARD_RPI_PICO_W

config RP2_FLASH_W25Q080
default y
Expand All @@ -16,4 +17,4 @@ config I2C_DW_CLOCK_SPEED

endif #I2C_DW

endif # BOARD_RPI_PICO
endif # BOARD_RPI_PICO || BOARD_RPI_PICO_W
Binary file added boards/arm/rpi_pico/doc/img/rpi_pico_w.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 20 additions & 6 deletions boards/arm/rpi_pico/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ Raspberry Pi Pico
Overview
********

The Raspberry Pi Pico is a small, low-cost, versatile board from
Raspberry Pi. It is equipped with an RP2040 SoC, an on-board LED,
a USB connector, and an SWD interface. The USB bootloader allows it
to be flashed without any adapter, in a drag-and-drop manner.
It is also possible to flash and debug the Pico with its SWD interface,
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/Bluetoth 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
Expand All @@ -28,13 +29,20 @@ Hardware
- 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

Raspberry Pi Pico (Image courtesy of Raspberry Pi)

.. 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
==================
Expand Down Expand Up @@ -92,6 +100,12 @@ 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:
----------------------------------

Expand Down
112 changes: 112 additions & 0 deletions boards/arm/rpi_pico/rpi_pico-common.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* Copyright (c) 2021 Yonatan Schachter
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <freq.h>

#include <rpi_pico/rp2040.dtsi>
#include "rpi_pico-pinctrl.dtsi"
#include <zephyr/dt-bindings/pwm/pwm.h>

#include <zephyr/dt-bindings/i2c/i2c.h>


/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,flash-controller = &ssi;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,code-partition = &code_partition;
};

xtal_clk: xtal-clk {
compatible = "fixed-clock";
clock-frequency = <12000000>;
#clock-cells = <0>;
};

aliases {
watchdog0 = &wdt0;
};
};

&flash0 {
reg = <0x10000000 DT_SIZE_M(2)>;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

/* Reserved memory for the second stage bootloader */
second_stage_bootloader: partition@0 {
label = "second_stage_bootloader";
reg = <0x00000000 0x100>;
read-only;
};

/*
* Usable flash. Starts at 0x100, after the bootloader. The partition
* size is 2MB minus the 0x100 bytes taken by the bootloader.
*/
code_partition: partition@100 {
label = "code-partition";
reg = <0x100 (DT_SIZE_M(2) - 0x100)>;
read-only;
};
};
};

&uart0 {
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};

&gpio0 {
status = "okay";
};

&i2c0 {
clock-frequency = <I2C_BITRATE_STANDARD>;
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
};

&spi0 {
clock-frequency = <DT_FREQ_M(8)>;
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>;
};

&vreg {
regulator-always-on;
regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>;
};
101 changes: 1 addition & 100 deletions boards/arm/rpi_pico/rpi_pico.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,9 @@

/dts-v1/;

#include <freq.h>

#include <rpi_pico/rp2040.dtsi>
#include "rpi_pico-pinctrl.dtsi"
#include <zephyr/dt-bindings/pwm/pwm.h>

#include <zephyr/dt-bindings/i2c/i2c.h>
#include "rpi_pico-common.dtsi"

/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,flash-controller = &ssi;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,code-partition = &code_partition;
};

leds {
compatible = "gpio-leds";
led0: led_0 {
Expand All @@ -32,12 +17,6 @@
};
};

xtal_clk: xtal-clk {
compatible = "fixed-clock";
clock-frequency = <12000000>;
#clock-cells = <0>;
};

pwm_leds {
compatible = "pwm-leds";
status = "disabled";
Expand All @@ -49,84 +28,6 @@

aliases {
led0 = &led0;
watchdog0 = &wdt0;
pwm-led0 = &pwm_led0;
};
};

&flash0 {
reg = <0x10000000 DT_SIZE_M(2)>;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

/* Reserved memory for the second stage bootloader */
second_stage_bootloader: partition@0 {
label = "second_stage_bootloader";
reg = <0x00000000 0x100>;
read-only;
};

/*
* Usable flash. Starts at 0x100, after the bootloader. The partition
* size is 2MB minus the 0x100 bytes taken by the bootloader.
*/
code_partition: partition@100 {
label = "code-partition";
reg = <0x100 (DT_SIZE_M(2) - 0x100)>;
read-only;
};
};
};

&uart0 {
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};

&gpio0 {
status = "okay";
};

&i2c0 {
clock-frequency = <I2C_BITRATE_STANDARD>;
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
};

&spi0 {
clock-frequency = <DT_FREQ_M(8)>;
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>;
};

&vreg {
regulator-always-on;
regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>;
};
1 change: 1 addition & 0 deletions boards/arm/rpi_pico/rpi_pico_defconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CONFIG_SOC_SERIES_RP2XXX=y
CONFIG_SOC_RP2040=y
CONFIG_BOARD_RPI_PICO=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
Expand Down
9 changes: 9 additions & 0 deletions boards/arm/rpi_pico/rpi_pico_w.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2023 Dave Rensberger - Beechwoods Software
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include "rpi_pico-common.dtsi"
21 changes: 21 additions & 0 deletions boards/arm/rpi_pico/rpi_pico_w.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
identifier: rpi_pico_w
name: RaspberryPi-Pico-w
type: mcu
arch: arm
flash: 2048
ram: 264
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- uart
- gpio
- adc
- i2c
- spi
- hwinfo
- watchdog
- pwm
- flash
- dma
13 changes: 13 additions & 0 deletions boards/arm/rpi_pico/rpi_pico_w_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CONFIG_SOC_SERIES_RP2XXX=y
CONFIG_SOC_RP2040=y
CONFIG_BOARD_RPI_PICO_W=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_GPIO=y
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_RESET=y
Loading