Skip to main content
erik2399
Visitor II
February 12, 2016
Question

STM32Cube Bug - HAL_RTCEx_SetWakeUpTimer_IT

  • February 12, 2016
  • 0 replies
  • 593 views
Posted on February 12, 2016 at 22:42

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 callingHAL_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 theHAL_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);

#wakeup #rtc #stm32 #timer
This topic has been closed for replies.