cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1) How to set the date and keep it ?

hochul yoo
Associate III

Hello all ~

​I have STM32MP157A-EV1 and STM32MP157C-DK2. 

I want to change system time and keep it. 

But It is not working well. 

Below is the test log on EV1.

root@stm32mp1:~# date -s "20031025 18:00:00"
Sat Oct 25 18:00:00 UTC 2003
root@stm32mp1:~# date
Sat Oct 25 18:00:03 UTC 2003
root@stm32mp1:~#
root@stm32mp1:~# hwclock --systohc --utc
root@stm32mp1:~# hwclock
2003-10-25 18:00:18.632338+00:00
 
reboot ....
 
root@stm32mp1:~# date
Mon Jun 27 03:19:28 UTC 2022

Am I miss something?:sad_but_relieved_face: 

thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
Olivier GALLIEN
ST Employee

Hi @hochul yoo​ 

Topic already covered here :

https://st.force.com/community/s/question/0D53W000018ThWwSAK/hello-id-like-to-preserve-time-after-rebooting-when-no-internet-connection-is-present-every-time-i-reboot-i-get-the-same-date-which-i-presume-is-the-late-date-there-was-an-internet-connection-id-like-to-update-this-system-clock-with-the-cu...

Do you have a 3V battery on VBAT pin to keep time in absence of power ?

Olivier

Olivier GALLIEN
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.

View solution in original post

2 REPLIES 2
Olivier GALLIEN
ST Employee

Hi @hochul yoo​ 

Topic already covered here :

https://st.force.com/community/s/question/0D53W000018ThWwSAK/hello-id-like-to-preserve-time-after-rebooting-when-no-internet-connection-is-present-every-time-i-reboot-i-get-the-same-date-which-i-presume-is-the-late-date-there-was-an-internet-connection-id-like-to-update-this-system-clock-with-the-cu...

Do you have a 3V battery on VBAT pin to keep time in absence of power ?

Olivier

Olivier GALLIEN
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.

​Thanks,

I found the solution by link you provided. 

I need this commnd to set the system time from the RTC

hwclock --hctosys