cancel
Showing results for 
Search instead for 
Did you mean: 

RTC is not keeping time during low power mode

viniciusfre
Associate II

I am configuring the CPU to wake up from UART reception and/or GPIO interrupt:

echo enabled > /sys/devices/platform/soc/4000f000.serial/tty/ttySTM1/power/wakeup

echo enabled /sys/devices/platform/soc/4000f000.serial/power/wakeup

And it goes to sleep with:

echo "mem" > /sys/power/state

After 1 hour in sleep mode, the time is 20 minutes slow. This is not happening in Run mode.

Additional Information:

  • Linux 5.4.31
  • 3.0V RTC battery backup

1 ACCEPTED SOLUTION

Accepted Solutions
viniciusfre
Associate II

Hello PatrickF,

Thanks for your response. That brought me to the solution. We need to "Set the System Time from the Hardware Clock" after wake up. The drift between system clock and RTC after wake up:

# date

Tue Mar 1 15:39:04 UTC 2022

# hwclock -r (RTC)

2022-03-01 15:49:04.894246+00:00

What it is fixed with: hwclock -s

View solution in original post

3 REPLIES 3
PatrickF
ST Employee

Hi @viniciusfre​ 

Need more details to analyze further.

Which board are you using ?

Are you sure about your 32k crystal ?

Did you keep default RTC LSE settings ?

Did you ensure RTC time is set with system time before going to low power mode ?

See https://wiki.st.com/stm32mpu/wiki/How_to_use_the_RTC#How_to_set_a_hardware_clock_using_the_hwclock_tool

Linux timedatectl command could help you to understand.

Regards,

Patrick

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
viniciusfre
Associate II

Hello PatrickF,

Thanks for your response. That brought me to the solution. We need to "Set the System Time from the Hardware Clock" after wake up. The drift between system clock and RTC after wake up:

# date

Tue Mar 1 15:39:04 UTC 2022

# hwclock -r (RTC)

2022-03-01 15:49:04.894246+00:00

What it is fixed with: hwclock -s

PatrickF
ST Employee

Nice to see it is ok.

Regards.

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.