diff --git a/boards/arm/rpi_pico/Kconfig.board b/boards/arm/rpi_pico/Kconfig.board index ac9d9661bbfe4..e2c1318db67bc 100644 --- a/boards/arm/rpi_pico/Kconfig.board +++ b/boards/arm/rpi_pico/Kconfig.board @@ -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 diff --git a/boards/arm/rpi_pico/Kconfig.defconfig b/boards/arm/rpi_pico/Kconfig.defconfig index 4a7dd9f7f98ec..898b8abe04bcb 100644 --- a/boards/arm/rpi_pico/Kconfig.defconfig +++ b/boards/arm/rpi_pico/Kconfig.defconfig @@ -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 @@ -16,4 +17,4 @@ config I2C_DW_CLOCK_SPEED endif #I2C_DW -endif # BOARD_RPI_PICO +endif # BOARD_RPI_PICO || BOARD_RPI_PICO_W diff --git a/boards/arm/rpi_pico/doc/img/rpi_pico_w.jpg b/boards/arm/rpi_pico/doc/img/rpi_pico_w.jpg new file mode 100644 index 0000000000000..426a088a33809 Binary files /dev/null and b/boards/arm/rpi_pico/doc/img/rpi_pico_w.jpg differ diff --git a/boards/arm/rpi_pico/doc/index.rst b/boards/arm/rpi_pico/doc/index.rst index 6dda3cbfdc96c..074de00d81792 100644 --- a/boards/arm/rpi_pico/doc/index.rst +++ b/boards/arm/rpi_pico/doc/index.rst @@ -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 @@ -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 ================== @@ -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: ---------------------------------- diff --git a/boards/arm/rpi_pico/rpi_pico-common.dtsi b/boards/arm/rpi_pico/rpi_pico-common.dtsi new file mode 100644 index 0000000000000..9ad33f1993a27 --- /dev/null +++ b/boards/arm/rpi_pico/rpi_pico-common.dtsi @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2021 Yonatan Schachter + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include "rpi_pico-pinctrl.dtsi" +#include + +#include + + +/ { + 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 = ; + status = "okay"; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&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>; +}; + +&vreg { + regulator-always-on; + regulator-allowed-modes = ; +}; diff --git a/boards/arm/rpi_pico/rpi_pico.dts b/boards/arm/rpi_pico/rpi_pico.dts index 0b2754d29bc25..97d721024d749 100644 --- a/boards/arm/rpi_pico/rpi_pico.dts +++ b/boards/arm/rpi_pico/rpi_pico.dts @@ -6,24 +6,9 @@ /dts-v1/; -#include - -#include -#include "rpi_pico-pinctrl.dtsi" -#include - -#include +#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 { @@ -32,12 +17,6 @@ }; }; - xtal_clk: xtal-clk { - compatible = "fixed-clock"; - clock-frequency = <12000000>; - #clock-cells = <0>; - }; - pwm_leds { compatible = "pwm-leds"; status = "disabled"; @@ -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 = ; - status = "okay"; - pinctrl-0 = <&i2c0_default>; - pinctrl-names = "default"; -}; - -&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>; -}; - -&vreg { - regulator-always-on; - regulator-allowed-modes = ; -}; diff --git a/boards/arm/rpi_pico/rpi_pico_defconfig b/boards/arm/rpi_pico/rpi_pico_defconfig index 939e92d10efed..2a276892119f1 100644 --- a/boards/arm/rpi_pico/rpi_pico_defconfig +++ b/boards/arm/rpi_pico/rpi_pico_defconfig @@ -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 diff --git a/boards/arm/rpi_pico/rpi_pico_w.dts b/boards/arm/rpi_pico/rpi_pico_w.dts new file mode 100644 index 0000000000000..ae01f15d69784 --- /dev/null +++ b/boards/arm/rpi_pico/rpi_pico_w.dts @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2023 Dave Rensberger - Beechwoods Software + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "rpi_pico-common.dtsi" diff --git a/boards/arm/rpi_pico/rpi_pico_w.yaml b/boards/arm/rpi_pico/rpi_pico_w.yaml new file mode 100644 index 0000000000000..adc102da73176 --- /dev/null +++ b/boards/arm/rpi_pico/rpi_pico_w.yaml @@ -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 diff --git a/boards/arm/rpi_pico/rpi_pico_w_defconfig b/boards/arm/rpi_pico/rpi_pico_w_defconfig new file mode 100644 index 0000000000000..a03556141970f --- /dev/null +++ b/boards/arm/rpi_pico/rpi_pico_w_defconfig @@ -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 diff --git a/tests/drivers/adc/adc_api/boards/rpi_pico_w.overlay b/tests/drivers/adc/adc_api/boards/rpi_pico_w.overlay new file mode 100644 index 0000000000000..c904836fef06c --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/rpi_pico_w.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Dave Rensberger - Beechwoods Software + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1>; + }; +}; + +&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>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +};