cancel
Showing results for 
Search instead for 
Did you mean: 

STM32l053R8 standby mode with RTC wake up

LRPS_92
Associate II
Posted on July 25, 2017 at 09:43

Hi,

           I'm trying to configure the wake-up time period for the stm32l053 discovery board in standby mode . From my understanding of the datasheet provided, Internal RTC works with LSI (38 KHz) & It cannot be varied by a clock divider so it is fixed to ~38 KHz if MSI is used. 

I've used this following piece of code to achieve 20 sec delay

/*♯♯ Setting the Wake up time ♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯*/

/* RTC Wakeup Interrupt Generation:

Wakeup Time Base = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSE or LSI))

Wakeup Time = Wakeup Time Base * WakeUpCounter

= (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSE or LSI)) * WakeUpCounter

==> WakeUpCounter = Wakeup Time / Wakeup Time Base

To configure the wake up timer to 4s the WakeUpCounter is set to 0x1FFF:

RTC_WAKEUPCLOCK_RTCCLK_DIV = RTCCLK_Div16 = 16

Wakeup Time Base = 16 /(~39.000KHz) = ~0,410 ms

Wakeup Time = ~4s = 0,410ms * WakeUpCounter

==> WakeUpCounter = ~4s/0,410ms = 9750 = 0x2616 */

/* 0xBE6E - 20 sec */

HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, /*0x2616*/ 0xBE6E, RTC_WAKEUPCLOCK_RTCCLK_DIV16);

I can achieve only 28 Secs(Max.) Sleep time by setting wake up counter to full in Standby Mode with RTC. 

Is there any other way to decrease the frequency of internal RTC or how can i set the time period of wake-up to say 1 min??

Thanks in advance

#standbymode #rtc-wakeup #stm32l053
0 REPLIES 0