2019-10-18 10:54 AM
There is a situation with RTC of RTC get into infinite loop in file stm32f7xx_hal.c.
In the function HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc)
lines
while((hrtc->Instance->ISR & RTC_ISR_INITF) == (uint32_t)RESET) {
if((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
We encounter a situation that LSE is configured and works and RTC got into infinite loop in this while loop.
HAL_GetTick did not produce any ticks due to intermittent HW error, and it cause infinite loop.
Anyway, did STM think about the meaning that a device stop working due that this loop.
Programming in while loop with out any option to opt out is wrong.
There is easy solution but this is HAL driver which we would not like to change.
Any other solution from STM?
Thank you.
Elik
2019-10-19 12:41 AM
> Any other solution from STM?
I am not ST, but yes, of course, you can simply not use the function using this loop and write your own.
The primary concern here is, however, this:
> We encounter a situation that LSE is configured and works and RTC got into infinite loop in this while loop.
INITF flag gets set by a synchronizer driven by RTCCLK, so the only way how it won't get set is, that you don't have RTCCLK. In other words, either your "LSE is configured" piece of program is incorrect and does not guarantee LSE=>RTCCLK running, or your hardware is faulty and LSE is unstable and stops when you get to that loop. Get sorted out that first; you can't write any reasonable program with unreliable hardware.
JW
2019-10-20 08:17 AM
Thank you JW,
In my case the LSE=>RTCCLK is fine and LSE is not faulty.
My point is that the HAL driver code is a bad programming practice, especially for system that the RTC is not crucial and should not stop the whole system even if LSE becomes faulty.
EL