STM32H5 RTC register bug?
Hello
I have found a bug that stops updating the RTC_TR register. There is no problem with the RTC clock itself, it is ticking but the content of RTC_TR might in some specific use cases stop updating.
I use the latest STM32CubeH5 Firmware Package v1.5.0 for STM32H5.
The problem:
When only using the function HAL_RTC_GetTime(const RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format), the time stored in sTime is not updated. I even printed the content of RTC->TR and it is stuck, not updating.
However, when I use it together with HAL_RTC_GetDate(), the RTC->TR is changing. When stop calling the HAL_RTC_GetDate(), the RTC->TR is stuck.
With following example code, in C, I narrowed it down that it relates to access of RTC_SSR register.
void call_this_every_second(void) {
static int8_t time = 20;
if (time > 0) {
volatile uint32_t ssr = RTC->SSR;
if (time > 10) {
volatile uint32_t dr = RTC->DR;
}
--time;
} else if (time == 0) {
--time;
volatile uint32_t dr = RTC->DR;
}
printf("0x%lx\n", RTC->TR);
}The output will be:
0x0
0x1
0x2
0x3
0x4
0x5
0x6
0x7
0x8
0x9
0x10
0x11
0x11
0x11
0x11
0x11
0x11
0x11
0x11
0x11
0x11
0x11
0x22
0x23
0x24
0x25
0x26
Can someone confirm my findings?

