AnsweredAssumed Answered

STM32Cube Bug - HAL_RTCEx_SetWakeUpTimer_IT

Question asked by info128 on Feb 12, 2016
I'm using the HAL libraries to set up and control the RTC features of an STM32F3 device.  The RTC is based on LSE, and is running fine.  However, when enabling the wakeup timer, no interrupt was ever generated after calling HAL_RTCEx_SetWakeUpTimer_IT().  

I found the solution: you must clear the wakeup timer flag and the EXTI Line flag (line 20 on this device) before any interrupt will be generated.  This is nowhere in the documentation and should be added, or added to the HAL_RTCEx_SetWakeUpTimer_IT function. Perhaps even adding an example project would be nice?

Here's the code that works:

HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
__HAL_RTC_CLEAR_FLAG(RTC_EXTI_LINE_WAKEUPTIMER_EVENT);

Outcomes