boards: Add Adafruit Feather nrf52840 Sense

Add support for board based on the Express variant.
Board uses uf2 as it has no swd adaptor.

Signed-off-by: Jacob Winther <jacob@9.nz>
This commit is contained in:
Jacob Winther 2024-07-21 21:03:27 +12:00 committed by Fabio Baltieri
commit b6ed4ba761
15 changed files with 432 additions and 152 deletions

View file

@ -8,4 +8,11 @@ config BOARD_ENABLE_DCDC
bool "DCDC mode" bool "DCDC mode"
select SOC_DCDC_NRF52X select SOC_DCDC_NRF52X
default y default y
depends on BOARD_ADAFRUIT_FEATHER_NRF52840_EXPRESS depends on BOARD_ADAFRUIT_FEATHER_NRF52840_EXPRESS || BOARD_ADAFRUIT_FEATHER_NRF52840_SENSE
if BOARD_ADAFRUIT_FEATHER_NRF52840_SENSE
config BOARD_SERIAL_BACKEND_CDC_ACM
bool "USB CDC"
default y
endif # BOARD_ADAFRUIT_FEATHER_NRF52840_SENSE

View file

@ -0,0 +1,8 @@
# Adafruit Feather nRF52840 Express board configuration
# Copyright (c) 2020 Tobias Svehagen
# Copyright (c) 2024 Jacob Winther
# SPDX-License-Identifier: Apache-2.0
config BOARD_ADAFRUIT_FEATHER_NRF52840_SENSE
select SOC_NRF52840_QIAA

View file

@ -4,9 +4,51 @@
# Copyright (c) 2024 Jacob Winther # Copyright (c) 2024 Jacob Winther
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if BOARD_ADAFRUIT_FEATHER_NRF52840_EXPRESS if (BOARD_ADAFRUIT_FEATHER_NRF52840_EXPRESS || BOARD_ADAFRUIT_FEATHER_NRF52840_SENSE)
config BT_CTLR config BT_CTLR
default BT default BT
endif # BOARD_ADAFRUIT_FEATHER_NRF52840_EXPRESS if BOARD_SERIAL_BACKEND_CDC_ACM
config USB_DEVICE_STACK
default y
config USB_CDC_ACM
default SERIAL
config UART_CONSOLE
default CONSOLE
config USB_DEVICE_INITIALIZE_AT_BOOT
default y if CONSOLE
config SHELL_BACKEND_SERIAL_CHECK_DTR
default SHELL
depends on UART_LINE_CTRL
config UART_LINE_CTRL
default SHELL
config USB_DEVICE_REMOTE_WAKEUP
default n
if LOG
# Logger cannot use itself to log
config USB_CDC_ACM_LOG_LEVEL
default 0
# Set USB log level to error only
config USB_DEVICE_LOG_LEVEL
default 1
# Wait 1500ms at startup for logging
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 1500
endif # LOG
endif # BOARD_SERIAL_BACKEND_CDC_ACM
endif # BOARD_ADAFRUIT_FEATHER_NRF52840_EXPRESS || BOARD_ADAFRUIT_FEATHER_NRF52840_SENSE

View file

@ -0,0 +1,130 @@
/*
* Copyright (c) 2020 Tobias Svehagen
* Copyright (c) 2024 Jacob Winther
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "feather_connector.dtsi"
#include "adafruit_feather_nrf52840-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,ieee802154 = &ieee802154;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
label = "Red LED";
};
led1: led_1 {
gpios = <&gpio1 10 0>;
label = "Blue LED";
};
};
buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio1 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button switch";
zephyr,code = <INPUT_KEY_0>;
};
};
vbatt {
compatible = "voltage-divider";
io-channels = <&adc 5>;
output-ohms = <100000>;
full-ohms = <(100000 + 100000)>;
};
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
led1 = &led1;
sw0 = &button0;
watchdog0 = &wdt0;
};
};
&adc {
status = "okay";
};
&uicr {
gpio-as-nreset;
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uart";
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
pinctrl-0 = <&spi1_default>;
pinctrl-1 = <&spi1_sleep>;
pinctrl-names = "default", "sleep";
};
&qspi {
status = "okay";
pinctrl-0 = <&qspi_default>;
pinctrl-1 = <&qspi_sleep>;
pinctrl-names = "default", "sleep";
gd25q16: gd25q16@0 {
compatible = "nordic,qspi-nor";
reg = <0>;
writeoc = "pp4o";
readoc = "read4io";
sck-frequency = <16000000>;
jedec-id = [ c8 40 15 ];
size = <16777216>;
has-dpd;
t-enter-dpd = <20000>;
t-exit-dpd = <20000>;
quad-enable-requirements = "S2B1v1";
};
};
&ieee802154 {
status = "okay";
};
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};

View file

@ -6,14 +6,12 @@
*/ */
/dts-v1/; /dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "feather_connector.dtsi" #include "adafruit_feather_nrf52840_common.dtsi"
#include "adafruit_feather_nrf52840-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ { / {
model = "Adafruit Feather nRF52840 Express"; model = "Adafruit Feather nRF52840 Express";
compatible = "adafruit,feather-nrf52840-express"; compatible = "adafruit,feather_nrf52840-express";
chosen { chosen {
zephyr,console = &uart0; zephyr,console = &uart0;
@ -21,120 +19,17 @@
zephyr,uart-mcumgr = &uart0; zephyr,uart-mcumgr = &uart0;
zephyr,bt-mon-uart = &uart0; zephyr,bt-mon-uart = &uart0;
zephyr,bt-c2h-uart = &uart0; zephyr,bt-c2h-uart = &uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition; zephyr,code-partition = &slot0_partition;
zephyr,ieee802154 = &ieee802154;
}; };
leds { leds {
compatible = "gpio-leds";
led0: led_0 { led0: led_0 {
gpios = <&gpio1 15 0>; gpios = <&gpio1 15 0>;
label = "Red LED";
};
led1: led_1 {
gpios = <&gpio1 10 0>;
label = "Blue LED";
}; };
}; };
buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio1 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button switch";
zephyr,code = <INPUT_KEY_0>;
};
};
vbatt {
compatible = "voltage-divider";
io-channels = <&adc 5>;
output-ohms = <100000>;
full-ohms = <(100000 + 100000)>;
};
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
led1 = &led1;
sw0 = &button0;
watchdog0 = &wdt0;
};
};
&adc {
status = "okay";
};
&uicr {
gpio-as-nreset;
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uart";
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
pinctrl-0 = <&spi1_default>;
pinctrl-1 = <&spi1_sleep>;
pinctrl-names = "default", "sleep";
};
&qspi {
status = "okay";
pinctrl-0 = <&qspi_default>;
pinctrl-1 = <&qspi_sleep>;
pinctrl-names = "default", "sleep";
gd25q16: gd25q16@0 {
compatible = "nordic,qspi-nor";
reg = <0>;
writeoc = "pp4o";
readoc = "read4io";
sck-frequency = <16000000>;
jedec-id = [c8 40 15];
size = <16777216>;
has-dpd;
t-enter-dpd = <20000>;
t-exit-dpd = <20000>;
quad-enable-requirements = "S2B1v1";
};
};
&ieee802154 {
status = "okay";
}; };
&flash0 { &flash0 {
partitions { partitions {
compatible = "fixed-partitions"; compatible = "fixed-partitions";
#address-cells = <1>; #address-cells = <1>;
@ -169,8 +64,3 @@
}; };
}; };
}; };
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};

View file

@ -1,4 +1,4 @@
identifier: adafruit_feather_nrf52840_express/nrf52840 identifier: adafruit_feather_nrf52840_express
name: Adafruit Feather nRF52840 Express name: Adafruit Feather nRF52840 Express
type: mcu type: mcu
arch: arm arch: arm

View file

@ -0,0 +1,78 @@
/*
* Copyright (c) 2020 Tobias Svehagen
* Copyright (c) 2024 Jacob Winther
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include "adafruit_feather_nrf52840_common.dtsi"
/ {
model = "Adafruit Feather nRF52840 Sense";
compatible = "adafruit,feather_nrf52840-sense";
chosen {
zephyr,console = &cdc_acm_uart0;
zephyr,shell-uart = &cdc_acm_uart0;
zephyr,uart-mcumgr = &cdc_acm_uart0;
zephyr,bt-mon-uart = &cdc_acm_uart0;
zephyr,bt-c2h-uart = &cdc_acm_uart0;
zephyr,code-partition = &code_partition;
};
leds {
led0: led_0 {
gpios = <&gpio1 9 0>;
};
};
};
&i2c0 {
SHT3XD: sht3xd@44 {
compatible = "sensirion,sht3xd";
reg = <0x44>;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* To enable flashing with UF2 bootloader, we
* must reserve a partition for SoftDevice.
* See https://learn.adafruit.com/
* introducing-the-adafruit-nrf52840-feather?view=all#hathach-memory-map
*/
reserved_partition_0: partition@0 {
label = "SoftDevice";
reg = <0x000000000 DT_SIZE_K(152)>;
};
code_partition: partition@26000 {
label = "Application";
reg = <0x00026000 DT_SIZE_K(796)>;
};
/*
* The flash starting at 0x000ed000 and ending at
* 0x000f4000 is reserved for use by the application.
*/
storage_partition: partition@ed000 {
label = "storage";
reg = <0x0000ed000 DT_SIZE_K(28)>;
};
boot_partition: partition@f4000 {
label = "UF2";
reg = <0x000f4000 DT_SIZE_K(48)>;
};
};
};
zephyr_udc0: &usbd {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};

View file

@ -0,0 +1,19 @@
identifier: adafruit_feather_nrf52840_sense
name: Adafruit Feather nRF52840 Sense
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- usb_cdc
- ble
- watchdog
- counter
- feather_serial
- feather_i2c
- feather_spi
vendor: adafruit

View file

@ -0,0 +1,25 @@
# SPDX-License-Identifier: Apache-2.0
# 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
# 32kHz clock source
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
# enable bossac
CONFIG_BOOTLOADER_BOSSA=y
CONFIG_BOOTLOADER_BOSSA_ADAFRUIT_UF2=y
# Build UF2 by default, supported by the Adafruit nRF52 Bootloader
CONFIG_BUILD_OUTPUT_UF2=y

View file

@ -2,6 +2,9 @@
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000") board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000") board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
if(CONFIG_BOARD_ADAFRUIT_FEATHER_NRF52840_SENSE)
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
endif()
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)

View file

@ -1,5 +1,9 @@
board: boards:
name: adafruit_feather_nrf52840_express - name: adafruit_feather_nrf52840_express
vendor: adafruit vendor: adafruit
socs: socs:
- name: nrf52840 - name: nrf52840
- name: adafruit_feather_nrf52840_sense
vendor: adafruit
socs:
- name: nrf52840

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -1,7 +1,7 @@
.. _adafruit_feather_nrf52840: .. _adafruit_feather_nrf52840:
Adafruit Feather nRF52840 Express Adafruit Feather nRF52840 (Express, Sense)
################################# ##########################################
Overview Overview
******** ********
@ -25,9 +25,19 @@ nRF52840 ARM Cortex-M4F CPU and the following devices:
* :abbr:`USB (Universal Serial Bus)` * :abbr:`USB (Universal Serial Bus)`
* :abbr:`WDT (Watchdog Timer)` * :abbr:`WDT (Watchdog Timer)`
.. figure:: img/adafruit_feather_nrf52840.jpg .. tabs::
:align: center
:alt: Adafruit Feather nRF52840 Express .. group-tab:: Express
.. figure:: img/adafruit_feather_nrf52840_express.jpg
:align: center
:alt: Adafruit Feather nRF52840 Express
.. group-tab:: Sense
.. figure:: img/adafruit_feather_nrf52840_sense.jpg
:align: center
:alt: Adafruit Feather nRF52840 Sense
Hardware Hardware
******** ********
@ -39,7 +49,14 @@ Hardware
- 2 User LEDs - 2 User LEDs
- 1 NeoPixel LED - 1 NeoPixel LED
- Reset button - Reset button
- SWD connector - SWD connector (Express only)
- SWD solder pads on bottom of PCB (Sense only)
- LSM6DS33 Accel/Gyro (Sense only)
- LIS3MDL magnetometer (Sense only)
- APDS9960 Proximity, Light, Color, and Gesture Sensor (Sense only)
- MP34DT01-M PDM Microphone sound sensor (Sense only)
- SHT3X Humidity sensor (Sense only)
- BMP280 temperature and barometric pressure/altitude (Sense only)
Supported Features Supported Features
================== ==================
@ -85,13 +102,25 @@ Other hardware features have not been enabled yet for this board.
Connections and IOs Connections and IOs
=================== ===================
The `Adafruit Feather nRF52840 Express Learn site`_ has detailed .. tabs::
information about the board including `pinouts`_ and the `schematic`_.
.. group-tab:: Express
The `Adafruit Feather nRF52840 Express Learn site`_ has
detailed information about the board including
`pinouts (Express)`_ and the `schematic (Express)`_.
.. group-tab:: Sense
The `Adafruit Feather nRF52840 Sense Learn site`_ has
detailed information about the board including
`pinouts (Sense)`_ and the `schematic (Sense)`_.
LED LED
--- ---
* LED0 (red) = P1.15 * LED0 (red) = P1.15 (Express)
* LED0 (red) = P1.9 (Sense)
* LED1 (blue) = P1.10 * LED1 (blue) = P1.10
Push buttons Push buttons
@ -103,33 +132,56 @@ Push buttons
Programming and Debugging Programming and Debugging
************************* *************************
Applications for the ``adafruit_feather_nrf52840_express`` board configuration
can be built and flashed in the usual way (see :ref:`build_an_application`
and :ref:`application_run` for more details).
Flashing Flashing
======== ========
Flashing Zephyr onto the ``adafruit_feather_nrf52480_express`` board requires Flashing Zephyr onto the ``adafruit_feather_nrf52480_express`` board is possible
an external programmer. The programmer is attached to the SWD header. using an external programmer. The programmer is attached to the SWD header.
Build the Zephyr kernel and the :zephyr:code-sample:`blinky` sample application. The Feather nRF52840 ships with the `Adafruit nRF52 Bootloader`_ which
supports flashing using `UF2`_. This allows easy flashing of new images,
but does not support debugging the device.
.. zephyr-app-commands:: #. Build the Zephyr kernel and the :zephyr:code-sample:`blinky` sample application.
:zephyr-app: samples/basic/blinky
:board: adafruit_feather_nrf52840_express
:goals: build
:compact:
Flash the image. .. tabs::
.. zephyr-app-commands:: .. group-tab:: Express
:zephyr-app: samples/basic/blinky
:board: adafruit_feather_nrf52840_express
:goals: flash
:compact:
You should see the red LED blink. .. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: adafruit_feather_nrf52840_express/nrf52840
:goals: build
:compact:
.. group-tab:: Sense
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: adafruit_feather_nrf52840_sense/nrf52840
:goals: build
:compact:
#. If using UF2, connect the board to your host computer using USB.
#. Tap the reset button twice quickly to enter bootloader mode.
A mass storage device named `FTHR840BOOT` for (Express) or
`FTHRSNSBOOT` (Sense) should appear on the host. Ensure this is
mounted.
#. Flash the image.
.. tabs::
.. group-tab:: Sense
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: adafruit_feather_nrf52840_sense
:goals: flash
:compact:
#. You should see the red LED blink.
References References
********** **********
@ -139,8 +191,23 @@ References
.. _Adafruit Feather nRF52840 Express Learn site: .. _Adafruit Feather nRF52840 Express Learn site:
https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/ https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/
.. _pinouts: .. _pinouts (Express):
https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/pinouts https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/pinouts
.. _schematic: .. _schematic (Express):
https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/downloads https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/downloads
.. _Adafruit Feather nRF52840 Sense Learn site:
https://learn.adafruit.com/adafruit-feather-sense
.. _pinouts (Sense):
https://learn.adafruit.com/adafruit-feather-sense/pinouts
.. _schematic (Sense):
https://learn.adafruit.com/adafruit-feather-sense/downloads
.. _Adafruit nRF52 Bootloader:
https://github.com/adafruit/Adafruit_nRF52_Bootloader
.. _UF2:
https://github.com/microsoft/uf2

View file

@ -0,0 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <benjamin.bjornsson@gmail.com>
*/
#include "nordic,nrf-saadc-common.dtsi"