2016-11-30 07:21 AM
Hi,
The latest release of RTC HAL library (1.6.0) for STM32L4 does not clear the RTC ALARM interrupt flag.
The following code from the function
''void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef* hrtc)''
/* Clear the AlarmA interrupt pending bit */
__HAL_RTC_ALARM_CLEAR_FLAG(hrtc, RTC_FLAG_ALRAF);Does nothing !
the only way to clear the ALARMA flag is add a custom instruction like
hrtc->Instance->ISR = hrtc->Instance->ISR & 0xFFFFFEFF; // Clear Alarm A flag
Any idea ?
Is that problem affecting other peripherals ?
Kind regards
F.c
2016-11-30 08:00 AM
Hello,
Have you try this with an exist example? You can start with a working RTC_alarm example within STM32cubeL4 in order to deduce what is going wrong in your case.This may helps you: STM32Cube_FW_L4_V1.6.0\Projects\STM32L476G_EVAL\Examples\RTC\RTC_AlarmRegards2016-11-30 08:28 AM
Hi,
Thank you for the suggestion. I forgot to tell that it was a perfect running firmware created with CUBEMX 4.17 and using the HAL library version 1.5.2 !
I just update it using CUBEMX 4.18 and new library version 1.6.0 So the problem is somewhere else not in my code. By debugging the code when an alarm is raised by the RTC I saw that the execution is blocked in the function Void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef* hrtc) indefinitely In this function there is WHILE that has been added in the new Library 1.6.0.Not clearing the ALARM flag it enter in an infinite loop !
Maybe the problem was present even in old library but as there was not the WHILE !... Kind Regardsf.c.
2017-10-20 01:43 AM
Did you manage to solve this? I am having this problem and I don't know what else I can try... I tried removing the while loop but then I just get the first ALARM A to work. Nor the alarm b, neither second alarm a.
2017-10-29 03:18 AM
I see the same problem, the code:
__HAL_RTC_ALARM_CLEAR_FLAG(hrtc, RTC_FLAG_ALRAF);
does not clear the interrupt flag.
I found a solution that works for me, though it makes no sense, I use the call back (I override the weak function as to not interfere with the generated code from Cube):
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
{
HAL_PWR_EnableBkUpAccess();
LL_RTC_ClearFlag_ALRA(hrtc->Instance); HAL_PWR_DisableBkUpAccess();}
2017-10-30 01:01 AM
As I have seen, when you block backup access, you cannot modify flag values. So In the end I did something like you. Enable backup access, operate and then disable it again.
Thank you for your response Clonimus74.