cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in HAL driver for STM32L432 RTC wakeup

Peter Mather
Associate III

The RTC wakeup interrupt uses EXTI-20. Unfortunately the HAL drivers do not properly enable the interrupt. Adding

EXTI->IMR1|=(1<<20);

after HAL_RTCEx_SetWakeUpTimer_IT fixes the issue

4 REPLIES 4

If you are using STM32CubeMX you should enable it there before generating the code - enable the RTC Clock Source, RTC Calendar, RTC Internal WakeUp, then go to the Confguration tab, and enable the RTC wakeup interrupt in the RTC's NVIC Settings tab.

Peter Mather
Associate III

I did and it doesn't - that is the problem

kerya33
Associate

Hi, for STM32Cube_FW_L0_V1.11.2 in stm32l4xx_hal_rtc_ex.c

must fixes

HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)

...

#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(); /* this bug*/

 __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT();

#endif /* defined(STM32L412xx) || defined(STM32L422xx) */

Excuse me, in previos post must be

STM32Cube_FW_L4_V1.13.0