cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32F091VCH] HAL_RTCEx_SetWakeUpTimer_IT does not work, help me.

Ukazu
Associate III

I want to enter the CPU in stop mode and wakeup the CPU using RTC wakeup.

I wrote the following code.

----

(void)HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 2-1, RTC_CR_WUCKSEL_2);

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON,PWR_STOPENTRY_WFI);

/* STOP MODE */​

/* wakeup */

HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);

----

Question

I expect RTC_IRQHandler to be called.

But RTC_IRQHandler will not call.

why.

void RTC_IRQHandler(void)

{

 /* USER CODE BEGIN RTC_IRQn 0 */

 UserRTC_Int();

 /* USER CODE END RTC_IRQn 0 */

 HAL_RTCEx_WakeUpTimerIRQHandler(&hrtc);

 /* USER CODE BEGIN RTC_IRQn 1 */

 /* USER CODE END RTC_IRQn 1 */

}

2 REPLIES 2
T J
Lead

do you know if the RTC is running ?

did you use the cube ?

is this all of your code ?

If you put a breakpoint at this line , it never gets there ?

HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);

Ukazu
Associate III

thank you!!

Yes. I used a cube.

I solved this problem.

HAL_RTC_MspInit() was not executed, no interrupt occurred.

It did not call in MX_RTC_Init().

I deleted "if(HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR0) != 0x32F2){"