diff --git a/boards/adafruit/feather_adalogger_rp2040/Kconfig b/boards/adafruit/feather_adalogger_rp2040/Kconfig new file mode 100644 index 0000000000000..df911cbc615db --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/Kconfig @@ -0,0 +1,5 @@ +# Copyright (c) 2022 Peter Johanson +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_FEATHER_ADALOGGER_RP2040 + select RP2_FLASH_W25Q080 diff --git a/boards/adafruit/feather_adalogger_rp2040/Kconfig.adafruit_feather_adalogger_rp2040 b/boards/adafruit/feather_adalogger_rp2040/Kconfig.adafruit_feather_adalogger_rp2040 new file mode 100644 index 0000000000000..54a1614be4ecc --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/Kconfig.adafruit_feather_adalogger_rp2040 @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Jonas Berg +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_FEATHER_ADALOGGER_RP2040 + select SOC_RP2040 diff --git a/boards/adafruit/feather_adalogger_rp2040/Kconfig.defconfig b/boards/adafruit/feather_adalogger_rp2040/Kconfig.defconfig new file mode 100644 index 0000000000000..247fa36da6c8f --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/Kconfig.defconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2022 Peter Johanson +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_ADAFRUIT_FEATHER_ADALOGGER_RP2040 + +if I2C_DW + +config I2C_DW_CLOCK_SPEED + default 125 + +endif # I2C_DW + +config USB_SELF_POWERED + default n + +endif # BOARD_ADAFRUIT_FEATHER_ADALOGGER_RP2040 diff --git a/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040-pinctrl.dtsi b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040-pinctrl.dtsi new file mode 100644 index 0000000000000..185234bef8d90 --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040-pinctrl.dtsi @@ -0,0 +1,69 @@ +#include + +&pinctrl { + uart0_default: uart0_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + i2c1_default: i2c1_default { + group1 { + pinmux = ; + input-enable; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + spi0_default: spi0_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + + group3 { + pinmux = ; + }; + }; + + spi1_default: spi1_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + + group3 { + pinmux = ; + }; + }; + + adc_default: adc_default { + group1 { + pinmux = , , , ; + input-enable; + }; + }; + + ws2812_pio0_default: ws2812_pio0_default { + ws2812 { + pinmux = ; + }; + }; +}; diff --git a/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040.dts b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040.dts new file mode 100644 index 0000000000000..5c71e20eb3f61 --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040.dts @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2021 Yonatan Schachter + * Copyright (c) 2022 Peter Johanson + * Copyright (c) 2025 Jonas Berg + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "adafruit_feather_adalogger_rp2040-pinctrl.dtsi" +#include "feather_connector.dtsi" + +/ { + model = "Adafruit Feather RP2040 Adalogger"; + compatible = "adafruit,feather_adalogger_rp2040"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,flash-controller = &ssi; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,code-partition = &code_partition; + }; + + aliases { + watchdog0 = &wdt0; + led-strip = &ws2812; + led0 = &red_led; + sdhc0 = &sdhc0; + sw0 = &user_button; + }; + + zephyr,user { + io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>; + }; + + gpio_keys { + compatible = "gpio-keys"; + + user_button: button { + label = "User"; + gpios = <&gpio0 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + zephyr,code = ; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + + red_led: red_led { + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + label = "Red LED"; + }; + }; + + stemma_connector: stemma_connector { + compatible = "stemma-qt-connector"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpio0 3 0>, /* SCL */ + <1 0 &gpio0 2 0>; /* SDA */ + }; +}; + +&flash0 { + reg = <0x10000000 DT_SIZE_M(8)>; + + 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 8 MB minus the 0x100 bytes taken by the bootloader. + */ + code_partition: partition@100 { + label = "code-partition"; + reg = <0x100 (DT_SIZE_M(8) - 0x100)>; + read-only; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&uart0 { + current-speed = <115200>; + status = "okay"; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +zephyr_i2c: &i2c1 { + status = "okay"; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; + clock-frequency = ; +}; + +&spi0 { + pinctrl-0 = <&spi0_default>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; + + sdhc0: sdhc@0 { + compatible = "zephyr,sdhc-spi-slot"; + reg = <0>; + status = "okay"; + spi-max-frequency = <12000000>; + + mmc { + compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; + status = "okay"; + }; + }; +}; + +&spi1 { + pinctrl-0 = <&spi1_default>; + pinctrl-names = "default"; + status = "okay"; +}; + +&timer { + status = "okay"; +}; + +&wdt0 { + 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 = ; + zephyr,resolution = <12>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + channel@3 { + reg = <3>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +}; + +&pio0 { + status = "okay"; + + pio-ws2812 { + compatible = "worldsemi,ws2812-rpi_pico-pio"; + status = "okay"; + pinctrl-0 = <&ws2812_pio0_default>; + pinctrl-names = "default"; + bit-waveform = <3>, <3>, <4>; + + /* RGB LED (Neopixel) */ + ws2812: ws2812 { + status = "okay"; + gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>; + chain-length = <1>; + color-mapping = ; + reset-delay = <280>; + frequency = <800000>; + }; + }; +}; + +zephyr_udc0: &usbd { + status = "okay"; +}; + +&die_temp { + status = "okay"; +}; + +&vreg { + regulator-always-on; + regulator-allowed-modes = ; +}; + +&xosc { + startup-delay-multiplier = <64>; +}; diff --git a/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040.yaml b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040.yaml new file mode 100644 index 0000000000000..22f85b8aa37ac --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040.yaml @@ -0,0 +1,22 @@ +identifier: adafruit_feather_adalogger_rp2040 +name: Adafruit Feather RP2040 Adalogger +type: mcu +arch: arm +flash: 8192 +ram: 264 +toolchain: + - zephyr + - gnuarmemb +supported: + - adc + - clock + - counter + - dma + - flash + - gpio + - hwinfo + - i2c + - pwm + - spi + - uart + - watchdog diff --git a/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040_defconfig b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040_defconfig new file mode 100644 index 0000000000000..dc89ae43cf192 --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/adafruit_feather_adalogger_rp2040_defconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_BUILD_OUTPUT_UF2=y +CONFIG_CLOCK_CONTROL=y +CONFIG_GPIO=y +CONFIG_PIO_RPI_PICO=y +CONFIG_RESET=y +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/adafruit/feather_adalogger_rp2040/board.cmake b/boards/adafruit/feather_adalogger_rp2040/board.cmake new file mode 100644 index 0000000000000..affc290a869d6 --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/board.cmake @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2023 TOKITA Hiroshi + +board_runner_args(uf2 "--board-id=RPI-RP2") + +include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) diff --git a/boards/adafruit/feather_adalogger_rp2040/board.yml b/boards/adafruit/feather_adalogger_rp2040/board.yml new file mode 100644 index 0000000000000..c7e36db06ae60 --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/board.yml @@ -0,0 +1,6 @@ +board: + name: adafruit_feather_adalogger_rp2040 + full_name: Feather RP2040 Adalogger + vendor: adafruit + socs: + - name: rp2040 diff --git a/boards/adafruit/feather_adalogger_rp2040/doc/img/adafruit_feather_adalogger_rp2040.webp b/boards/adafruit/feather_adalogger_rp2040/doc/img/adafruit_feather_adalogger_rp2040.webp new file mode 100644 index 0000000000000..ac5d0b5cb7634 Binary files /dev/null and b/boards/adafruit/feather_adalogger_rp2040/doc/img/adafruit_feather_adalogger_rp2040.webp differ diff --git a/boards/adafruit/feather_adalogger_rp2040/doc/index.rst b/boards/adafruit/feather_adalogger_rp2040/doc/index.rst new file mode 100644 index 0000000000000..83ca0047d866b --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/doc/index.rst @@ -0,0 +1,123 @@ +.. zephyr:board:: adafruit_feather_adalogger_rp2040 + +Overview +******** + +The `Adafruit Feather Adalogger RP2040`_ board is based on the RP2040 +microcontroller from Raspberry Pi Ltd. The board has a MicroSD-card socket +for storing data, and a Stemma QT connector for easy sensor usage. +It is compatible with the Feather board form factor, and has +a USB type C connector. + + +Hardware +******** + +- Microcontroller Raspberry Pi RP2040, with a max frequency of 133 MHz +- Dual ARM Cortex M0+ cores +- 264 kByte SRAM +- 8 Mbyte QSPI flash +- 17 GPIO pins +- 4 ADC pins +- I2C +- SPI +- UART +- USB type C connector +- Reset and boot buttons +- Red LED +- RGB LED (Neopixel) +- Stemma QT I2C connector +- MicroSD-card holder +- Built-in lithium ion battery charger + + +Default Zephyr Peripheral Mapping +================================= + +.. rst-class:: rst-columns + + - A0 ADC0 : GPIO26 + - A1 ADC1 : GPIO27 + - A2 ADC2 : GPIO28 + - A3 ADC3 : GPIO29 + - D24 : GPIO24 + - D25 : GPIO25 + - SCK SPI1 SCK : GPIO14 + - MO SPI1 MOSI : GPIO15 + - MI SPI1 MISO : GPIO8 + - RX UART0 : GPIO1 + - TX UART0 : GPIO0 + - D4 : GPIO4 + - SDA I2C1 : GPIO2 + - SCL I2C1 : GPIO3 + - D5 : GPIO5 + - D6 : GPIO6 + - D9 : GPIO9 + - D10 : GPIO10 + - D11 : GPIO11 + - D12 : GPIO12 + - D13 and red LED: GPIO13 + - RGB LED : GPIO17 + - Button BOOT : GPIO7 + - SD-card CARD_DET : GPIO16 + - SD-card SPI0 SD_CLK : GPIO18 + - SD-card SPI0 CMD/MOSI : GPIO19 + - SD-card SPI0 DAT0/MISO : GPIO20 + - SD-card DAT1 : GPIO21 + - SD-card DAT2 : GPIO22 + - SD-card DAT3/CS : GPIO23 + +See also `pinout`_ and `schematic`_. + + +Supported Features +================== + +.. zephyr:board-supported-hw:: + + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +The Adafruit Feather RP2040 Adalogger board does not expose +the SWDIO and SWCLK pins, so programming must be done via the USB +port. 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. + +For more details on programming RP2040-based boards, see +:ref:`rpi_pico_programming_and_debugging`. + + +Flashing +======== + +To run the :zephyr:code-sample:`blinky` sample: + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky/ + :board: adafruit_feather_adalogger_rp2040 + :goals: build flash + +Try also the :zephyr:code-sample:`led-strip`, :zephyr:code-sample:`input-dump`, +:zephyr:code-sample:`fs`, :zephyr:code-sample:`usb-cdc-acm-console` and +:zephyr:code-sample:`adc_dt` samples. + + +References +********** + +.. target-notes:: + +.. _Adafruit Feather Adalogger RP2040: + https://learn.adafruit.com/adafruit-feather-rp2040-adalogger + +.. _pinout: + https://learn.adafruit.com/adafruit-feather-rp2040-adalogger/pinouts + +.. _schematic: + https://learn.adafruit.com/adafruit-feather-rp2040-pico/downloads diff --git a/boards/adafruit/feather_adalogger_rp2040/feather_connector.dtsi b/boards/adafruit/feather_adalogger_rp2040/feather_connector.dtsi new file mode 100644 index 0000000000000..4fd512b4277c0 --- /dev/null +++ b/boards/adafruit/feather_adalogger_rp2040/feather_connector.dtsi @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Jonas Berg + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + feather_header: connector { + compatible = "adafruit-feather-header"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpio0 26 0>, /* A0 */ + <1 0 &gpio0 27 0>, /* A1 */ + <2 0 &gpio0 28 0>, /* A2 */ + <3 0 &gpio0 29 0>, /* A3 */ + <4 0 &gpio0 24 0>, /* D24 */ + <5 0 &gpio0 25 0>, /* D25 */ + <6 0 &gpio0 14 0>, /* SCK */ + <7 0 &gpio0 15 0>, /* MOSI */ + <8 0 &gpio0 8 0>, /* MISO */ + <9 0 &gpio0 1 0>, /* RX */ + <10 0 &gpio0 0 0>, /* TX */ + <11 0 &gpio0 4 0>, /* D4 */ + <12 0 &gpio0 2 0>, /* SDA */ + <13 0 &gpio0 3 0>, /* SCL */ + <14 0 &gpio0 5 0>, /* D5 */ + <15 0 &gpio0 6 0>, /* D6 */ + <16 0 &gpio0 9 0>, /* D9 */ + <17 0 &gpio0 10 0>, /* D10 */ + <18 0 &gpio0 11 0>, /* D11 */ + <19 0 &gpio0 12 0>, /* D12 */ + <20 0 &gpio0 13 0>; /* D13 */ + }; +}; + +feather_serial: &uart0 {}; +feather_i2c: &i2c1 {}; +feather_spi: &spi1 {};