2018-11-22 07:10 AM
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?
2018-11-22 08:47 AM
void main(void)
{
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
SystemClock_Config();
HAL_Init();
MX_RTC_Init();
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 1000, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
while(1);
}
void RTC_WKUP_IRQHandler(void)
{
HAL_RTCEx_WakeUpTimerIRQHandler(&hrtc);
}
I literally have this as the application with a breakpoint set in RTC_WKUP_IRQHandler and it doesn't get there. I'm absolutely baffled.
2018-11-23 01:19 AM
Bump, anybody?
2018-11-26 01:26 AM
ST Staff?
2018-11-27 04:19 AM
I've now duplicated the code from the example and it still doesn't work.
What am I missing here?
2018-11-27 01:10 PM
RTC_CR.WUTIE is set?
Is the corresponding EXTI line configured for proper (rising) edge and enabled in EXTI?
Check by reading out the appropriate registers content.
JW
2018-11-28 01:49 AM
@Community member
I assume you meant WUTE, yes that's enabled.
The EXTI is set correctly.
2018-11-28 07:43 AM
No, I mean WUTIE,
JW
2018-11-28 07:45 AM
Sorry, I didn't see it in my list - been staring at this way too long.
Yep, it's set.
2018-11-28 10:18 AM
I don't know, then. Sorry.
JW