diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index 3a667731d9..075dd1efe3 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -7365,6 +7365,7 @@ choice config RTC_LSECLOCK bool "LSE clock" + select STM32_PWR ---help--- Drive the RTC with the LSE clock diff --git a/arch/arm/src/stm32/stm32f30xxx_rcc.c b/arch/arm/src/stm32/stm32f30xxx_rcc.c index 6da5b9c03b..a5a6a0e745 100644 --- a/arch/arm/src/stm32/stm32f30xxx_rcc.c +++ b/arch/arm/src/stm32/stm32f30xxx_rcc.c @@ -660,6 +660,15 @@ static void stm32_stdclockconfig(void) #endif #if defined(CONFIG_RTC_LSECLOCK) + /* Normally peripheral clocks are enabled later in bootup, but we need + * clock on PWR *now* as without this setting registers that enable LSE + * won't work + */ + + regval = getreg32(STM32_RCC_APB1ENR); + regval |= RCC_APB1ENR_PWREN; + putreg32(regval, STM32_RCC_APB1ENR); + /* Low speed external clock source LSE * * TODO: There is another case where the LSE needs to