2023-01-09 04:17 AM
I'm using STM32H753 on my board and the RTC to get date and time. I'm using the HAL library generated with STMCube. I have set the date and time and the RTC works fine keeping the date and time up to date. The problem is that after more or less 8 days that the board has been turned off, the RTC no longer updates the date and time and when I turn on the board, from the RTC I read an old date. On power up the INITS and RSF bits are set to 1 so the RTC indicates it is initialized and ready, but in this case shouldn't it indicate it has lost the date ? Shouldn't it have the default date and time (1/1/2000) ?
Is this the correct behaviour or there is something that I missed in the RTC configuration or in the check at power on before using RTC ?
Thank you
2023-01-09 05:22 AM
Sounds much like failing backup battery. What's its voltage?
JW
2023-01-09 06:07 AM
I have to check the exact value of the voltage, but yes, the voltage probably dropped below the working value of the RTC. I wonder what should happen to the RTC in this case and how the fw can figure out what happened. Shouldn't the RTC indicate that it is no longer initialized and shouldn't it have an invalid date ?
2023-01-09 08:23 AM
When it happens the voltage is below 1.2 V, but not below 0.7 V.
2023-01-09 09:03 AM
Is RTC clocked from external oscillator? Is 0.7V enough for it?
2023-01-09 10:58 AM
> Shouldn't the RTC indicate that it is no longer initialized and shouldn't it have an invalid date ?
LSE typically stops working at higher voltage than is the backup-domain reset level. None of this is characterized by ST particularly well (there's even a related erratum which may or may not pertain to your particular STM32).
JW
2023-01-10 02:36 AM
LSE is used for RTC
2023-01-10 03:22 AM
Yes this is exactly what we suspect. Need to find the min. battery voltage needed for normal LSE operation.
How to detect whether the LSE failed or died after the MCU wakes up ... this is a different question.
2023-01-11 12:40 PM
And is possible to know if LSE failed when the device is powered on again to know that RTC has not updated the calendar ?
Bit LSECSSD of the register RCC_BDCR can help ?
Or enable RTC tamper (tamper 3 ?) to reset RTC backup register when LSE fails ?
Thank you
2023-01-11 03:45 PM
There's probably no mechanism to do that during powerdown, but maybe you can measure voltage on VBAT when VDD is restored (unless you charge what's there - presumably supercap - through a diode).
In many cases it's just so easier to use a primary Li cell such as a 2032, although they are not perfect either and you still have to monitor their health.
JW