Skip to content

Commit

Permalink
board: Add support for Adafruit QT PY RP2040
Browse files Browse the repository at this point in the history
Adding support for the Adafruit QT PY RP2040.

Signed-off-by: Kelly Helmut Lord <[email protected]>
Signed-off-by: Ian Wakely <[email protected]>
  • Loading branch information
hlord2000 authored and carlescufi committed Dec 22, 2023
1 parent 2052e9f commit eb12e54
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 0 deletions.
6 changes: 6 additions & 0 deletions boards/arm/adafruit_qt_py_rp2040/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2022 Kelly Lord
# SPDX-License-Identifier: Apache-2.0

config BOARD_ADAFRUIT_QT_PY_RP2040
bool "Adafruit QT Py RP2040 Board"
depends on SOC_RP2040
22 changes: 22 additions & 0 deletions boards/arm/adafruit_qt_py_rp2040/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2022 Peter Johanson
# SPDX-License-Identifier: Apache-2.0

if BOARD_ADAFRUIT_QT_PY_RP2040

config BOARD
default "adafruit_qt_py_rp2040"

config RP2_FLASH_W25Q080
default y

if I2C_DW

config I2C_DW_CLOCK_SPEED
default 125

endif #I2C_DW

config USB_SELF_POWERED
default n

endif # BOARD_ADAFRUIT_QT_PY_RP2040
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2021, Yonatan Schachter
* Copyright (c) 2022, Peter Johanson
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>

&pinctrl {
uart1_default: uart1_default {
group1 {
pinmux = <UART1_TX_P20>;
};
group2 {
pinmux = <UART1_RX_P5>;
input-enable;
};
};

i2c0_default: i2c0_default {
group1 {
pinmux = <I2C0_SDA_P24>;
input-enable;
};
group2 {
pinmux = <I2C0_SCL_P25>;
input-enable;
};
};

i2c1_default: i2c1_default {
group1 {
pinmux = <I2C1_SDA_P22>;
input-enable;
};
group2 {
pinmux = <I2C1_SCL_P23>;
input-enable;
};
};

spi0_default: spi0_default {
group1 {
pinmux = <SPI0_TX_P3>;
};
group2 {
pinmux = <SPI0_RX_P4>;
input-enable;
};
group3 {
pinmux = <SPI0_SCK_P6>;
};
};

adc_default: adc_default {
group1 {
pinmux = <ADC_CH0_P26>, <ADC_CH1_P27>, <ADC_CH2_P28>, <ADC_CH3_P29>;
input-enable;
};
};

clocks_default: clocks_default {
};
};
119 changes: 119 additions & 0 deletions boards/arm/adafruit_qt_py_rp2040/adafruit_qt_py_rp2040.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* Copyright (c) 2021 Yonatan Schachter
* Copyright (c) 2022 Peter Johanson
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <rpi_pico/rp2040.dtsi>
#include "adafruit_qt_py_rp2040-pinctrl.dtsi"
#include "seeed_xiao_connector.dtsi"
#include <freq.h>

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

aliases {
watchdog0 = &wdt0;
};
};

&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 8MB minus the 0x100 bytes taken by the bootloader.
*/
code_partition: partition@100 {
label = "code-partition";
reg = <0x100 (DT_SIZE_M(8) - 0x100)>;
read-only;
};
};
};

&clocks {
pinctrl-0 = <&clocks_default>;
pinctrl-names = "default";
};

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

&gpio0 {
status = "okay";
};

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

&i2c1 {
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
};

&spi0 {
clock-frequency = <DT_FREQ_M(8)>;
status = "okay";
pinctrl-0 = <&spi0_default>;
pinctrl-names = "default";
};

&timer {
status = "okay";
};

&wdt0 {
status = "okay";
};

&adc {
status = "okay";
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
};

&pio0 {
status = "okay";
};

zephyr_udc0: &usbd {
status = "okay";
};

&vreg {
regulator-always-on;
regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>;
};
23 changes: 23 additions & 0 deletions boards/arm/adafruit_qt_py_rp2040/adafruit_qt_py_rp2040.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
identifier: adafruit_qt_py_rp2040
name: Adafruit QT Py RP2040
type: mcu
arch: arm
flash: 8192
ram: 264
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- uart
- gpio
- adc
- i2c
- spi
- hwinfo
- watchdog
- pwm
- flash
- dma
- counter
- clock
27 changes: 27 additions & 0 deletions boards/arm/adafruit_qt_py_rp2040/adafruit_qt_py_rp2040_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_RP2XXX=y
CONFIG_SOC_RP2040=y
CONFIG_BOARD_ADAFRUIT_QT_PY_RP2040=y

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000

# enable uart driver
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable reset by default
CONFIG_RESET=y

# Enable clock control by default
CONFIG_CLOCK_CONTROL=y

# Code partition needed to target the correct flash range
CONFIG_USE_DT_CODE_PARTITION=y

# Output UF2 by default, native bootloader supports it.
CONFIG_BUILD_OUTPUT_UF2=y
6 changes: 6 additions & 0 deletions boards/arm/adafruit_qt_py_rp2040/board.cmake
Original file line number Diff line number Diff line change
@@ -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)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eb12e54

Please sign in to comment.