From 7b3f0110c6768231eb5c03eef32bcf87bd48061e Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 26 Oct 2023 11:29:26 +0200 Subject: [PATCH] fix(backup): enable RTC clock for TAMP backup registers Fixes #2152. Signed-off-by: Frederic Pillon --- cores/arduino/stm32/backup.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cores/arduino/stm32/backup.h b/cores/arduino/stm32/backup.h index 63cf7bb22d..9965f68c79 100644 --- a/cores/arduino/stm32/backup.h +++ b/cores/arduino/stm32/backup.h @@ -86,6 +86,10 @@ static inline void enableBackupDomain(void) /* Enable BKPSRAM CLK for backup SRAM */ __HAL_RCC_BKPSRAM_CLK_ENABLE(); #endif +#if defined(TAMP_BKP0R) && defined(__HAL_RCC_RTCAPB_CLK_ENABLE) + /* Enable RTC CLK for TAMP backup registers */ + __HAL_RCC_RTCAPB_CLK_ENABLE(); +#endif } static inline void disableBackupDomain(void) @@ -102,6 +106,10 @@ static inline void disableBackupDomain(void) /* Disable BKP CLK for backup registers */ __HAL_RCC_BKP_CLK_DISABLE(); #endif +#if defined(TAMP_BKP0R) && defined(__HAL_RCC_RTCAPB_CLK_DISABLE) + /* Disable RTC CLK for TAMP backup registers */ + __HAL_RCC_RTCAPB_CLK_DISABLE(); +#endif } static inline void setBackupRegister(uint32_t index, uint32_t value)