1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

nrf5x: Add built-in DC/DC converter enable function

The internal DC/DC converter is more efficient compared to the LDO
regulator.  The downside of the DC/DC converter is that it requires an
external inductor to be present on the board. Enabling the DC/DC
converter is guarded with NRF5X_ENABLE_DCDC, this macro must be defined
if the DC/DC converter is to be enabled.
This commit is contained in:
Koen Zandberg 2020-03-07 17:04:06 +01:00
parent 1a30b8f40f
commit 64f04e4da9
No known key found for this signature in database
GPG Key ID: 0E63411F8FCA8247
3 changed files with 25 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include "cpu.h"
#include "nrf_clock.h"
#include "nrfx.h"
#include "periph_conf.h"
#include "periph/init.h"
#include "stdio_base.h"
@ -30,6 +31,8 @@ void cpu_init(void)
{
/* initialize the Cortex-M core */
cortexm_init();
/* Enable the DC/DC power converter */
nrfx_dcdc_init();
/* setup the HF clock */
clock_init_hf();
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */

View File

@ -23,6 +23,7 @@
#define DONT_OVERRIDE_NVIC
#include "cpu.h"
#include "nrfx.h"
#include "nrf_clock.h"
#include "periph_conf.h"
#include "periph/init.h"
@ -61,6 +62,8 @@ void cpu_init(void)
NRF_CLOCK->EVENTS_DONE = 0;
NRF_CLOCK->EVENTS_CTTO = 0;
}
/* Enable the DC/DC power converter */
nrfx_dcdc_init();
/* initialize hf clock */
clock_init_hf();

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2018 Freie Universität Berlin
* Copyright (C) 2020 Inria
* Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -14,18 +16,34 @@
* @brief nrfx compatibility layer
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Koen Zandberg <koen@bergzand.net>
*/
#ifndef NRFX_H
#define NRFX_H
#include "cpu_conf.h"
#include "periph_conf.h"
#ifdef __cplusplus
extern "C" {
#endif
/* nothing else to do here */
/**
* @brief Enable the internal DC/DC power converter for the NRF5x MCU.
*
* The internal DC/DC converter is more efficient compared to the LDO regulator.
* The downside of the DC/DC converter is that it requires an external inductor
* to be present on the board. Enabling the DC/DC converter is guarded with
* NRF5X_ENABLE_DCDC, this macro must be defined if the DC/DC converter is to be
* enabled.
*/
static inline void nrfx_dcdc_init(void)
{
#ifdef NRF5X_ENABLE_DCDC
NRF_POWER->DCDCEN = 1;
#endif
}
#ifdef __cplusplus
}