[LL][RTC] Avoid waiting for the RSF bit to be cleared in the LL_RTC_WaitForSynchro() API to prevent getting stuck in an infinite loop
diff --git a/Src/stm32l4xx_ll_rtc.c b/Src/stm32l4xx_ll_rtc.c
index 956e1a5..179e76f 100644
--- a/Src/stm32l4xx_ll_rtc.c
+++ b/Src/stm32l4xx_ll_rtc.c
@@ -808,7 +808,7 @@
/* Wait the registers to be synchronised */
tmp = LL_RTC_IsActiveFlag_RS(RTCx);
- while ((timeout != 0U) && (tmp != 0U))
+ while ((timeout != 0U) && (tmp != 1U))
{
if (LL_SYSTICK_IsActiveCounterFlag() == 1U)
{
@@ -821,24 +821,6 @@
}
}
- if (status != ERROR)
- {
- timeout = RTC_SYNCHRO_TIMEOUT;
- tmp = LL_RTC_IsActiveFlag_RS(RTCx);
- while ((timeout != 0U) && (tmp != 1U))
- {
- if (LL_SYSTICK_IsActiveCounterFlag() == 1U)
- {
- timeout--;
- }
- tmp = LL_RTC_IsActiveFlag_RS(RTCx);
- if (timeout == 0U)
- {
- status = ERROR;
- }
- }
- }
-
return (status);
}