STM32 RTC resets itself
Hello,
I have troubles with the STM32L467. I am using the RTC without any extra settings like alarm or tamper. I have set the time via STM32Cube and at some points in the code the chip reads out the time.
My problem is that after some time the time is reset without making any reset to the chip.
Here an output:
First output:
sDate.Year = 17
sDate.Month = 7
sDate.Date = 10
sTime.Hours = 13
sTime.Minutes = 17
sTime.Seconds = 10
� some time passes by �
Second output:
sDate.Year = 0
sDate.Month = 0
sDate.Date = 0
sTime.Hours = 0
sTime.Minutes = 0
sTime.Seconds = 0
I have found in the errata sheet that there are some troubles with the tamper detection. That�s why I tried the following code:
hrtc.Instance->TAMPCR |= (1 << 23); // TAMP3NOERASE (Bit 23)
HAL_Delay(5);
hrtc.Instance->TAMPCR &= ~(1 << 5);
HAL_Delay(5);
hrtc.Instance->TAMPCR |= (1 << 20); // TAMP2NOERASE (Bit 20)
HAL_Delay(5);
hrtc.Instance->TAMPCR &= ~(1 << 3);
HAL_Delay(5);
hrtc.Instance->TAMPCR |= (1 << 17); // TAMP1NOERASE (Bit 17)
HAL_Delay(5);
hrtc.Instance->TAMPCR &= ~(1 << 0);
HAL_Delay(5);
But it didn�t work. Is there something that I am missing?
Many thanks in advance!
Nikola
#errata #rtc #stm32l4 #stm32l476 #issue