From 1b1bcdab83491f4e1d27a8dabc3d75f0f226c92e Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Fri, 25 Oct 2024 15:21:21 -0500 Subject: [PATCH 01/34] Create Kconfig.board --- app/boards/arm/waveshare_rp2040_zero/Kconfig.board | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/Kconfig.board diff --git a/app/boards/arm/waveshare_rp2040_zero/Kconfig.board b/app/boards/arm/waveshare_rp2040_zero/Kconfig.board new file mode 100644 index 00000000000..e559c7140b9 --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_WAVESHARE_RP2040_ZERO + bool "Waveshare RP2040 Zero Board" + depends on SOC_RP2040 From d599620d6dbb80d9cd2cc70942a0558e21e2d6e5 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Fri, 25 Oct 2024 15:22:05 -0500 Subject: [PATCH 02/34] Create Kconfig.defconfig --- .../arm/waveshare_rp2040_zero/Kconfig.defconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig diff --git a/app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig b/app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig new file mode 100644 index 00000000000..31d7020fdd7 --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_WAVESHARE_RP2040_ZERO + +config BOARD + default "waveshare_rp2040_zero" + +config RP2_FLASH_W25Q080 + default y + +config ZMK_USB + default y + +endif # BOARD_WAVESHARE_RP2040_ZERO From 76d43a378a75c2a6d73cafd6e7c67b539bbd1bbc Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Fri, 25 Oct 2024 15:23:27 -0500 Subject: [PATCH 03/34] Create waveshare_rp2040_zero_pinctrl.dtsi --- .../waveshare_rp2040_zero_pinctrl.dtsi | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi new file mode 100644 index 00000000000..98c74f51e9f --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart1_default: uart0_default { + group1 { + pinmux = ; + }; + group2 { + pinmux = ; + input-enable; + }; + }; + + i2c1_default: i2c1_default { + group1 { + pinmux = , ; + input-enable; + input-schmitt-enable; + }; + }; + + + spi0_default: spi0_default { + group1 { + pinmux = , ; + }; + group2 { + pinmux = ; + input-enable; + }; + }; +}; From 166c20143931a9af1e7bfd5b86b4d39dd56a9e81 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Fri, 25 Oct 2024 15:24:39 -0500 Subject: [PATCH 04/34] Create waveshare_rp2040_zero.dts --- .../waveshare_rp2040_zero.dts | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts new file mode 100644 index 00000000000..c795fbef286 --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "waveshare_rp2040_zero-pinctrl.dtsi" +#include + +/ { + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &uart0; + zephyr,code-partition = &code_partition; + }; + + xtal_clk: xtal-clk { + compatible = "fixed-clock"; + clock-frequency = <12000000>; + #clock-cells = <0>; + }; + +}; + +&flash0 { + /* 2MB of flash minus the 0x100 used for + * the second stage bootloader + */ + reg = <0x10000000 DT_SIZE_M(2)>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* + * Start at the beginning of usable flash, 8MB minus the + * second stage space and the 16 KiB reserved for settings + */ + code_partition: partition@100 { + label = "code"; + reg = <0x100 (DT_SIZE_M(2) - DT_SIZE_K(16))>; + read-only; + }; + + /* + * The final 16 KiB is reserved for the application. + * Storage partition may be used by FCB or LittleFS. + */ + storage_partition: partition@7fbe00 { + label = "storage"; + reg = <0x007fbe00 DT_SIZE_K(16)>; + }; + }; +}; + +&uart1 { + current-speed = <115200>; + status = "okay"; + pinctrl-0 = <&uart1_default>; + pinctrl-names = "default"; +}; + +&spi0 { + status = "okay"; + pinctrl-0 = <&spi0_default>; + pinctrl-names = "default"; + clock-frequency = ; +}; + +&i2c1 { + status = "okay"; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; + clock-frequency = ; +}; + +&gpio0 { + status = "okay"; +}; + +zephyr_udc0: &usbd { + status = "okay"; +}; From 53666ee292da43b6a08e308f039e185959b3a0dd Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Fri, 25 Oct 2024 15:25:30 -0500 Subject: [PATCH 05/34] Create waveshare_rp2040_zero.zmk.yml --- .../waveshare_rp2040_zero.zmk.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml new file mode 100644 index 00000000000..1513386034a --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml @@ -0,0 +1,12 @@ +identifier: waveshare_rp2040_zero +name: RP2040-Zero +type: mcu +arch: arm +flash: 2048 +ram: 264 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - serial From 988090d2e9421f027c6f6a492a429a867d60aa5f Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Fri, 25 Oct 2024 15:26:20 -0500 Subject: [PATCH 06/34] Create waveshare_rp2040_zero_defconfig --- .../waveshare_rp2040_zero_defconfig | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig new file mode 100644 index 00000000000..e51e6d0a84a --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_RP2XXX=y +CONFIG_SOC_RP2040=y +CONFIG_BOARD_WAVESHARE_RP2040_ZERO=y + +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=240000000 + +# Enable GPIO +CONFIG_GPIO=y + +# enable uart driver +CONFIG_SERIAL=n + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=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 From 58eb6d034f766e939abd21dd9d59cbe89a359483 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Fri, 25 Oct 2024 16:33:52 -0500 Subject: [PATCH 07/34] Update waveshare_rp2040_zero.dts --- app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index c795fbef286..4f5099fee17 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -7,7 +7,7 @@ /dts-v1/; #include -#include "waveshare_rp2040_zero-pinctrl.dtsi" +#include "waveshare_rp2040_zero_pinctrl.dtsi" #include / { From 4ca0c62fac956fef145392a3d55a36758347bcc4 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Sat, 26 Oct 2024 12:49:57 -0500 Subject: [PATCH 08/34] Create waveshare_rp2040_zero.yaml --- .../waveshare_rp2040_zero/waveshare_rp2040_zero.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml new file mode 100644 index 00000000000..1513386034a --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml @@ -0,0 +1,12 @@ +identifier: waveshare_rp2040_zero +name: RP2040-Zero +type: mcu +arch: arm +flash: 2048 +ram: 264 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - serial From 4987bf50fad2e4c2dff2e563d3d0c028d738365a Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Mon, 28 Oct 2024 16:08:12 -0500 Subject: [PATCH 09/34] Update waveshare_rp2040_zero.zmk.yml --- .../waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml index 1513386034a..6f7d41a980e 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml @@ -1,6 +1,7 @@ -identifier: waveshare_rp2040_zero +file_format: "1" +id: waveshare_rp2040_zero name: RP2040-Zero -type: mcu +type: board arch: arm flash: 2048 ram: 264 @@ -10,3 +11,6 @@ toolchain: - xtools supported: - serial +outputs: + - usb +exposes: [waveshare_rp2040_zero] From 12f8ef2dbeec8649a642750ca1e7d38d0a7988b0 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 29 Oct 2024 14:33:08 -0500 Subject: [PATCH 10/34] Update waveshare_rp2040_zero.dts --- .../waveshare_rp2040_zero.dts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index 4f5099fee17..15dd36e8b20 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -12,10 +12,9 @@ / { chosen { - zephyr,sram = &sram0; - zephyr,flash = &flash0; - zephyr,console = &uart0; - zephyr,code-partition = &code_partition; + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; }; xtal_clk: xtal-clk { @@ -58,11 +57,12 @@ }; }; -&uart1 { - current-speed = <115200>; - status = "okay"; - pinctrl-0 = <&uart1_default>; - pinctrl-names = "default"; +&uart0 { + compatible = "nordic,nrf-uarte"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-1 = <&uart0_sleep>; + pinctrl-names = "default", "sleep"; }; &spi0 { From 8fe6ea0be557cbb05495c5f2724467da914e4e44 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 29 Oct 2024 14:39:51 -0500 Subject: [PATCH 11/34] Update waveshare_rp2040_zero.dts --- .../arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index 15dd36e8b20..c21341d96a8 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -57,11 +57,11 @@ }; }; -&uart0 { +&uart1 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-1 = <&uart0_sleep>; + pinctrl-0 = <&uart1_default>; + pinctrl-1 = <&uart1_sleep>; pinctrl-names = "default", "sleep"; }; From 61c28723cedeb9f8d5e484a6707b7f209c3fb621 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 29 Oct 2024 14:51:29 -0500 Subject: [PATCH 12/34] Update waveshare_rp2040_zero.dts --- .../arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index c21341d96a8..04a722891f7 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -58,11 +58,9 @@ }; &uart1 { - compatible = "nordic,nrf-uarte"; current-speed = <115200>; pinctrl-0 = <&uart1_default>; - pinctrl-1 = <&uart1_sleep>; - pinctrl-names = "default", "sleep"; + pinctrl-names = "default"; }; &spi0 { From a4dcb6bc7a94c9fbf4243108905f722fc64082d9 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 29 Oct 2024 15:02:44 -0500 Subject: [PATCH 13/34] Update waveshare_rp2040_zero.dts --- .../waveshare_rp2040_zero.dts | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index 04a722891f7..b02e72bb7b6 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -11,17 +11,17 @@ #include / { - chosen { - zephyr,code-partition = &code_partition; - zephyr,sram = &sram0; - zephyr,flash = &flash0; - }; + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; - xtal_clk: xtal-clk { - compatible = "fixed-clock"; - clock-frequency = <12000000>; - #clock-cells = <0>; - }; + xtal_clk: xtal-clk { + compatible = "fixed-clock"; + clock-frequency = <12000000>; + #clock-cells = <0>; + }; }; @@ -64,23 +64,21 @@ }; &spi0 { - status = "okay"; - pinctrl-0 = <&spi0_default>; - pinctrl-names = "default"; - clock-frequency = ; + pinctrl-0 = <&spi0_default>; + pinctrl-names = "default"; + clock-frequency = ; }; &i2c1 { - status = "okay"; - pinctrl-0 = <&i2c1_default>; - pinctrl-names = "default"; - clock-frequency = ; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; + clock-frequency = ; }; &gpio0 { - status = "okay"; + status = "okay"; }; zephyr_udc0: &usbd { - status = "okay"; + status = "okay"; }; From cf23128808bfa30d38df58e83c6886397ddde3b0 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 29 Oct 2024 15:06:46 -0500 Subject: [PATCH 14/34] Update waveshare_rp2040_zero.zmk.yml --- .../waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml index 6f7d41a980e..433500ee448 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.zmk.yml @@ -3,14 +3,7 @@ id: waveshare_rp2040_zero name: RP2040-Zero type: board arch: arm -flash: 2048 -ram: 264 -toolchain: - - zephyr - - gnuarmemb - - xtools -supported: - - serial outputs: - usb +url: https://www.waveshare.com/rp2040-zero.htm exposes: [waveshare_rp2040_zero] From 1d4e66581fa5bb6bfd12bafba3b32e58abc6c9b1 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 29 Oct 2024 15:16:14 -0500 Subject: [PATCH 15/34] Update waveshare_rp2040_zero_defconfig --- .../arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig index e51e6d0a84a..a0ee894ebb7 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig @@ -5,7 +5,7 @@ CONFIG_SOC_SERIES_RP2XXX=y CONFIG_SOC_RP2040=y CONFIG_BOARD_WAVESHARE_RP2040_ZERO=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=240000000 +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 # Enable GPIO CONFIG_GPIO=y From 6c327cceb873c6c769ccff34fbaf6cf0a3270712 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Wed, 30 Oct 2024 01:49:10 -0500 Subject: [PATCH 16/34] Update Kconfig.defconfig --- app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig b/app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig index 31d7020fdd7..57147815a6f 100644 --- a/app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig +++ b/app/boards/arm/waveshare_rp2040_zero/Kconfig.defconfig @@ -4,12 +4,12 @@ if BOARD_WAVESHARE_RP2040_ZERO config BOARD - default "waveshare_rp2040_zero" + default "waveshare_rp2040_zero" config RP2_FLASH_W25Q080 - default y + default y config ZMK_USB - default y + default y endif # BOARD_WAVESHARE_RP2040_ZERO From 91b7e7b1b1587e08850bfa7fd26dc08bb55dbdde Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Wed, 30 Oct 2024 01:49:55 -0500 Subject: [PATCH 17/34] Update Kconfig.board --- app/boards/arm/waveshare_rp2040_zero/Kconfig.board | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/Kconfig.board b/app/boards/arm/waveshare_rp2040_zero/Kconfig.board index e559c7140b9..3cdfe814cb4 100644 --- a/app/boards/arm/waveshare_rp2040_zero/Kconfig.board +++ b/app/boards/arm/waveshare_rp2040_zero/Kconfig.board @@ -2,5 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_WAVESHARE_RP2040_ZERO - bool "Waveshare RP2040 Zero Board" - depends on SOC_RP2040 + bool "Waveshare RP2040 Zero Board" + depends on SOC_RP2040 From 9ec0dad1391e8df131a33ac0106cd439c83e5a4f Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Wed, 30 Oct 2024 01:57:14 -0500 Subject: [PATCH 18/34] Update waveshare_rp2040_zero.dts --- .../waveshare_rp2040_zero.dts | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index b02e72bb7b6..b18bf6cbd05 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,8 +1,5 @@ -/* - * Copyright (c) 2024 The ZMK Contributors - * - * SPDX-License-Identifier: Apache-2.0 - */ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 /dts-v1/; @@ -26,35 +23,35 @@ }; &flash0 { - /* 2MB of flash minus the 0x100 used for - * the second stage bootloader - */ - reg = <0x10000000 DT_SIZE_M(2)>; + /* 2MB of flash minus the 0x100 used for + * the second stage bootloader + */ + reg = <0x10000000 DT_SIZE_M(2)>; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; - /* - * Start at the beginning of usable flash, 8MB minus the - * second stage space and the 16 KiB reserved for settings - */ - code_partition: partition@100 { - label = "code"; - reg = <0x100 (DT_SIZE_M(2) - DT_SIZE_K(16))>; - read-only; - }; + /* + * Start at the beginning of usable flash, 8MB minus the + * second stage space and the 16 KiB reserved for settings + */ + code_partition: partition@100 { + label = "code"; + reg = <0x100 (DT_SIZE_M(2) - DT_SIZE_K(16))>; + read-only; + }; - /* - * The final 16 KiB is reserved for the application. - * Storage partition may be used by FCB or LittleFS. - */ - storage_partition: partition@7fbe00 { - label = "storage"; - reg = <0x007fbe00 DT_SIZE_K(16)>; - }; + /* + * The final 16 KiB is reserved for the application. + * Storage partition may be used by FCB or LittleFS. + */ + storage_partition: partition@7fbe00 { + label = "storage"; + reg = <0x007fbe00 DT_SIZE_K(16)>; }; + }; }; &uart1 { From 19007c8d1cb6289495bc75c42a2885150c27261b Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Wed, 30 Oct 2024 02:02:01 -0500 Subject: [PATCH 19/34] Update waveshare_rp2040_zero_pinctrl.dtsi --- .../waveshare_rp2040_zero_pinctrl.dtsi | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi index 98c74f51e9f..14ca5a4f747 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi @@ -1,37 +1,34 @@ -/* - * Copyright (c) 2024 The ZMK Contributors - * SPDX-License-Identifier: Apache-2.0 - */ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 #include &pinctrl { - uart1_default: uart0_default { - group1 { - pinmux = ; - }; - group2 { - pinmux = ; - input-enable; - }; + uart1_default: uart0_default { + group1 { + pinmux = ; }; - - i2c1_default: i2c1_default { - group1 { - pinmux = , ; - input-enable; - input-schmitt-enable; - }; + group2 { + pinmux = ; + input-enable; }; + }; + i2c1_default: i2c1_default { + group1 { + pinmux = , ; + input-enable; + input-schmitt-enable; + }; + }; - spi0_default: spi0_default { - group1 { - pinmux = , ; - }; - group2 { - pinmux = ; - input-enable; - }; + spi0_default: spi0_default { + group1 { + pinmux = , ; + }; + group2 { + pinmux = ; + input-enable; }; + }; }; From 6519b4ce67e813065f15ee29fce66eaeb976b875 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 12:09:24 -0500 Subject: [PATCH 20/34] Update waveshare_rp2040_zero.dts --- app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index b18bf6cbd05..3a7d855fa05 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,6 +1,3 @@ -# Copyright (c) 2024 The ZMK Contributors -# SPDX-License-Identifier: Apache-2.0 - /dts-v1/; #include From 4fa362dad7e8472b9b3648d1237802dc32a39afb Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 12:15:14 -0500 Subject: [PATCH 21/34] Update waveshare_rp2040_zero.dts --- app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index 3a7d855fa05..b18bf6cbd05 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 + /dts-v1/; #include From 5420a2845d847142b266f639eb636e53b488789d Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 12:29:11 -0500 Subject: [PATCH 22/34] Update waveshare_rp2040_zero.dts --- app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index b18bf6cbd05..3a7d855fa05 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,6 +1,3 @@ -# Copyright (c) 2024 The ZMK Contributors -# SPDX-License-Identifier: Apache-2.0 - /dts-v1/; #include From 75003c3a0a3dd072da45f77d4fc911d163f34e24 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 12:49:50 -0500 Subject: [PATCH 23/34] Update waveshare_rp2040_zero.dts --- app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index 3a7d855fa05..b18bf6cbd05 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The ZMK Contributors +# SPDX-License-Identifier: Apache-2.0 + /dts-v1/; #include From b8d0b9bf1341fc1322ad6b8489efdcdb875675f8 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 12:56:48 -0500 Subject: [PATCH 24/34] Update waveshare_rp2040_zero.dts --- app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index b18bf6cbd05..66d661b5c10 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,7 +1,9 @@ # Copyright (c) 2024 The ZMK Contributors # SPDX-License-Identifier: Apache-2.0 +/* /dts-v1/; +*/ #include #include "waveshare_rp2040_zero_pinctrl.dtsi" From b53d15eee85dee2c8106690003f52e202c7b7a81 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 13:29:40 -0500 Subject: [PATCH 25/34] Create board.cmake --- app/boards/arm/waveshare_rp2040_zero/board.cmake | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/boards/arm/waveshare_rp2040_zero/board.cmake diff --git a/app/boards/arm/waveshare_rp2040_zero/board.cmake b/app/boards/arm/waveshare_rp2040_zero/board.cmake new file mode 100644 index 00000000000..746f15aa2b0 --- /dev/null +++ b/app/boards/arm/waveshare_rp2040_zero/board.cmake @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) From d40bd0fa2a32e75733170d4ab55222989f137f66 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 13:29:59 -0500 Subject: [PATCH 26/34] Update board.cmake --- app/boards/arm/waveshare_rp2040_zero/board.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/app/boards/arm/waveshare_rp2040_zero/board.cmake b/app/boards/arm/waveshare_rp2040_zero/board.cmake index 746f15aa2b0..22538b675f0 100644 --- a/app/boards/arm/waveshare_rp2040_zero/board.cmake +++ b/app/boards/arm/waveshare_rp2040_zero/board.cmake @@ -1,3 +1,4 @@ +# Copyright (c) 2024 The ZMK Contributors # SPDX-License-Identifier: Apache-2.0 include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) From fa56a22bea79c130b32816af20db6615a8a6f5f1 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 13:40:03 -0500 Subject: [PATCH 27/34] Update waveshare_rp2040_zero.dts --- .../waveshare_rp2040_zero.dts | 83 +++++++++++++++++-- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index 66d661b5c10..6743837e134 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,15 +1,19 @@ # Copyright (c) 2024 The ZMK Contributors # SPDX-License-Identifier: Apache-2.0 -/* /dts-v1/; -*/ #include #include "waveshare_rp2040_zero_pinctrl.dtsi" #include +#include + / { + model = "Waveshare RP2040 Zero Board"; + compatible = "waveshare,rp2040-zero", "raspberrypi,rp2040"; + + chosen { zephyr,code-partition = &code_partition; zephyr,sram = &sram0; @@ -22,8 +26,52 @@ #clock-cells = <0>; }; + aliases { + watchdog0 = &wdt0; + }; + + + zero_header: connector { + compatible = "raspberrypi,pico-header"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpio0 0 0>, /* GP0 */ + <1 0 &gpio0 1 0>, /* GP1 */ + <2 0 &gpio0 2 0>, /* GP2 */ + <3 0 &gpio0 3 0>, /* GP3 */ + <4 0 &gpio0 4 0>, /* GP4 */ + <5 0 &gpio0 5 0>, /* GP5 */ + <6 0 &gpio0 6 0>, /* GP6 */ + <7 0 &gpio0 7 0>, /* GP7 */ + <8 0 &gpio0 8 0>, /* GP8 */ + <9 0 &gpio0 9 0>, /* GP9 */ + <10 0 &gpio0 10 0>, /* GP10 */ + <11 0 &gpio0 11 0>, /* GP11 */ + <12 0 &gpio0 12 0>, /* GP12 */ + <13 0 &gpio0 13 0>, /* GP13 */ + <14 0 &gpio0 14 0>, /* GP14 */ + <15 0 &gpio0 15 0>, /* GP15 */ + <16 0 &gpio0 16 0>, /* GP16 */ + <17 0 &gpio0 17 0>, /* GP17 */ + <18 0 &gpio0 18 0>, /* GP18 */ + <19 0 &gpio0 19 0>, /* GP19 */ + <20 0 &gpio0 20 0>, /* GP20 */ + <21 0 &gpio0 21 0>, /* GP21 */ + <22 0 &gpio0 22 0>, /* GP22 */ + <23 0 &gpio0 23 0>, /* GP23 */ + <24 0 &gpio0 24 0>, /* GP24 */ + <25 0 &gpio0 25 0>, /* GP25 */ + <26 0 &gpio0 26 0>, /* GP26 */ + <27 0 &gpio0 27 0>, /* GP27 */ + <28 0 &gpio0 28 0>, /* GP28 */ + <29 0 &gpio0 29 0>; /* GP29 */ + }; + }; + + &flash0 { /* 2MB of flash minus the 0x100 used for * the second stage bootloader @@ -56,20 +104,26 @@ }; }; -&uart1 { +&uart0 { current-speed = <115200>; - pinctrl-0 = <&uart1_default>; + pinctrl-0 = <&uart0_default>; pinctrl-names = "default"; }; &spi0 { pinctrl-0 = <&spi0_default>; pinctrl-names = "default"; - clock-frequency = ; + clock-frequency = ; +}; + +&adc { + status = "okay"; + pinctrl-0 = <&adc_default>; + pinctrl-names = "default"; }; -&i2c1 { - pinctrl-0 = <&i2c1_default>; +&i2c0 { + pinctrl-0 = <&i2c0_default>; pinctrl-names = "default"; clock-frequency = ; }; @@ -78,6 +132,21 @@ status = "okay"; }; +&timer { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + zephyr_udc0: &usbd { status = "okay"; }; + +// &vreg { +// regulator-always-on; +// regulator-allowed-modes = ; +// }; + +// zero_spi: &spi0 {}; From 422cf2b6bc94c829b8aebf0c2c3fa9ea5adc5591 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 13:43:08 -0500 Subject: [PATCH 28/34] Update waveshare_rp2040_zero_pinctrl.dtsi --- .../waveshare_rp2040_zero_pinctrl.dtsi | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi index 14ca5a4f747..fe14349b36e 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi @@ -4,19 +4,19 @@ #include &pinctrl { - uart1_default: uart0_default { + uart0_default: uart0_default { group1 { - pinmux = ; + pinmux = ; }; group2 { - pinmux = ; + pinmux = ; input-enable; }; }; - i2c1_default: i2c1_default { + i2c0_default: i2c0_default { group1 { - pinmux = , ; + pinmux = , ; input-enable; input-schmitt-enable; }; @@ -24,10 +24,17 @@ spi0_default: spi0_default { group1 { - pinmux = , ; + pinmux = , , ; }; group2 { - pinmux = ; + pinmux = ; + input-enable; + }; + }; + + adc_default: adc_default { + group1 { + pinmux = , , , ; input-enable; }; }; From d83ec618283d31745dcc556b49950466fdf35932 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 13:44:15 -0500 Subject: [PATCH 29/34] Update waveshare_rp2040_zero_defconfig --- .../arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig index a0ee894ebb7..8435fb4b525 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig @@ -11,7 +11,7 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_GPIO=y # enable uart driver -CONFIG_SERIAL=n +CONFIG_SERIAL=y # enable console CONFIG_CONSOLE=y From 015b11f7a2002742ae19dcec0431c92472f2f171 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 13:45:03 -0500 Subject: [PATCH 30/34] Update waveshare_rp2040_zero.yaml --- .../waveshare_rp2040_zero/waveshare_rp2040_zero.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml index 1513386034a..58e7b40f8e8 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.yaml @@ -9,4 +9,13 @@ toolchain: - gnuarmemb - xtools supported: - - serial + - uart + - gpio + - adc + - i2c + - spi + - hwinfo + - watchdog + - flash + - dma + - counter From fc5f4003849c8dfb870faaacf0d8848c66564331 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 16:05:03 -0500 Subject: [PATCH 31/34] Update waveshare_rp2040_zero.dts --- app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index 6743837e134..e9661a9582d 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -1,6 +1,3 @@ -# Copyright (c) 2024 The ZMK Contributors -# SPDX-License-Identifier: Apache-2.0 - /dts-v1/; #include From 779d371ac7ce90afd10b2d0feb04ab35d122087e Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Thu, 31 Oct 2024 16:14:46 -0500 Subject: [PATCH 32/34] Update waveshare_rp2040_zero_pinctrl.dtsi --- .../waveshare_rp2040_zero_pinctrl.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi index fe14349b36e..eef61332e53 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_pinctrl.dtsi @@ -1,5 +1,7 @@ -# Copyright (c) 2024 The ZMK Contributors -# SPDX-License-Identifier: Apache-2.0 +/* + Copyright (c) 2024 The ZMK Contributors + SPDX-License-Identifier: Apache-2.0 +*/ #include From 7f1550a73c7d76b37917112900de768b676132b8 Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 12 Nov 2024 08:38:38 -0600 Subject: [PATCH 33/34] Update waveshare_rp2040_zero_defconfig --- .../arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig index 8435fb4b525..079bfc6c2a1 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero_defconfig @@ -6,12 +6,14 @@ CONFIG_SOC_RP2040=y CONFIG_BOARD_WAVESHARE_RP2040_ZERO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 +CONFIG_RESET=y # Enable GPIO CONFIG_GPIO=y # enable uart driver CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y # enable console CONFIG_CONSOLE=y From ddb4a64d974582e43e7fb36900880bd8398685df Mon Sep 17 00:00:00 2001 From: mike barnoski Date: Tue, 12 Nov 2024 14:20:44 -0600 Subject: [PATCH 34/34] Update waveshare_rp2040_zero.dts --- .../waveshare_rp2040_zero/waveshare_rp2040_zero.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts index e9661a9582d..dc8769d2cbf 100644 --- a/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts +++ b/app/boards/arm/waveshare_rp2040_zero/waveshare_rp2040_zero.dts @@ -17,6 +17,19 @@ zephyr,flash = &flash0; }; + leds { + compatible = "gpio-leds"; + led: led_0 { + gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; + label = "LED"; + }; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led; + }; + xtal_clk: xtal-clk { compatible = "fixed-clock"; clock-frequency = <12000000>;