diff --git a/app/boards/arm/adafruit_feather_nrf52840/CMakeLists.txt b/app/boards/arm/adafruit_feather_nrf52840/CMakeLists.txt new file mode 100644 index 00000000..42d4786d --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/CMakeLists.txt @@ -0,0 +1,9 @@ + +set_property(GLOBAL APPEND PROPERTY extra_post_build_commands +COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py +-c +-b 0x26000 +-f 0xADA52840 +-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2 +${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin +) \ No newline at end of file diff --git a/app/boards/arm/adafruit_feather_nrf52840/Kconfig b/app/boards/arm/adafruit_feather_nrf52840/Kconfig new file mode 100644 index 00000000..7367f2b9 --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/Kconfig @@ -0,0 +1,10 @@ +# Adafruit Feather nRF52840 Express board configuration + +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on BOARD_ADAFRUIT_FEATHER_NRF52840 diff --git a/app/boards/arm/adafruit_feather_nrf52840/Kconfig.board b/app/boards/arm/adafruit_feather_nrf52840/Kconfig.board new file mode 100644 index 00000000..5649de91 --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/Kconfig.board @@ -0,0 +1,8 @@ +# Adafruit Feather nRF52840 Express board configuration + +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config BOARD_ADAFRUIT_FEATHER_NRF52840 + bool "Adafruit Feather nRF52840 Express" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/adafruit_feather_nrf52840/Kconfig.defconfig b/app/boards/arm/adafruit_feather_nrf52840/Kconfig.defconfig new file mode 100644 index 00000000..34ef74f1 --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/Kconfig.defconfig @@ -0,0 +1,33 @@ +# Adafruit Feather nRF52840 Express board configuration + +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if BOARD_ADAFRUIT_FEATHER_NRF52840 + +config BOARD + default "adafruit_feather_nrf52840" + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +config BT_CTLR + default BT + +config ZMK_BLE + default y + +config ZMK_USB + default y + +config ZMK_BATTERY_VOLTAGE_DIVIDER + default y + +endif # BOARD_ADAFRUIT_FEATHER_NRF52840 diff --git a/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.dts b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.dts new file mode 100644 index 00000000..b875749d --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.dts @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2021 The ZMK Contributors +* +* SPDX-License-Identifier: MIT + */ + + /dts-v1/; + #include + #include "feather_connector.dtsi" + + / { + model = "Adafruit Feather nRF52840 Express ZMK"; + compatible = "adafruit,feather-nrf52840-zmk"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &cdc_acm_uart; + zmk,battery = &vbatt; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio1 15 0>; + label = "Red LED"; + }; + blue_led: led_1 { + gpios = <&gpio1 10 0>; + label = "Blue LED"; + }; + }; + + vbatt: vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "VBATT"; + io-channels = <&adc 5>; + output-ohms = <100000>; + full-ohms = <(100000 + 100000)>; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + led1 = &blue_led; + }; + }; + + &adc { + status = "okay"; + }; + + &gpiote { + status = "okay"; + }; + + &gpio0 { + status = "okay"; + }; + + &gpio1 { + status = "okay"; + }; + + &uart0 { + compatible = "nordic,nrf-uart"; + current-speed = <115200>; + status = "okay"; + tx-pin = <25>; + rx-pin = <24>; + }; + + &i2c0 { + status = "okay"; + sda-pin = <12>; + scl-pin = <11>; + }; + + &spi1 { + compatible = "nordic,nrf-spi"; + status = "okay"; + sck-pin = <14>; + mosi-pin = <13>; + miso-pin = <15>; + }; + + &qspi { + status = "okay"; + sck-pin = <19>; + io-pins = <17>, <22>, <23>, <21>; + csn-pins = <20>; + gd25q16: gd25q16@0 { + compatible = "nordic,qspi-nor"; + reg = <0>; + writeoc = "pp4io"; + readoc = "read4io"; + sck-frequency = <16000000>; + label = "GD25Q16"; + jedec-id = [c8 40 15]; + size = <16777216>; + has-dpd; + t-enter-dpd = <20000>; + t-exit-dpd = <20000>; + }; + }; + + &flash0 { + /* + * For more information, see: + * https://docs.zephyrproject.org/latest/guides/dts/legacy-macros.html#legacy-flash-partitions + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + sd_partition: partition@0 { + label = "softdevice"; + reg = <0x00000000 0x00026000>; + }; + code_partition: partition@26000 { + label = "code_partition"; + reg = <0x00026000 0x000c6000>; + }; + + /* + * The flash starting at 0x000ec000 and ending at + * 0x000f3fff is reserved for use by the application. + */ + + /* + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@ec000 { + label = "storage"; + reg = <0x000ec000 0x00008000>; + }; + + boot_partition: partition@f4000 { + label = "adafruit_boot"; + reg = <0x000f4000 0x0000c000>; + }; + }; + }; + + &usbd { + /*compatible = "nordic,nrf-usbd";*/ + status = "okay"; + cdc_acm_uart: cdc_acm_uart { + compatible = "zephyr,cdc-acm-uart"; + label = "CDC_ACM_0"; + }; + }; diff --git a/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.yaml b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.yaml new file mode 100644 index 00000000..50fe9d3a --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.yaml @@ -0,0 +1,19 @@ +identifier: adafruit_feather_nrf52840 +name: Adafruit Feather nRF52840 Express +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - usb_cdc + - ble + - ieee802154 + - watchdog + - counter + - feather_serial + - feather_i2c + - feather_spi diff --git a/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.zmk.yml b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.zmk.yml new file mode 100644 index 00000000..73a35902 --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.zmk.yml @@ -0,0 +1,8 @@ +identifier: adafruit_feather_nrf52840 +name: Adafruit Feather nRF52840 Express +type: mcu +arch: arm +outputs: + - usb + - ble +url: https://www.adafruit.com/product/4062 \ No newline at end of file diff --git a/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840_defconfig b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840_defconfig new file mode 100644 index 00000000..bdc942b8 --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840_defconfig @@ -0,0 +1,32 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_ADAFRUIT_FEATHER_NRF52840=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +## enable uart driver +#CONFIG_SERIAL=y +# +## enable console +#CONFIG_CONSOLE=y +#CONFIG_UART_CONSOLE=y +# +## additional board options +#CONFIG_GPIO_AS_PINRESET=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y +CONFIG_BUILD_OUTPUT_UF2=y diff --git a/app/boards/arm/adafruit_feather_nrf52840/board.cmake b/app/boards/arm/adafruit_feather_nrf52840/board.cmake new file mode 100644 index 00000000..3d64fafd --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/board.cmake @@ -0,0 +1,13 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# board_runner_args(jlink "--device=nrf52" "--speed=4000") +# board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000") +# board_runner_args(blackmagicprobe "--gdb-serial=/dev/ttyBmpGdb") +# include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +# include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) +# include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) + +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") +include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/app/boards/arm/adafruit_feather_nrf52840/feather_connector.dtsi b/app/boards/arm/adafruit_feather_nrf52840/feather_connector.dtsi new file mode 100644 index 00000000..24cc0a12 --- /dev/null +++ b/app/boards/arm/adafruit_feather_nrf52840/feather_connector.dtsi @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2021 The ZMK Contributors +* +* SPDX-License-Identifier: MIT + */ + +/ { + 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 4 0>, /* A0 */ + <1 0 &gpio0 5 0>, /* A1 */ + <2 0 &gpio0 30 0>, /* A2 */ + <3 0 &gpio0 28 0>, /* A3 */ + <4 0 &gpio0 2 0>, /* A4 */ + <5 0 &gpio0 3 0>, /* A5 */ + <6 0 &gpio0 14 0>, /* SCK */ + <7 0 &gpio0 13 0>, /* MOSI */ + <8 0 &gpio0 15 0>, /* MISO */ + <9 0 &gpio0 24 0>, /* RXD */ + <10 0 &gpio0 25 0>, /* TXD */ + <11 0 &gpio0 10 0>, /* D2 (NFC2) */ + <12 0 &gpio0 12 0>, /* SDA */ + <13 0 &gpio0 11 0>, /* SCL */ + <14 0 &gpio1 8 0>, /* D5 */ + <15 0 &gpio0 7 0>, /* D6 */ + <16 0 &gpio0 26 0>, /* D9 */ + <17 0 &gpio0 27 0>, /* D10 */ + <18 0 &gpio0 6 0>, /* D11 */ + <19 0 &gpio0 8 0>, /* D12 */ + <20 0 &gpio1 9 0>; /* D13 */ + }; +}; + +feather_serial: &uart0 {}; +feather_i2c: &i2c0 {}; +feather_spi: &spi1 {};