Skip to content

Commit 85c337d

Browse files
committed
STM32 LOW_POWER_TIMER update : rtc_init procedure
1 parent c13ffaf commit 85c337d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

targets/TARGET_STM/rtc_api.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ void rtc_init(void)
5555
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
5656

5757
// Enable access to Backup domain
58+
__HAL_RCC_PWR_CLK_ENABLE();
5859
HAL_PWR_EnableBkUpAccess();
5960

61+
if (rtc_isenabled()) {
62+
return;
63+
}
64+
6065
#if !RTC_LSI /* => LSE */
6166
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
6267
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
@@ -76,12 +81,7 @@ void rtc_init(void)
7681
error("PeriphClkInitStruct RTC failed with LSE\n");
7782
}
7883

79-
if (rtc_isenabled()) return;
8084
#else /* => RTC_LSI */
81-
if (rtc_isenabled()) return;
82-
83-
__HAL_RCC_PWR_CLK_ENABLE();
84-
8585
// Reset Backup domain
8686
__HAL_RCC_BACKUPRESET_FORCE();
8787
__HAL_RCC_BACKUPRESET_RELEASE();

0 commit comments

Comments
 (0)