board: arm: added new board nrf52840_mdk_usb_dongle

Origin: Original

Source code of the board/arm/nrf52840dongle_nrf52840
was adapted to be used for the nrf52840_mdk_usb_dongle board.
The main differences to the copied code are:
- Kconfig: deleted BOARD_ENABLE_DCDC_HV option
- Deleted all unnecessary modules from the device tree.

Signed-off-by: Nikola Trifunovic <nikola@trifunovic.at>
This commit is contained in:
Nikola Trifunovic 2022-01-11 21:53:22 +01:00 committed by Marti Bolivar
commit b94fe63158
11 changed files with 346 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# nRF52840 MDK USB Dongle board configuration
# Copyright (c) 2022 Nikola Trifunovic
# Copyright (c) 2018 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
if BOARD_NRF52840_MDK_USB_DONGLE
config BOARD_ENABLE_DCDC
bool "DCDC mode"
select SOC_DCDC_NRF52X
default y
config BOARD_HAS_NRF5_BOOTLOADER
bool "Board has nRF5 bootloader"
default y
help
If selected, applications are linked so that they can be loaded by Nordic
nRF5 bootloader.
endif # BOARD_NRF52840_MDK_USB_DONGLE

View file

@ -0,0 +1,9 @@
# nRF52840 MDK USB Dongle board configuration
# Copyright (c) 2022 Nikola Trifunovic
# Copyright (c) 2018 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
config BOARD_NRF52840_MDK_USB_DONGLE
bool "nRF52840 MDK USB DONGLE"
depends on SOC_NRF52840_QIAA

View file

@ -0,0 +1,40 @@
# nRF52840 MDK USB Dongle board configuration
#
# Copyright (c) 2018 Nordic Semiconductor ASA
#
# Copyright (c) 2022 Nikola Trifunovic
#
# SPDX-License-Identifier: Apache-2.0
if BOARD_NRF52840_MDK_USB_DONGLE
config BOARD
default "nrf52840_mdk_usb_dongle"
# To let the nRF5 bootloader load an application, the application
# must be linked after Nordic MBR, that is factory-programmed on the board.
# Nordic nRF5 booatloader exists outside of the partitions specified in the
# DTS file, so we manually override FLASH_LOAD_OFFEST to link the application
# correctly, after Nordic MBR.
# When building MCUBoot, MCUBoot itself will select USE_DT_CODE_PARTITION
# which will make it link into the correct partition specified in DTS file,
# so no override is necessary.
config FLASH_LOAD_OFFSET
default 0x1000
depends on BOARD_HAS_NRF5_BOOTLOADER && !USE_DT_CODE_PARTITION
if USB_DEVICE_STACK
# Enable UART driver, needed for CDC ACM
config SERIAL
default y
endif # USB_DEVICE_STACK
config BT_CTLR
default BT
endif # BOARD_NRF52840_MDK_USB_DONGLE

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(jlink "--device=nrf52" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)

View file

@ -0,0 +1,36 @@
.. _nrf52840_mdk_usb_dongle:
nRF52840 MDK USB Dongle
#######################
Overview
********
The nRF52840 MDK USB Dongle is a small and low-cost development platform enabled
by the nRF5240 multiprotocol SoC in a convenient USB dongle form factor.
The design features a programmable user button, RGB LED, up to 12 GPIOs and 2.4G
Chip antenna on board. It can be used as a low-cost
Bluetooth5/Tread/802.15.4/ANT/2.4GHz multiprotocol node or development
board. Alternatively the USB Dongle can be used as a Network Co-Processor(NCP)
with a simple connection to a PC or other USB enabled device.
.. figure:: nrf52840-mdk-usb-dongle-pinout.png
:width: 442px
:align: center
:alt: nRF52840 MDK USB Dongle
nRF52840 MDK USB Dongle
See `nrf52840-mdk-usb-dongle website`_ for more information about the development
board and `nRF52840 website`_ for the official reference on the IC itself.
References
**********
.. target-notes::
.. _nRF52840 website:
https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52840
.. _nrf52840-mdk-usb-dongle website:
https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2019 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Flash partition table without support for Nordic nRF5 bootloader */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* The size of this partition ensures that MCUBoot can be built
* with an RTT console, CDC ACM support, and w/o optimizations.
*/
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x000000000 0x00012000>;
};
slot0_partition: partition@12000 {
label = "image-0";
reg = <0x00012000 0x000069000>;
};
slot1_partition: partition@7b000 {
label = "image-1";
reg = <0x0007b000 0x000069000>;
};
scratch_partition: partition@e4000 {
label = "image-scratch";
reg = <0x000e4000 0x00018000>;
};
storage_partition: partition@fc000 {
label = "storage";
reg = <0x000fc000 0x00004000>;
};
};
};

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 2019 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Flash partition table compatible with Nordic nRF5 bootloader */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* MCUboot placed after Nordic MBR.
* The size of this partition ensures that MCUBoot
* can be built with CDC ACM support and w/o optimizations.
*/
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x00001000 0x000f000>;
};
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00005e000>;
};
slot1_partition: partition@6e000 {
label = "image-1";
reg = <0x006e000 0x00005e000>;
};
storage_partition: partition@cc000 {
label = "storage";
reg = <0x000cc000 0x00004000>;
};
scratch_partition: partition@d0000 {
label = "image-scratch";
reg = <0x000d0000 0x00010000>;
};
/* Nordic nRF5 bootloader <0xe0000 0x1c000>
*
* In addition, the last and second last flash pages
* are used by the nRF5 bootloader and MBR to store settings.
*/
};
};

View file

@ -0,0 +1,111 @@
/*
* Copyright (c) 2022 Nikola Trifunovic
* Copyright (c) 2018 Nordic Semiconductor ASA
* Copyright (c) 2017 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
/ {
model = "nRF52840 MDK USB Dongle";
compatible = "nrf52840_mdk_usb_dongle";
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_red: led_0 {
gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
label = "Red LED 0";
};
led0_green: led_1 {
gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
label = "Green LED 0";
};
led0_blue: led_2 {
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
label = "Blue LED 0";
};
};
pwmleds {
compatible = "pwm-leds";
red_pwm_led: pwm_led_0 {
pwms = <&pwm0 23>;
};
green_pwm_led: pwm_led_1 {
pwms = <&pwm0 22>;
};
blue_pwm_led: pwm_led_2 {
pwms = <&pwm0 24>;
};
};
buttons {
compatible = "gpio-keys";
reset_button: button_0 {
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "reset button";
};
};
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0_red;
led1 = &led0_green;
led2 = &led0_blue;
led0-red = &led0_red;
led0-green = &led0_green;
led0-blue = &led0_blue;
pwm-led0 = &red_pwm_led;
pwm-led1 = &green_pwm_led;
pwm-led2 = &blue_pwm_led;
red-pwm-led = &red_pwm_led;
green-pwm-led = &green_pwm_led;
blue-pwm-led = &blue_pwm_led;
};
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
tx-pin = <6>;
rx-pin = <7>;
};
/* Include flash partition table.
* Two partition tables are available:
* fstab-stock -compatible with Nordic nRF5 bootloader, default
* fstab-debugger -to use an external debugger, w/o the nRF5 bootloader
*/
#include "fstab-stock.dts"
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};

View file

@ -0,0 +1,17 @@
identifier: nrf52840_mdk_usb_dongle
name: nRF52840-MDK-USB-Dongle
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- usb_device
- usb_cdc
- ble
- ieee802154
- watchdog
- counter

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_NRF52840_MDK_USB_DONGLE=y
# Enable MPU
CONFIG_ARM_MPU=y
# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y
# enable GPIO
CONFIG_GPIO=y
# additional board options
CONFIG_GPIO_AS_PINRESET=y
CONFIG_NFCT_PINS_AS_GPIOS=y