cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U545 permanent RTC wakeup call

Fizzl92
Associate

Hello,

I am new to this cpu and experimenting with RTC wakeup using 32kHz LSE. I am usingthis code for the wakeup:

 

void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)

{

SystemClock_Config();

HAL_ResumeTick();

...

}

 

// In while(1)

HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x4E30, RTC_WAKEUPCLOCK_RTCCLK_DIV16, 0);

HAL_SuspendTick();

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

...

 

I removed the SetWakeUpTimer() function from MX_RTC_INIT().

It was working fine. I tweaked the MCU clock and generated the code with CubeIDE. I am not sure what went wrong but now its executing the callback (instead every 10s) instantly as fast as it can. I reverted everything i know about but still the same. Hope someone can give me a hint on what configurating i need to fix to make it work again.

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello @Fizzl92

Try HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE;

 

 

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.

View solution in original post

2 REPLIES 2
Sarra.S
ST Employee

Hello @Fizzl92

Try HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE;

 

 

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.

Fizzl92
Associate

Thank you very much! It works now with wake from Event. I did not know that RTC-wakeup is an event, not an interrupt. As in the CubeIDE calls it "RTC non-secure interrupt" i did not question it. And i think had it working once before with WFI...