Skip to main content
Ukazu
Associate III
Aug 15, 2018 2:35 AM UTC
Question

[STM32F091VCH] HAL_RTCEx_SetWakeUpTimer_IT does not work, help me.

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 */

}

    This topic has been closed for replies.

    2 replies

    T J
    Senior III
    Aug 15, 2018 6:08 AM UTC

    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
    UkazuAuthor
    Associate III
    Aug 16, 2018 1:26 AM UTC

    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){"