From 10eeff30e7ac6cd5a34a26918ae946594353553f Mon Sep 17 00:00:00 2001
From: Gregory Nutt <gnutt@nuttx.org>
Date: Sun, 19 Apr 2015 06:58:07 -0600
Subject: [PATCH] STM32 F1 RTC Counter:  Now need to enable backup domain write
 access when setting the time.  From Darcy Gong

---
 arch/arm/src/stm32/stm32_rtcounter.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/src/stm32/stm32_rtcounter.c b/arch/arm/src/stm32/stm32_rtcounter.c
index 28efd296bb..c539a390e1 100644
--- a/arch/arm/src/stm32/stm32_rtcounter.c
+++ b/arch/arm/src/stm32/stm32_rtcounter.c
@@ -594,6 +594,10 @@ int up_rtc_settime(FAR const struct timespec *tp)
 
   stm32_rtc_breakout(tp, &regvals);
 
+  /* Enable write access to the backup domain */
+
+  (void)stm32_pwr_enablebkp(true);
+
   /* Then write the broken out values to the RTC counter and BKP overflow register
    * (hi-res mode only)
    */
@@ -608,6 +612,8 @@ int up_rtc_settime(FAR const struct timespec *tp)
   putreg16(regvals.ovf, RTC_TIMEMSB_REG);
 #endif
   irqrestore(flags);
+
+  (void)stm32_pwr_enablebkp(false);
   return OK;
 }
 
-- 
GitLab