cancel
Showing results for 
Search instead for 
Did you mean: 

Can I configure STM32L0 to wake up from Standy Mode Every 15 minutes with RTC?

Bruno Sena
Associate II

I'm using LSI clock, I just have ALRMA for:

1second

1 minute

1 hour.

I woul like to configure it for every 15 second, every 15 minutes.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

You'd need to reconfigure the alarm at each wakeup. For example, to wake up every 15 seconds, you'd have unmasked the seconds (and masked the minutes etc. fields); and then upon each wakeup write to the seconds fields the next time of wakeup, in the 00-15-30-45 sequence.

If you need regular wakeup, maybe it's more efficient to use the wakeup timer (RTC_WUTR).

JW

View solution in original post

4 REPLIES 4

You'd need to reconfigure the alarm at each wakeup. For example, to wake up every 15 seconds, you'd have unmasked the seconds (and masked the minutes etc. fields); and then upon each wakeup write to the seconds fields the next time of wakeup, in the 00-15-30-45 sequence.

If you need regular wakeup, maybe it's more efficient to use the wakeup timer (RTC_WUTR).

JW

Sorry about the time to answer.

I used the wakeup timer, and this works fine for my application.

Bruno Sena

@Bruno Sena​ 

How did you configure the wakeup timer?

I am trying it with CUBEMX. -> In the STM32F44_en.DM00135183.pdf under section 22.3.4 "Periodic auto-wakeup"

I found:

The wakeup timer clock input can be:

• RTC clock (RTCCLK) divided by 2, 4, 8, or 16.

When RTCCLK is LSE(32.768 kHz), this allows to configure the wakeup interrupt

period from 122 μs to 32 s, with a resolution down to 61μs.

• ck_spre (usually 1 Hz internal clock)

When ck_spre frequency is 1Hz, this allows to achieve a wakeup time from 1 s to

around 36 hours with one-second resolution. This large programmable time range is

divided in 2 parts:

– from 1s to 18 hours when WUCKSEL [2:1] = 10

– and from around 18h to 36h when WUCKSEL[2:1] = 11. In this last case 216 is

added to the 16-bit counter current value.When the initialization sequence is complete (see Programming the wakeup timer), the timer starts counting

down.When the wakeup function is enabled, the down-counting remains active in

low power modes. In addition, when it reaches 0, the WUTF flag is set in the

RTC_ISR register, and the wakeup counter is automatically reloaded with its

reload value (RTC_WUTR register value).

-> programming the wakeup timer:

The following sequence is required to configure or change the wakeup timer auto-reload

value (WUT[15:0] in RTC_WUTR):

1. Clear WUTE in RTC_CR to disable the wakeup timer.

2. Poll WUTWF until it is set in RTC_ISR to make sure the access to wakeup auto-reload

counter and to WUCKSEL[2:0] bits is allowed. It takes 1 to 2 RTCCLK clock cycles

(due to clock synchronization).

3. Program the wakeup auto-reload value WUT[15:0] and the wakeup clock selection

(WUCKSEL[2:0] bits in RTC_CR).Set WUTE in RTC_CR to enable the timer again.

The wakeup timer restarts down-counting. Due to clock synchronization, the WUTWF

bit is cleared up to 2 RTCCLK clocks cycles after WUTE is cleared.

Lets say for every 15 min?

Beste Regards

Ibrahim Evren

IEEE
Associate

(respond before)

• ck_spre (usually 1 Hz internal clock)

When ck_spre frequency is 1Hz, this allows to achieve a wakeup time from 1 s to

around 36 hours with one-second resolution.

I have configured the wakeup Timer with CubeMx:

For 3 Seconds:

0690X000006CSylQAG.png

In the main.c File I added and using the Wakeup-Callback function:

0690X000006CSz5QAG.png