HAL_RTCEx_SetWakeUpTimer_IT issue (STM32L475RC)
Hi,
I'm really struggling with this, I cannot find any reason for the problem I'm seeing, I've looked at the example code in the firmware packages and I have identical code to the examples.
I'm using HAL to configure the project, the RTC is clocked from LSE which is up and running.
I call:
MX_RTC_Init();
And I can see that the registers change as expected.
I then call:
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x5000, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
Which should result the RTC_WKUP_IRQHandler being called, but it never is.
If I look after 10 seconds at the RTC status registers I can see that WUTF is set.
I've tried adding:
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
In various places as it seems that may be required after reading around, but it makes no difference, I cannot get the interrupt to fire, other interrupts from other peripherals are working fine.
My HAL_RTC_MspInit has the following code:
__HAL_RCC_RTC_ENABLE();
HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
Any suggestions?
