cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 nucleo board internal rtc problem.

AVINASH PATHAK
Associate II
Posted on August 28, 2017 at 13:22

The original post was too long to process during our migration. Please click on the attachment to read the original post.
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on August 30, 2017 at 12:37

get the time, then get the date, too.  does the behavior change?

View solution in original post

7 REPLIES 7
john doe
Lead
Posted on August 28, 2017 at 13:38

what happens when you get the time, then get the date?

RTC_TimeTypeDef RTC_Time;
RTC_DateTypeDef RTC_Date;
HAL_RTC_GetTime(&hrtc,&RTC_Time,RTC_FORMAT_BCD);
HAL_RTC_GetDate(&hrtc, &RTC_Date, RTC_FORMAT_BCD);�?�?�?�?�?

AVINASH PATHAK
Associate II
Posted on August 29, 2017 at 09:13

Please explain I didn't get what you mean to say.

Posted on August 29, 2017 at 16:51

Hi,

Some boards comes with no X2 crystal, did you check yours? if it don't have, you must to change the rtc reference to the LSI RC or solder one crystal.

Posted on August 30, 2017 at 07:24

I have tried that option also.I have given clock to RTC by LSI even though the problem is same.

Posted on August 30, 2017 at 13:08

From the documentation:

You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values in the higher-order calendar shadow registers to ensure consistency between the time and date values.

Reading RTC current time locks the values in calendar shadow registers until Current date is read

to ensure consistency between the time and date values.

As

doe.john.016

‌ already suggested, any time you are reading the time you should also read the date.

Posted on August 30, 2017 at 12:37

get the time, then get the date, too.  does the behavior change?

Posted on August 30, 2017 at 13:54

Thanks It worked and solved my problem.