Skip to content

Commit dd3a59c

Browse files
committed
[RTC] Allow access to Backup domain
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent f1243f5 commit dd3a59c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cores/arduino/stm32/rtc.c

+13
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,19 @@ void RTC_init(hourFormat_t format, sourceClock_t source)
314314
{
315315
initFormat = format;
316316

317+
/* Enable Power Clock */
318+
__HAL_RCC_PWR_CLK_ENABLE();
319+
320+
#ifdef HAL_PWR_MODULE_ENABLED
321+
/* Allow access to Backup domain */
322+
HAL_PWR_EnableBkUpAccess();
323+
#endif
324+
/* Reset RTC Domain */
325+
if(source != LSE_CLOCK) {
326+
__HAL_RCC_BACKUPRESET_FORCE();
327+
__HAL_RCC_BACKUPRESET_RELEASE();
328+
}
329+
317330
/* Init RTC clock */
318331
RTC_initClock(source);
319332

0 commit comments

Comments
 (0)