Commit ef935898 authored by Emanuele Di Santo's avatar Emanuele Di Santo Committed by Carles Cufi
Browse files

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: default avatarEmanuele Di Santo <emdi@nordicsemi.no>
parent 7479cc2e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
zephyr_library()
zephyr_library_sources(board.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
+14 −0
Original line number Diff line number Diff line
# 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 −0
Original line number Diff line number Diff line
# 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 −0
Original line number Diff line number Diff line
# 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 −0
Original line number Diff line number Diff line
/*
 * 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);
Loading