Skip to main content
AVINASH PATHAK
Associate III
August 28, 2017
Solved

STM32 nucleo board internal rtc problem.

  • August 28, 2017
  • 4 replies
  • 1422 views
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.
    This topic has been closed for replies.
    Best answer by john doe
    Posted on August 30, 2017 at 12:37

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

    4 replies

    john doe
    Senior III
    August 28, 2017
    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 III
    August 29, 2017
    Posted on August 29, 2017 at 09:13

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

    john doe
    john doeBest answer
    Senior III
    August 30, 2017
    Posted on August 30, 2017 at 12:37

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

    Elkin Granados
    Associate II
    August 29, 2017
    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.

    AVINASH PATHAK
    Associate III
    August 30, 2017
    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.

    After Forever
    Senior III
    August 30, 2017
    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.

    AVINASH PATHAK
    Associate III
    August 30, 2017
    Posted on August 30, 2017 at 13:54

    Thanks It worked and solved my problem.