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:
parent
1a30b8f40f
commit
64f04e4da9
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "nrf_clock.h"
|
#include "nrf_clock.h"
|
||||||
|
#include "nrfx.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
#include "stdio_base.h"
|
#include "stdio_base.h"
|
||||||
@ -30,6 +31,8 @@ void cpu_init(void)
|
|||||||
{
|
{
|
||||||
/* initialize the Cortex-M core */
|
/* initialize the Cortex-M core */
|
||||||
cortexm_init();
|
cortexm_init();
|
||||||
|
/* Enable the DC/DC power converter */
|
||||||
|
nrfx_dcdc_init();
|
||||||
/* setup the HF clock */
|
/* setup the HF clock */
|
||||||
clock_init_hf();
|
clock_init_hf();
|
||||||
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
#define DONT_OVERRIDE_NVIC
|
#define DONT_OVERRIDE_NVIC
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "nrfx.h"
|
||||||
#include "nrf_clock.h"
|
#include "nrf_clock.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
@ -61,6 +62,8 @@ void cpu_init(void)
|
|||||||
NRF_CLOCK->EVENTS_DONE = 0;
|
NRF_CLOCK->EVENTS_DONE = 0;
|
||||||
NRF_CLOCK->EVENTS_CTTO = 0;
|
NRF_CLOCK->EVENTS_CTTO = 0;
|
||||||
}
|
}
|
||||||
|
/* Enable the DC/DC power converter */
|
||||||
|
nrfx_dcdc_init();
|
||||||
|
|
||||||
/* initialize hf clock */
|
/* initialize hf clock */
|
||||||
clock_init_hf();
|
clock_init_hf();
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Freie Universität Berlin
|
* 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
|
* 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
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
@ -14,18 +16,34 @@
|
|||||||
* @brief nrfx compatibility layer
|
* @brief nrfx compatibility layer
|
||||||
*
|
*
|
||||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
* @author Koen Zandberg <koen@bergzand.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NRFX_H
|
#ifndef NRFX_H
|
||||||
#define NRFX_H
|
#define NRFX_H
|
||||||
|
|
||||||
#include "cpu_conf.h"
|
#include "cpu_conf.h"
|
||||||
|
#include "periph_conf.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user