AnsweredAssumed Answered

HAL RTC Date loss

Question asked by mahmoud boroumand on Feb 24, 2018

Hello

i use stm32f107vct6 and use cube and hal driver.

 

i init the rtc like example in the cube mx and it work.when i reset the time is correct but date have problem and doesn't 

save.

 

what can i do?

 

hrtc.Instance = RTC;


if (HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR1) != 0x32F2)
{

hrtc.Init.AsynchPrediv = RTC_AUTO_1_SECOND;
if (HAL_RTC_Init(&hrtc) != HAL_OK)
{
/* Initialization Error */
Error_Handler();
}

HAL_RTCEx_BKUPWrite(&hrtc, RTC_BKP_DR1, 0x32F2);
/* Configure RTC Calendar */
RTC_CalendarConfig();


}

Outcomes