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:
commit
fc6b586919
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user