arch/arm/src/: Problem: stm32f30xx hangs waiting for LSE to initialize. Reason for hang is that operation of setting LSE_ON does not take effect because there is no clock on PWR peripheral. this is initialized later in the code

This commit is contained in:
Michał Łyszczek 2018-04-11 16:02:12 -06:00 committed by Gregory Nutt
parent 7ae14be1de
commit da6dcb06b7
2 changed files with 10 additions and 0 deletions

View File

@ -7365,6 +7365,7 @@ choice
config RTC_LSECLOCK
bool "LSE clock"
select STM32_PWR
---help---
Drive the RTC with the LSE clock

View File

@ -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