AnsweredAssumed Answered

STM32F4 RTC gets bad format values

Question asked by ROBERTO ARRIBAS on May 11, 2018
Latest reply on May 11, 2018 by ROBERTO ARRIBAS

Hi, I'm working with the RTC (LSE source) and I'm getting a bad format value, not a wrong value.

 

I call HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN); and HAL_RTC_GetDate(&hrtc, &sDate, RTC_FORMAT_BIN); to get the actual date and time, and when I represent it, it shows: "Thu 10/05/2018 36:08:13.219", when it really has to be "Fri 11/05/2018 12:08:13.219". The date and time would be fine if it had subtracted 24 hours in time and the day had been increased.

 

I've debugged HAL_RTC_GetTime and when it reads the TR register, it gets the following:
/* Get the TR register */
tmpreg = (uint32_t)(hrtc->Instance->TR & RTC_TR_RESERVED_MASK);
// tmpreg = 3541011 = 0x360813;

 

Any ideas of what may be happening?

 

Thanks in advance

Outcomes