cancel
Showing results for 
Search instead for 
Did you mean: 

about changing RTC wakeup counter in run time

jones
Associate
Posted on August 05, 2016 at 05:04

Dear all,

I am using stm32L151VD.

I got an application which needs to change the RTC wakeup counter reload value in run time. My original wake up period is 1/16s. And then I use the code below to change the wake up period to 10s.

 /* Allow access to RTC */

  PWR_RTCAccessCmd(ENABLE);

  RTC_WakeUpCmd(DISABLE);

  RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div16);

  RTC_SetWakeUpCounter(0x5000  - 1); /* wake-up at 10s*/

  RTC_ClearFlag(RTC_FLAG_WUTF); 

  EXTI_ClearITPendingBit(EXTI_Line20);

/* Enable Wakeup Counter */

  RTC_WakeUpCmd(ENABLE);

/* Disallow access to RTC */

  PWR_RTCAccessCmd(DISABLE);

Although the wakeup time changed eventually, but it will trigger one interrupt (old 1/16s interrupt )before the 10s reload value apply. Any idea how to eliminate that unwanted interrupt? 

#stm32-rtc
0 REPLIES 0