Skip to main content
Graduate
March 11, 2024
Solved

RTC isn't updating time in free running mode

  • March 11, 2024
  • 5 replies
  • 3438 views

Hi All,

I am facing problem with RTC in STM32.i have written function in my code where i am updating display function for time every 1 min. But whenever i am trying to  see the updated time in free running mode i am unable to see that. But it works fine in debugging mode or at power on or when i program microcontroller.

Please suggest what can be done to resolve this issue? Thanking you in advance.

    This topic has been closed for replies.
    Best answer by AScha.3

    Hi,

    from HAL lib:

    @note You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values

    -- but call date first.... :)

    +

    on which cpu ?  (Maybe problem with cache...?)

    5 replies

    ST Employee
    March 11, 2024

    Hello @Rushali

    This seems to be related to the shadow registers update, to be sure, you can enable the bypass shadow (RTC_CR_BYPADHAD) in your main function, to see if the issue is fixed.

    Also, please specify the stm32 product you are using! 

    Thank you!

     

    RushaliAuthor
    Graduate
    March 12, 2024

    Dear @Sarra.S 

    I have checked with 

    HAL_RTCEx_EnableBypassShadow(&hrtc1); by using this command still not able to see the updated time on screen

    RushaliAuthor
    Graduate
    March 15, 2024

    Dear All,

    Can anybody help me with above problem????????.............

    ST Employee
    March 15, 2024

    Hello @Rushali, sorry for the delayed answer 

    >>But whenever i am trying to  see the updated time in free running mode i am unable to see that.

    Can please elaborate more on your problem so we can help you! 

    RushaliAuthor
    Graduate
    March 18, 2024

    I have attached file along with this post for you to get a better idea about the code .

    RushaliAuthor
    Graduate
    March 18, 2024

    Dear @Sarra.S 

    I have attached file along with this post for you to get a better idea about the code .

    AScha.3Answer
    Super User
    March 18, 2024

    Hi,

    from HAL lib:

    @note You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values

    -- but call date first.... :)

    +

    on which cpu ?  (Maybe problem with cache...?)

    RushaliAuthor
    Graduate
    March 18, 2024

    hey hii @AScha.3 

    It works fine after calling rtc_get_time first and rtc_get_date later. Thank you.