boards: arm: add nrf52840_pca10059
This commit adds support for the nrf52840_pca10059 board. The flash partitions are configured to allow migrating from the stock bootloader to MCUBoot. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
This commit is contained in:
parent
7479cc2ee8
commit
ef935898d0
13 changed files with 473 additions and 0 deletions
3
boards/arm/nrf52840_pca10059/CMakeLists.txt
Normal file
3
boards/arm/nrf52840_pca10059/CMakeLists.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
zephyr_library()
|
||||
zephyr_library_sources(board.c)
|
||||
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
|
14
boards/arm/nrf52840_pca10059/Kconfig
Normal file
14
boards/arm/nrf52840_pca10059/Kconfig
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Kconfig - nRF52840 PCA10059 board configuration
|
||||
#
|
||||
# Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_NRF52840_PCA10059
|
||||
|
||||
config BOARD_ENABLE_DCDC
|
||||
bool "Enable DCDC mode"
|
||||
select SOC_DCDC_NRF52X
|
||||
default y
|
||||
|
||||
endif # BOARD_NRF52840_PCA10059
|
9
boards/arm/nrf52840_pca10059/Kconfig.board
Normal file
9
boards/arm/nrf52840_pca10059/Kconfig.board
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Kconfig - nRF52840 PCA10059 board configuration
|
||||
#
|
||||
# Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config BOARD_NRF52840_PCA10059
|
||||
bool "NRF52840 PCA10059"
|
||||
depends on SOC_NRF52840_QIAA
|
56
boards/arm/nrf52840_pca10059/Kconfig.defconfig
Normal file
56
boards/arm/nrf52840_pca10059/Kconfig.defconfig
Normal file
|
@ -0,0 +1,56 @@
|
|||
# Kconfig - nRF52 PCA10059 board configuration
|
||||
#
|
||||
# Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_NRF52840_PCA10059
|
||||
|
||||
config BOARD
|
||||
default "nrf52840_pca10059"
|
||||
|
||||
if GPIO_NRF5
|
||||
|
||||
config GPIO_NRF5_P0
|
||||
default y
|
||||
|
||||
# One LED and the user button are connected to P1
|
||||
config GPIO_NRF5_P1
|
||||
default y
|
||||
|
||||
endif # GPIO_NRF5
|
||||
|
||||
if UART_NRFX
|
||||
|
||||
config UART_0_NRF_TX_PIN
|
||||
default 20
|
||||
|
||||
config UART_0_NRF_RX_PIN
|
||||
default 24
|
||||
|
||||
config UART_0_NRF_RTS_PIN
|
||||
default 17
|
||||
|
||||
config UART_0_NRF_CTS_PIN
|
||||
default 22
|
||||
|
||||
endif # UART_NRFX
|
||||
|
||||
if USB
|
||||
|
||||
config USB_NRF52840
|
||||
def_bool y
|
||||
|
||||
config USB_DEVICE_STACK
|
||||
def_bool y
|
||||
|
||||
endif # USB
|
||||
|
||||
if IEEE802154
|
||||
|
||||
config IEEE802154_NRF5
|
||||
def_bool y
|
||||
|
||||
endif # IEEE802154
|
||||
|
||||
endif # BOARD_NRF52840_PCA10059
|
46
boards/arm/nrf52840_pca10059/board.c
Normal file
46
boards/arm/nrf52840_pca10059/board.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Nordic Semiconductor ASA.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <init.h>
|
||||
#include <board.h>
|
||||
#include <nrf_power.h>
|
||||
|
||||
static int board_nrf52840_pca10059_init(struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
/* if the nrf52840_pca10059 board is powered from USB
|
||||
* (high voltage mode), GPIO output voltage is set to 1.8 volts by
|
||||
* default and that is not enough to turn the green and blue LEDs on.
|
||||
* Increase GPIO voltage to 3.0 volts.
|
||||
*/
|
||||
if ((nrf_power_mainregstatus_get() == NRF_POWER_MAINREGSTATUS_HIGH) &&
|
||||
((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
|
||||
(UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))) {
|
||||
|
||||
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
|
||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
|
||||
;
|
||||
}
|
||||
|
||||
NRF_UICR->REGOUT0 =
|
||||
(NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
|
||||
(UICR_REGOUT0_VOUT_3V0 << UICR_REGOUT0_VOUT_Pos);
|
||||
|
||||
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
|
||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
|
||||
;
|
||||
}
|
||||
|
||||
/* a reset is required for changes to take effect */
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(board_nrf52840_pca10059_init, PRE_KERNEL_1,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
4
boards/arm/nrf52840_pca10059/board.cmake
Normal file
4
boards/arm/nrf52840_pca10059/board.cmake
Normal file
|
@ -0,0 +1,4 @@
|
|||
board_runner_args(nrfjprog "--nrf-family=NRF52")
|
||||
board_runner_args(jlink "--device=nrf52" "--speed=4000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
34
boards/arm/nrf52840_pca10059/board.h
Normal file
34
boards/arm/nrf52840_pca10059/board.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 Nordic Semiconductor ASA.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __INC_BOARD_H
|
||||
#define __INC_BOARD_H
|
||||
|
||||
#include <soc.h>
|
||||
|
||||
/* Aliases to make the basic samples (e.g. LED, button) work */
|
||||
|
||||
/* Push button switch 0
|
||||
* This is the only button available to the application,
|
||||
* the other button on the board is used to reset.
|
||||
*/
|
||||
#define SW0_GPIO_PIN GPIO_KEYS_0_GPIO_PIN
|
||||
#define SW0_GPIO_NAME GPIO_KEYS_0_GPIO_CONTROLLER
|
||||
#define SW0_GPIO_PIN_PUD GPIO_KEYS_0_GPIO_FLAGS
|
||||
|
||||
/* LED 0 is a green LED */
|
||||
#define LED0_GPIO_PIN GPIO_LEDS_LED_0_GREEN_GPIO_PIN
|
||||
#define LED0_GPIO_PORT GPIO_LEDS_LED_0_GREEN_GPIO_CONTROLLER
|
||||
|
||||
/* LED 1 is RGB */
|
||||
#define LED1_GPIO_PIN GPIO_LEDS_LED_1_RED_GPIO_PIN
|
||||
#define LED1_GPIO_PORT GPIO_LEDS_LED_1_RED_GPIO_CONTROLLER
|
||||
#define LED2_GPIO_PIN GPIO_LEDS_LED_1_GREEN_GPIO_PIN
|
||||
#define LED2_GPIO_PORT GPIO_LEDS_LED_1_GREEN_GPIO_CONTROLLER
|
||||
#define LED3_GPIO_PIN GPIO_LEDS_LED_1_BLUE_GPIO_PIN
|
||||
#define LED3_GPIO_PORT GPIO_LEDS_LED_1_BLUE_GPIO_CONTROLLER
|
||||
|
||||
#endif /* __INC_BOARD_H */
|
BIN
boards/arm/nrf52840_pca10059/doc/img/nrf52840_pca10059.jpg
Normal file
BIN
boards/arm/nrf52840_pca10059/doc/img/nrf52840_pca10059.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 93 KiB |
139
boards/arm/nrf52840_pca10059/doc/nrf52840_pca10059.rst
Normal file
139
boards/arm/nrf52840_pca10059/doc/nrf52840_pca10059.rst
Normal file
|
@ -0,0 +1,139 @@
|
|||
.. _nrf52840_pca10059:
|
||||
|
||||
nRF52840-PCA10059
|
||||
#################
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
Zephyr applications use the nrf52840_pca10059 board configuration
|
||||
to run on the nRF52840 PCA10059 (USB Dongle) hardware. It provides
|
||||
support for the Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU and
|
||||
the following devices:
|
||||
|
||||
* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
|
||||
* :abbr:`RTC (nRF RTC System Clock)`
|
||||
* UART
|
||||
* GPIO
|
||||
* FLASH
|
||||
* RADIO (Bluetooth Low Energy)
|
||||
|
||||
.. figure:: img/nrf52840_pca10059.jpg
|
||||
:width: 442px
|
||||
:align: center
|
||||
:alt: nRF52840 Dongle
|
||||
|
||||
nRF52840 PCA10059
|
||||
|
||||
More information about the board can be found at the
|
||||
`nRF52840 Dongle website`_. The `Nordic Semiconductor Infocenter`_
|
||||
contains the processor's information and the datasheet.
|
||||
|
||||
Hardware
|
||||
********
|
||||
|
||||
The ``nrf52840_pca10059`` has two external oscillators. The frequency of
|
||||
the slow clock is 32.768 kHz. The frequency of the main clock
|
||||
is 32 MHz.
|
||||
|
||||
Supported Features
|
||||
==================
|
||||
|
||||
The ``nrf52840_pca10059`` board configuration supports the following
|
||||
hardware features:
|
||||
|
||||
+-----------+------------+----------------------+
|
||||
| Interface | Controller | Driver/Component |
|
||||
+===========+============+======================+
|
||||
| NVIC | on-chip | nested vectored |
|
||||
| | | interrupt controller |
|
||||
+-----------+------------+----------------------+
|
||||
| RTC | on-chip | system clock |
|
||||
+-----------+------------+----------------------+
|
||||
| GPIO | on-chip | gpio |
|
||||
+-----------+------------+----------------------+
|
||||
| FLASH | on-chip | flash |
|
||||
+-----------+------------+----------------------+
|
||||
| RADIO | on-chip | Bluetooth |
|
||||
+-----------+------------+----------------------+
|
||||
|
||||
Other hardware features are not supported by the Zephyr kernel.
|
||||
See `nRF52840 Dongle website`_ and `Nordic Semiconductor Infocenter`_
|
||||
for a complete list of nRF52840 PCA10059 Development Kit board hardware features.
|
||||
|
||||
Connections and IOs
|
||||
===================
|
||||
|
||||
LED
|
||||
---
|
||||
|
||||
* LED0 (green) = P0.6
|
||||
* LED1 (red) = P0.8
|
||||
* LED1 (green) = P1.9
|
||||
* LED1 (blue) = P0.12
|
||||
|
||||
Push buttons
|
||||
------------
|
||||
|
||||
* BUTTON1 = SW1 = P1.6
|
||||
* RESET = SW2 = P0.18
|
||||
|
||||
Programming and Debugging
|
||||
*************************
|
||||
|
||||
Applications for the ``nrf52840_pca10059`` board configuration can be
|
||||
built in the usual way (see :ref:`build_an_application` for more details);
|
||||
however, an external debugger IC is necessary to program the device,
|
||||
and the standard debugging targets are not currently available.
|
||||
|
||||
Flashing
|
||||
========
|
||||
|
||||
Flashing Zephyr onto the ``nrf52840_pca10059`` board requires an external
|
||||
J-Link programmer. The programmer is attached to the SWD header on the back
|
||||
side of the board.
|
||||
|
||||
Follow the instructions in the :ref:`nordic_segger` page to install
|
||||
and configure all the necessary software. Further information can be
|
||||
found in :ref:`nordic_segger_flashing`. Then build and flash
|
||||
applications as usual (see :ref:`build_an_application` and
|
||||
:ref:`application_run` for more details).
|
||||
|
||||
Here is an example for the :ref:`blinky-sample` application.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/basic/blinky
|
||||
:board: nrf52840_pca10059
|
||||
:goals: build flash
|
||||
|
||||
Observe the LED on the board blinking.
|
||||
|
||||
Debugging
|
||||
=========
|
||||
|
||||
The ``nrf52840_pca10059`` board does not have an on-board J-Link debug IC
|
||||
as some nRF5x development boards, however, instructions from the
|
||||
:ref:`nordic_segger` page also apply to this board, with the additional step
|
||||
of connecting an external debugger.
|
||||
|
||||
Testing the LEDs and buttons on the nRF52840 PCA10059
|
||||
*****************************************************
|
||||
|
||||
There are 2 samples that allow you to test that the buttons (switches) and LEDs on
|
||||
the board are working properly with Zephyr:
|
||||
|
||||
* :ref:`blinky-sample`
|
||||
|
||||
You can build and program the examples to make sure Zephyr is running correctly on
|
||||
your board. The button and LED definitions can be found in :file:`boards/arm/nrf52840_pca10059/board.h`.
|
||||
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
.. target-notes::
|
||||
|
||||
.. _nRF52840 Dongle website: https://www.nordicsemi.com/eng/Products/nRF52840-Dongle
|
||||
.. _Nordic Semiconductor Infocenter: http://infocenter.nordicsemi.com/
|
||||
.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html
|
||||
|
129
boards/arm/nrf52840_pca10059/nrf52840_pca10059.dts
Normal file
129
boards/arm/nrf52840_pca10059/nrf52840_pca10059.dts
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 Linaro Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include <nordic/nrf52840.dtsi>
|
||||
|
||||
/ {
|
||||
model = "Nordic PCA10059 Dev Kit";
|
||||
compatible = "nordic,pca10059-dk", "nordic,nrf52840-qiaa",
|
||||
"nordic,nrf52840";
|
||||
|
||||
chosen {
|
||||
zephyr,console = &uart0;
|
||||
#ifdef CONFIG_MCUMGR_SMP_UART
|
||||
zephyr,uart-mcumgr = &uart0;
|
||||
#endif
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
};
|
||||
|
||||
led_0 {
|
||||
compatible = "gpio-leds";
|
||||
led0_green: green {
|
||||
gpios = <&gpio0 6 GPIO_INT_ACTIVE_LOW>;
|
||||
label = "Onboard green LED 0";
|
||||
};
|
||||
};
|
||||
|
||||
led_1 {
|
||||
compatible = "gpio-leds";
|
||||
led1_red: red {
|
||||
gpios = <&gpio0 8 GPIO_INT_ACTIVE_LOW>;
|
||||
label = "Onboard red LED 1";
|
||||
};
|
||||
led1_green: green {
|
||||
gpios = <&gpio1 9 GPIO_INT_ACTIVE_LOW>;
|
||||
label = "Onboard green LED 1";
|
||||
};
|
||||
led1_blue: blue {
|
||||
gpios = <&gpio0 12 GPIO_INT_ACTIVE_LOW>;
|
||||
label = "Onboard blue LED 1";
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
user_button_0: button@0 {
|
||||
label = "Push button switch 0";
|
||||
gpios = <&gpio1 6 GPIO_PUD_PULL_UP>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status ="ok";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status ="ok";
|
||||
};
|
||||
|
||||
&gpio1 {
|
||||
status ="ok";
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
compatible = "nordic,nrf-uarte";
|
||||
current-speed = <115200>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
status = "ok";
|
||||
sda-pin = <26>;
|
||||
scl-pin = <27>;
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
status = "ok";
|
||||
sda-pin = <30>;
|
||||
scl-pin = <31>;
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
/*
|
||||
* For more information, see:
|
||||
* http://docs.zephyrproject.org/devices/dts/flash_partitions.html
|
||||
*/
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
boot_partition: partition@e0000 {
|
||||
label = "mcuboot";
|
||||
reg = <0x0000e0000 0x0001a000>;
|
||||
};
|
||||
slot0_partition: partition@1000 {
|
||||
label = "image-0";
|
||||
reg = <0x00001000 0x000060000>;
|
||||
};
|
||||
slot1_partition: partition@61000 {
|
||||
label = "image-1";
|
||||
reg = <0x0061000 0x000060000>;
|
||||
};
|
||||
scratch_partition: partition@c1000 {
|
||||
label = "image-scratch";
|
||||
reg = <0x000c1000 0x0001f000>;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_FS_FLASH_STORAGE_PARTITION)
|
||||
storage_partition: partition@fa000 {
|
||||
label = "storage";
|
||||
reg = <0x000fa000 0x00004000>;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
&usbd {
|
||||
compatible = "nordic,nrf-usbd";
|
||||
status = "ok";
|
||||
};
|
13
boards/arm/nrf52840_pca10059/nrf52840_pca10059.yaml
Normal file
13
boards/arm/nrf52840_pca10059/nrf52840_pca10059.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
identifier: nrf52840_pca10059
|
||||
name: nRF52840-PCA10059
|
||||
type: mcu
|
||||
arch: arm
|
||||
ram: 256
|
||||
flash: 1024
|
||||
toolchain:
|
||||
- zephyr
|
||||
- gccarmemb
|
||||
supported:
|
||||
- usb_device
|
||||
- ble
|
||||
- ieee802154
|
25
boards/arm/nrf52840_pca10059/nrf52840_pca10059_defconfig
Normal file
25
boards/arm/nrf52840_pca10059/nrf52840_pca10059_defconfig
Normal file
|
@ -0,0 +1,25 @@
|
|||
CONFIG_ARM=y
|
||||
CONFIG_SOC_FAMILY_NRF=y
|
||||
CONFIG_SOC_SERIES_NRF52X=y
|
||||
CONFIG_SOC_NRF52840_QIAA=y
|
||||
CONFIG_BOARD_NRF52840_PCA10059=y
|
||||
|
||||
# Enable MPU
|
||||
CONFIG_ARM_MPU_NRF52X=y
|
||||
|
||||
# Enable UART driver, needed for CDC ACM
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_NRFX=y
|
||||
CONFIG_UART_0_NRF_UARTE=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
|
||||
# enable console
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_RTT_CONSOLE=y
|
||||
|
||||
# additional board options
|
||||
CONFIG_GPIO_AS_PINRESET=y
|
||||
|
||||
# bluetooth
|
||||
CONFIG_BT=y
|
||||
CONFIG_BT_CTLR=y
|
|
@ -1,5 +1,6 @@
|
|||
#include <arm/armv7-m.dtsi>
|
||||
#include <dt-bindings/i2c/i2c.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <nordic/mem.h>
|
||||
|
||||
/ {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue