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

cpu/saml1x: enable buck voltage regulator

Switch from the on-chip LDO to the on-chip buck voltage regulator.
This commit is contained in:
Benjamin Valentin 2020-02-21 17:03:39 +01:00 committed by Benjamin Valentin
parent 9b90fd478a
commit 005de7024b

View File

@ -30,6 +30,16 @@
#define _NVMCTRL NVMCTRL
#endif
/* As long as FDPLL is not used, we can default to
* always using the buck converter.
*
* An external inductor needs to be present on the board,
* so the feature can only be enabled by the board configuration.
*/
#ifndef USE_VREG_BUCK
#define USE_VREG_BUCK (0)
#endif
static void _gclk_setup(int gclk, uint32_t reg)
{
GCLK->GENCTRL[gclk].reg = reg;
@ -97,6 +107,11 @@ void cpu_init(void)
/* initialize the Cortex-M core */
cortexm_init();
/* not compatible with 96 MHz FDPLL */
if (USE_VREG_BUCK) {
sam0_set_voltage_regulator(SAM0_VREG_BUCK);
}
/* turn on only needed APB peripherals */
MCLK->APBAMASK.reg = MCLK_APBAMASK_MCLK
| MCLK_APBAMASK_OSCCTRL