Skip to main content
Associate II
January 24, 2025
Solved

RTC not working after Cube IDE update 1.17

  • January 24, 2025
  • 6 replies
  • 3331 views

Hello,

My STM32L476RG Nucleo board does not read out the RTC time after i updated cube IDE to 1.17

When calling "HAL_RTC_GetTime" the subtask in "stm32l4xx_hal_rtc.c" sTime->Hours = (uint8_t)((tmpreg & RTC_TR_HT|RTC_TR_HU))>>RTC_TR_HU_Pos); the current time is NOT written into the sTime.Hours or Minutes. The MCU stucks with the current value that it got during a reset. Interestingly when doing a reset the value changes to the real internal time that ran when the supply is not removed.

 

When i go to "Debug" i can read out the MCU registers TR,HU,.... and when i am watching into that registers, the MCU works normally and writes the sTime.Minutes and Hours correctly.

 

Does anybody know why the MCU does not get the Time data, only when reseting or "debugging the registers"?

Best answer by Tine1994

I found the solution:

 

https://community.st.com/t5/stm32-mcus-products/rtc-isn-t-updating-time-in-free-running-mode/td-p/648713

 

The shadow registers seems to be the problem, i do not know exactly why but i had to enable bypassing with:

 

HAL_RTCEx_EnableBypassShadow(&hrtc);

 

after init before while(1)

 

We can close this post, Question solved :)

6 replies

Andrew Neil
Super User
January 24, 2025

@Tine1994 wrote:

after i updated cube IDE to 1.17


What version were you using previously?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tine1994Author
Associate II
January 24, 2025

It was 1.13, but i did a new project with 1.17 to check that it is not a problem from the previous written project.

Andrew Neil
Super User
January 24, 2025

So does the new project, written from scratch in v1.17, work?

And the project "inherited" from v1.13 doesn't?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tine1994Author
Associate II
January 24, 2025

Both projects are not working. Also if i do a new from scratch in 1.17. Is there a problem with the libraries maybe during the update?

Tine1994Author
Associate II
January 24, 2025

I did now a complete reinstallation of Cube IDE with 1.17 and made a new project with the copied main.c to test the RTC. It has still the same problem. The MCU does not refresh the sTime variables when running.

 

What is the difference when i am opening the SFRs in Debug mode and read out the RTC registers compared to when i am not touching the SFRs in Debug mode?

 

When clicking on the RTC registers, it works fine. When kept close it doesn´t.

Tine1994AuthorBest answer
Associate II
January 25, 2025

I found the solution:

 

https://community.st.com/t5/stm32-mcus-products/rtc-isn-t-updating-time-in-free-running-mode/td-p/648713

 

The shadow registers seems to be the problem, i do not know exactly why but i had to enable bypassing with:

 

HAL_RTCEx_EnableBypassShadow(&hrtc);

 

after init before while(1)

 

We can close this post, Question solved :)

waclawek.jan
Super User
January 26, 2025

In non-bypass (default) case, you have to read date after time.

JW