cancel
Showing results for 
Search instead for 
Did you mean: 

RTC resets or stalls even with backup battery

unicyclebloke
Associate III

I have an application running on STM32G491 which uses the RTC. There is an external 32768Hz crystal and a backup coin cell battery (I have checked that it is not depleted: 3.12V). There are two issues:

Scenario #1: I pull the main battery, wait a bit, re-insert it, and restart the firmware (I hold a power button until a power latch is toggled on by the firmware). The RTC loses the time and resets to zero roughly half the time. The RTC initialisation code calls  HAL_RCCEx_PeriphCLKConfig() and then HAL_RTC_Init(). I periodically call HAL_RTC_GetTime() followed by HAL_RTC_GetDate() while the application is running.

Scenario #2: I don't pull the main battery but power down the device a bit more gracefully (I hold the power button until the power latch is toggled off). Then I restart the firmware as above. In this case it the RTC does not lose the time but it seems that the RTC does not increment during the powered-off period.

SystemClock_Config() enables the LSE and the RTC uses this as its clock source. However, I get the same issues if I switch to the LSI.

What could cause these issues?

Thanks.

 

0 REPLIES 0