cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine the origin of Wakeup from Standby?

apolotsk
Associate II
Posted on February 16, 2015 at 21:41

I am studying awakening from Standby Mode on STM32F100CB.

I have this context: we set up WKUP pin and RTC Alarm, and go to Standby. Then, rising edge on WKUP pin or RTC Alarm wakes the system up.

Here are a few things that were determined experimentally (I could not find them documented in RM0041), and I'd like to check them with you:

1. It is impossible to determine what caused the wakeup: WKUP pin or RTC Alarm. (RTC_CRL & RTC_CRL_ALRF) is always 0 on the wakeup.

2. By default, RTC_ALR==0. Meaning that RCT Alarm will still wake the system up from Standby when RTC_CNT==0 (after RTC_CNT==0xFFFFFFFF), event if we don't call RTC_SetAlarm(tickstamp). This can be checked by calling RTC_SetCounter(0xFFFEFFFF), where 0xFFFEFFFF is some big number close to the upperbound value.

3. If programmable counter RCT_CNT overflows during Standby, the Overflow Interrupt will never be triggered (i.e. RTC_IRQHandler() will never be called), even after wakeup.

Are these statements correct?

#standby #rtc-alarm #wkup #f10x
4 REPLIES 4
apolotsk
Associate II
Posted on February 17, 2015 at 11:36

Correction: in point 2, RTC_ALR's reset value is 0xFFFFFFFF [RM0041 17.4.6], not 0.

Also, regarding point 2, there is no switch to disable/enable RTC Alarm in Standby mode, is there?

apolotsk
Associate II
Posted on February 19, 2015 at 13:10

Confirmation of all 3 observations can be concluded:

  - from [], where is shown that flags RTC_Alarm and RTC_Overflow are not set during standby, and also

  - from the fact that ''all registers are reset after wakeup from Standby except for Power control/status register (PWR_CSR)'' [RM0041 4.3.5].

The only question remains is whether there is a switch to disable/enable RTC Alarm in Standby mode.

damh
Associate II
Posted on February 20, 2015 at 07:30

You should keep in mind too, that the contents of the SR's of RCC/PWR/... are dependent of debug-unit is enabled or not!

You can use more flags with debugger connected than without ;)

Make a register dump of alle RCC/PWR/RTC registers in this four cases ([with debuger and not] x [from Wakeup-Interrupt and from RTC-Interrupt].

You will see the difference.

You should keep in mind, that the RTC-Interrupt is OR'ed to the Wakeup-Interrupt. If the Wakeup-Line is permanent 'high', the RTC-Interrupt (edge-triggered) won't happen at all!

In some cases it could be better to use the Watchdog instead. [if you wake up frequently with times below ~30s]

[all based on F103, but i think it is similar]
apolotsk
Associate II
Posted on February 20, 2015 at 21:55

damh, thank you!