STM32F410 RTC fails on year
When writing to RTC and then reading back, my year is always off - writing 18 gives me back 21. Tried adding delays up to a second between instructions, no joy. Using Cube and MDK, RTC is running LSE 32768 and works fine otherwise. Both read and write depend on HAL libraries that I haven't touched.
typedef struct __TIME_INFO
{
RTC_TimeTypeDef sTime;
RTC_DateTypeDef sDate;
} TIME_INFO;
void rtc_updateRTCclock(TIME_INFO *t)
{
HAL_RTC_SetTime(&MAIN_RTC, &(t->sTime), RTC_FORMAT_BIN);
HAL_RTC_SetDate(&MAIN_RTC, &(t->sDate), RTC_FORMAT_BIN);
}
TIME_INFO rtc_getCurrentTime() {
TIME_INFO t;
HAL_RTC_GetTime(&MAIN_RTC, &(t.sTime), RTC_FORMAT_BIN);
HAL_RTC_GetDate(&MAIN_RTC, &(t.sDate), RTC_FORMAT_BIN);
return t;
}
