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

Merge pull request #13586 from bergzand/pr/nrf/dcdc

nrf5x: Add and enable configuration for the built-in DC/DC converter
This commit is contained in:
Kaspar Schleiser 2020-03-24 11:56:40 +01:00 committed by GitHub
commit fc6b586919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 86 additions and 1 deletions

View File

@ -80,6 +80,11 @@ static const i2c_conf_t i2c_config[] = {
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -41,6 +41,11 @@ static const pwm_conf_t pwm_config[] = {
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -73,6 +73,11 @@ static const i2c_conf_t i2c_config[] = {
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -40,6 +40,11 @@ extern "C" {
#define UART_PIN_TX GPIO_PIN(0,20)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -53,6 +53,11 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -60,6 +60,11 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -59,6 +59,12 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -49,6 +49,11 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -63,6 +63,11 @@ static const i2c_conf_t i2c_config[] = {
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -68,6 +68,11 @@ static const spi_conf_t spi_config[] = {
#define SPI_NUMOF ARRAY_SIZE(spi_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -54,6 +54,11 @@ static const spi_conf_t spi_config[] = {
#define UART_PIN_TX GPIO_PIN(0, 5)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

View File

@ -62,6 +62,11 @@ static const i2c_conf_t i2c_config[] = {
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
/** @} */
/**
* @brief Enable the internal DC/DC converter
*/
#define NRF5X_ENABLE_DCDC
#ifdef __cplusplus
}
#endif

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
}