Skip to main content
Visitor II
January 6, 2026
Question

STM32U5A9: Unable to set RTC_CR WUTIE and WUTE bits

  • January 6, 2026
  • 1 reply
  • 40 views

Hello,

We are using the RTC wakeup timer and I have noticed that sometimes the WUTIE and WUTE bits are not being set. We are using HAL_RTCEx_SetWakeUpTimer_IT() HAL function to enable the timer. In stepping through the HAL code, it sets the RTC_CR_WUTIE and RTC_CR_WUTE bits but does not check they are actually set, so I assume it is expected to set the bits.

I have read through the reference manual (RM0456) and existing errata. There is no existing errata w.r.t the RTC unit that applies to this situation.

Any insight would be appreciated.

Thanks,

Aidan

 

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    January 6, 2026

    hello @AidanBrowne

    Can you debug your project and add breakpoints at the point when the interrupt occurs?
    Sometimes, the bit is cleared immediately after it is set.
    You might have reviewed the register bits after they were cleared.
    If you check the HAL_RTCEx_SetWakeUpTimer_IT function, you see that the WUTE bit is cleared.

     HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock,
     uint32_t WakeUpAutoClr)
    {
    .....
    
     assert_param(WakeUpAutoClr <= WakeUpCounter);
     __HAL_LOCK(hrtc);
     hrtc->State = HAL_RTC_STATE_BUSY;
    
    
     /* WUTE bit is getting cleared here */
     CLEAR_BIT(RTC->CR, RTC_CR_WUTE);
    
     /* Clear flag Wake-Up */
     WRITE_REG(RTC->SCR, RTC_SCR_CWUTF);
    .....

     and in "HAL_RTCEx_DeactivateWakeUpTimer" for WUTIE bit

    CLEAR_BIT(RTC->CR, (RTC_CR_WUTE | RTC_CR_WUTIE));

     Hope that helps you
    Gyessine