cancel
Showing results for 
Search instead for 
Did you mean: 

RTC alarm - does this work if the MCU is already in shutdown ?

freeflyer
Senior

Does HAL_RTC_AlarmAEventCallback work if the the MCU is in shutdown ?

I am using 

  • RTC wake-up timer for wake/shutdown cycling
  • RTC alarm for shutdown trigger via HAL_RTC_AlarmAEventCallback

But:

  • RTC Alarm A interrupt never fires if the MCU is in Shutdown mode waiting for the RTC Wake-Up timer.

For test purposes I am using the following values:

  • Wake cycle set to 10 seconds
  • Shutdown cycle set to 5 seconds
  • Alarm set to 28 seconds

From power up the MCU should run as follows...

1. Wake cycle for 10 seconds
2. Shutdown cycle for 5 seconds
3. Wake cycle for 10 seconds
4. Shutdown cycle for 5 seconds..... but after 3 seconds the alarm time is reached (28 seconds). 

5. When the alarm occurs.... RTC wake is disabled and WKUP pin wake is enabled, then shutdown is called.
6. The MCU must not wake until the WKUP pin is detected

Refer to the timing diagram below...

Picture2.jpg

I was hoping that if the alarm occurs during the 5 second shutdown cycle it would call the alarm interrupt in the next wake cycle.  But it appears to be missed entirely ?

PS. I am using the Nucleo-L433RC-P board and the clock is set to LSE

1 REPLY 1
Sarra.S
ST Employee

Hello @freeflyer

What is the clock source for the RTC?

The RTC is only functional in Shutdown mode when it is clocked by the LSE,

If it’s running on the LSI, it won’t work when the system is in Shutdown mode.

You can check the details in this table from the reference manual: 

 

SarraS_1-1754398567946.png

Hope that helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.