Skip to main content
phlf
Associate
December 6, 2018
Question

RTC - [STM32CubeL4][1.13.0][stm32l4xx_hal_rtc_ex] Missing EXTI interrupt activation

  • December 6, 2018
  • 0 replies
  • 588 views

Problem:

RTC Wakeup interrupt is not working on STM32L4 after calling the HAL_RTCEx_SetWakeUpTimer_IT.

Cause:

A preprocessor macro check rules out a call to the __HAL_RTC_WAKEUP_EXTI_ENABLE_IT for uC other than STM32L412xx / STM32L422xx in the file stm32l4xx_hal_rtc_ex.c

Fix:

Add a call to __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT just before __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT line 912:

#if defined(STM32L412xx) || defined(STM32L422xx)
 /* In case of WUT autoclr, the IRQ handler should not be called */
 if (WakeUpAutoClr != 0u)
 {
 /* RTC WakeUpTimer EXTI Configuration: Event configuration */
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT();
 }
 else
 {
 /* RTC WakeUpTimer EXTI Configuration: Interrupt configuration */
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT();
 }
#else /* defined(STM32L412xx) || defined(STM32L422xx) */
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT();
#endif /* defined(STM32L412xx) || defined(STM32L422xx) */

becomes:

#if defined(STM32L412xx) || defined(STM32L422xx)
 /* In case of WUT autoclr, the IRQ handler should not be called */
 if (WakeUpAutoClr != 0u)
 {
 /* RTC WakeUpTimer EXTI Configuration: Event configuration */
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT();
 }
 else
 {
 /* RTC WakeUpTimer EXTI Configuration: Interrupt configuration */
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT();
 }
#else /* defined(STM32L412xx) || defined(STM32L422xx) */
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT();
 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT();
#endif /* defined(STM32L412xx) || defined(STM32L422xx) */

This topic has been closed for replies.