Skip to content

Commit 04a31a1

Browse files
committed
Use backup register API
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 5daff6e commit 04a31a1

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

cores/arduino/stm32/clock.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
*
3636
******************************************************************************
3737
*/
38+
#include "backup.h"
3839
#include "clock.h"
3940
#include "stm32yyxx_ll_cortex.h"
4041

@@ -98,6 +99,8 @@ void enableClock(sourceClock_t source)
9899
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
99100
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
100101

102+
enableBackupRegister();
103+
101104
switch (source) {
102105
case LSI_CLOCK:
103106
#ifdef STM32WBxx
@@ -118,16 +121,6 @@ void enableClock(sourceClock_t source)
118121
}
119122
break;
120123
case LSE_CLOCK:
121-
/* Enable Power Clock */
122-
#if !defined(STM32H7xx) && !defined(STM32WBxx)
123-
if (__HAL_RCC_PWR_IS_CLK_DISABLED()) {
124-
__HAL_RCC_PWR_CLK_ENABLE();
125-
}
126-
#endif
127-
#ifdef HAL_PWR_MODULE_ENABLED
128-
/* Allow access to Backup domain */
129-
HAL_PWR_EnableBkUpAccess();
130-
#endif
131124
if (__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) {
132125
#ifdef __HAL_RCC_LSEDRIVE_CONFIG
133126
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);

0 commit comments

Comments
 (0)