How to have the RTC continue to count while powered by VBAT
I am using an STM32H753I-EVAL2 and the STM32CubeIDE. I am able to set up the RTC and print out its counting time. I do it on a FreeRTOS thread. I have JP11 configured such that VBAT is connected to the battery.
I set my RTC_TimeTypeDef globally:
RTC_TimeTypeDef sTime = {0};My task made with FreeRTOS to always get the time and print it:
void StartDefaultTask(void *argument) {
for(;;) {
HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
uint16_t milliSec = 1000 - (sTime.SubSeconds * 1000) / sTime.SecondFraction;
printf("-> Time Value: %.2d:%.2d:%.2d:%.3d\r\n", sTime.Hours, sTime.Minutes, sTime.Seconds, milliSec);
}
}When I have JP11 configured such that VBAT is connected to +3.3 V, and I unplug the primary power source and replug it back in, the time resets to 00:00:00:000. Yet when VBAT is connected to the coin battery, the time resumes from the time when it was unplugged.
I want it to continue counting while the battery powers it. What do I need to change?
Thank you,
Jared
