diff --git a/boards/arm/adafruit_feather_nrf52840/Kconfig b/boards/arm/adafruit_feather_nrf52840/Kconfig new file mode 100644 index 00000000000..3328e345857 --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/Kconfig @@ -0,0 +1,10 @@ +# Adafruit Feather nRF52840 Express board configuration + +# Copyright (c) 2020 Tobias Svehagen +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on BOARD_ADAFRUIT_FEATHER_NRF52840 diff --git a/boards/arm/adafruit_feather_nrf52840/Kconfig.board b/boards/arm/adafruit_feather_nrf52840/Kconfig.board new file mode 100644 index 00000000000..4e37d05303a --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/Kconfig.board @@ -0,0 +1,8 @@ +# Adafruit Feather nRF52840 Express board configuration + +# Copyright (c) 2020 Tobias Svehagen +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_FEATHER_NRF52840 + bool "Adafruit Feather nRF52840 Express" + depends on SOC_NRF52840_QIAA diff --git a/boards/arm/adafruit_feather_nrf52840/Kconfig.defconfig b/boards/arm/adafruit_feather_nrf52840/Kconfig.defconfig new file mode 100644 index 00000000000..9817872c75d --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/Kconfig.defconfig @@ -0,0 +1,40 @@ +# Adafruit Feather nRF52840 Express board configuration + +# Copyright (c) 2020 Tobias Svehagen +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_ADAFRUIT_FEATHER_NRF52840 + +config BOARD + default "adafruit_feather_nrf52840" + +config ADC_0 + default y + depends on ADC + +config I2C_0 + default y + depends on I2C + +config SPI_1 + default y + depends on SPI + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +config IEEE802154_NRF5 + default y + depends on IEEE802154 + +config BT_CTLR + default BT + +endif # BOARD_ADAFRUIT_FEATHER_NRF52840 diff --git a/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.dts b/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.dts new file mode 100644 index 00000000000..8f36c00e7aa --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.dts @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2020 Tobias Svehagen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "Adafruit Feather nRF52840 Express"; + compatible = "nordic,nrf52840-qiaa", "nordic,nrf52840"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,uart-mcumgr = &uart0; + zephyr,bt-mon-uart = &uart0; + zephyr,bt-c2h-uart = &uart0; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + }; + + leds { + compatible = "gpio-leds"; + led0: led_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"; + }; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + led1 = &led1; + sw0 = &button0; + }; +}; + +&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 { + status = "okay"; + sck-pin = <14>; + mosi-pin = <13>; + miso-pin = <15>; +}; + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x000000000 0x0000C000>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 0x000067000>; + }; + slot1_partition: partition@73000 { + label = "image-1"; + reg = <0x00073000 0x000067000>; + }; + scratch_partition: partition@da000 { + label = "image-scratch"; + reg = <0x000da000 0x0001e000>; + }; + + /* + * The flash starting at 0x000f8000 and ending at + * 0x000fffff is reserved for use by the application. + */ + + /* Storage partition will be used by FCB/NFFS/NVS if enabled. */ + storage_partition: partition@f8000 { + label = "storage"; + reg = <0x000f8000 0x00008000>; + }; + }; +}; + +&usbd { + compatible = "nordic,nrf-usbd"; + status = "okay"; +}; diff --git a/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.yaml b/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.yaml new file mode 100644 index 00000000000..f71e2e57161 --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840.yaml @@ -0,0 +1,16 @@ +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 diff --git a/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840_defconfig b/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840_defconfig new file mode 100644 index 00000000000..c188b8e3c44 --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/adafruit_feather_nrf52840_defconfig @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: Apache-2.0 + +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 +CONFIG_UART_0_NRF_UART=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# additional board options +CONFIG_GPIO_AS_PINRESET=y diff --git a/boards/arm/adafruit_feather_nrf52840/board.cmake b/boards/arm/adafruit_feather_nrf52840/board.cmake new file mode 100644 index 00000000000..78de42e9a47 --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/board.cmake @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=nrf52" "--speed=4000") +board_runner_args(pyocd "--target=nrf52" "--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) diff --git a/boards/arm/adafruit_feather_nrf52840/doc/img/adafruit_feather_nrf52840.jpg b/boards/arm/adafruit_feather_nrf52840/doc/img/adafruit_feather_nrf52840.jpg new file mode 100644 index 00000000000..e83c5353d69 Binary files /dev/null and b/boards/arm/adafruit_feather_nrf52840/doc/img/adafruit_feather_nrf52840.jpg differ diff --git a/boards/arm/adafruit_feather_nrf52840/doc/index.rst b/boards/arm/adafruit_feather_nrf52840/doc/index.rst new file mode 100644 index 00000000000..b5ebfe83c37 --- /dev/null +++ b/boards/arm/adafruit_feather_nrf52840/doc/index.rst @@ -0,0 +1,147 @@ +.. _adafruit_feather_nrf52840: + +Adafruit Feather nRF52840 Express +################################# + +Overview +******** + +The Adafruit Feather nRF52840 provides support for the Nordic Semiconductor +nRF52840 ARM Cortex-M4F CPU and the following devices: + +* :abbr:`ADC (Analog to Digital Converter)` +* CLOCK +* FLASH +* :abbr:`GPIO (General Purpose Input Output)` +* :abbr:`I2C (Inter-Integrated Circuit)` +* :abbr:`MPU (Memory Protection Unit)` +* :abbr:`NVIC (Nested Vectored Interrupt Controller)` +* :abbr:`PWM (Pulse Width Modulation)` +* RADIO (Bluetooth Low Energy and 802.15.4) +* :abbr:`RTC (nRF RTC System Clock)` +* Segger RTT (RTT Console) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UART (Universal asynchronous receiver-transmitter)` +* :abbr:`USB (Universal Serial Bus)` +* :abbr:`WDT (Watchdog Timer)` + +.. figure:: img/adafruit_feather_nrf52840.jpg + :width: 640px + :align: center + :alt: Adafruit Feather nRF52840 Express + +Hardware +******** + +- nRF52840 ARM Cortex-M4F processor at 64 MHz +- 1 MB flash memory and 256 KB of SRAM +- Battery connector and charger for 3.7 V lithium polymer batteries +- Charging indicator LED +- 2 User LEDs +- 1 NeoPixel LED +- Reset button +- SWD connector + +Supported Features +================== + +The Adafruit Feather nRF52840 board configuration supports the +following hardware features: + ++-----------+------------+----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+======================+ +| ADC | on-chip | adc | ++-----------+------------+----------------------+ +| CLOCK | on-chip | clock_control | ++-----------+------------+----------------------+ +| FLASH | on-chip | flash | ++-----------+------------+----------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+----------------------+ +| I2C | on-chip | i2c | ++-----------+------------+----------------------+ +| MPU | on-chip | arch/arm | ++-----------+------------+----------------------+ +| NVIC | on-chip | arch/arm | ++-----------+------------+----------------------+ +| PWM | on-chip | pwm | ++-----------+------------+----------------------+ +| RADIO | on-chip | Bluetooth, | +| | | ieee802154 | ++-----------+------------+----------------------+ +| RTC | on-chip | system clock | ++-----------+------------+----------------------+ +| SPI | on-chip | spi | ++-----------+------------+----------------------+ +| UART | on-chip | serial | ++-----------+------------+----------------------+ +| USB | on-chip | usb | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + +Other hardware features are not supported by the Zephyr kernel. + +Connections and IOs +=================== + +The `Adafruit Feather nRF52840 Express Learn site`_ has detailed +information about the board including `pinouts`_ and the `schematic`_. + +LED +--- + +* LED0 (red) = P1.15 +* LED1 (blue) = P1.10 + +Push buttons +------------ + +* SWITCH = P1.02 +* RESET = P0.18 + +Programming and Debugging +************************* + +Applications for the ``adafruit_feather_nrf52840`` 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 Zephyr onto the ``adafruit_feather_nrf52480`` board requires +an external programmer. The programmer is attached to the SWD header. + +Build the Zephyr kernel and the :ref:`blinky-sample` sample application. + + .. zephyr-app-commands:: + :zephyr-app: samples/blinky + :board: adafruit_feather_nrf52840 + :goals: build + :compact: + +Flash the image. + + .. zephyr-app-commands:: + :zephyr-app: samples/blinky + :board: adafruit_feather_nrf52840 + :goals: flash + :compact: + +You should see the the red LED blink. + +References +********** + +.. target-notes:: + +.. _Adafruit Feather nRF52840 Express Learn site: + https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/ + +.. _pinouts: + https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/pinouts + +.. _schematic: + https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/downloads diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index f2e5d813f38..a068833e7ec 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -31,13 +31,14 @@ #define ADC_2ND_CHANNEL_INPUT NRF_ADC_CONFIG_INPUT_3 #elif defined(CONFIG_BOARD_NRF52_PCA10040) || \ - defined(CONFIG_BOARD_NRF52840_PCA10056) || \ - defined(CONFIG_BOARD_NRF52840_BLIP) || \ - defined(CONFIG_BOARD_NRF52840_PAPYR) || \ - defined(CONFIG_BOARD_NRF52833_PCA10100) || \ - defined(CONFIG_BOARD_BL652_DVK) || \ - defined(CONFIG_BOARD_BL654_DVK) || \ - defined(CONFIG_BOARD_DEGU_EVK) + defined(CONFIG_BOARD_NRF52840_PCA10056) || \ + defined(CONFIG_BOARD_NRF52840_BLIP) || \ + defined(CONFIG_BOARD_NRF52840_PAPYR) || \ + defined(CONFIG_BOARD_NRF52833_PCA10100) || \ + defined(CONFIG_BOARD_BL652_DVK) || \ + defined(CONFIG_BOARD_BL654_DVK) || \ + defined(CONFIG_BOARD_DEGU_EVK) || \ + defined(CONFIG_BOARD_ADAFRUIT_FEATHER_NRF52840) #include #define ADC_DEVICE_NAME DT_ADC_0_NAME