cancel
Showing results for 
Search instead for 
Did you mean: 

HAL RTC Date loss

mahmoud boroumand
Associate III
Posted on February 24, 2018 at 09:39

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();

}
0 REPLIES 0