Page 1 of 2
Time and date wrong on RevPi: RTC backup not working?
Posted: 18 Sep 2019, 14:23
by raydodo
Hello all
I hope this has a simple answer, but I have spent hours looking for a solution and I am now more confused.
My RevPi has the wrong time and date. I can set it correctly using "
...." but the next day it is incorrect again. I understand that the RevPi has a 24h (min.) RTC backup. I then thought I was not setting the RTC using this command so I followed this post:
https://revolution.kunbus.com/forum/vie ... 204a34849e
If I run
Code: Select all
sudo timedatectl set-time "2019-09-18 13:13"
, I receive the reply
Code: Select all
Failed to set time: Automatic time synchronization is enabled
. I am using a slightly unusual set up with the RasPi accessing the internet through a couple of gateways, but the command
works, so internet access is good. If I run
, I get
Code: Select all
Failed to query server: Invalid argument
.
Can anyone explain what is going on? I need the RevPi to start up, check the NTP server and get the correct time. I would also like the RTC backup to work.
Any help is much appreciated.
Regards
Ray
Re: Time and date wrong on RevPi
Posted: 19 Sep 2019, 11:21
by pmdevigne
Hell Ray
The commands I use are :
Code: Select all
sudo date -s "yyyy-mm-dd hh:mm"
sudo hwclock -w
Regards
Re: Time and date wrong on RevPi
Posted: 23 Sep 2019, 13:03
by raydodo
Hell Ray
The commands I use are :
Code: Select all
sudo date -s "yyyy-mm-dd hh:mm"
sudo hwclock -w
Regards
Hi
Thanks, but I have tried this and whilst setting the date/time works, I receive an error:
Code: Select all
pi@RevPi12101:~ $ sudo hwclock -w
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc to read the time failed: Invalid argument
Any other suggestions?
Thanks
Ray
Re: Time and date wrong on RevPi
Posted: 27 Sep 2019, 15:44
by pmdevigne
raydodo wrote: ↑23 Sep 2019, 13:03
Code: Select all
pi@RevPi12101:~ $ sudo hwclock -w
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc to read the time failed: Invalid argument
Yes, but the error is "only" a read error, I think because the RTC timer was not running before this command. Please verify that it works despite of this error.
Re: Time and date wrong on RevPi: RTC backup not working?
Posted: 30 Sep 2019, 14:27
by dirk
Hi did you install a new image and did not execute "revpi-factory-reset" afterwards?
Re: Time and date wrong on RevPi: RTC backup not working?
Posted: 03 Oct 2019, 15:13
by alf@emcom.no
I have the same kind of anomaly and it is repeatable ; If I powercycle the RevPi, the date goes to april 6'th 10:58:35.
I tested, and when I disabled ntp sync, it no longer happened - I just put two pcs in testbed now with some rebooting scripts to see what happens.
-Dirk - what happens if I do not do the revpi-factory.reset after installing new image?
Re: Time and date wrong on RevPi: RTC backup not working?
Posted: 10 Oct 2019, 10:34
by zhan
Hello All,
the command "date" sets only the time of the system, non-persistent. This means only in the memory, not to the storage. So the setting will be lost after reboot.
The command "timedatectl" is some-how same as "date" . However, it has some more functions like synchronization with NTP, etc.
And the employ of "set-time" to set the system time manually is conflict with employ of NTP, so it says "Failed to set time: Automatic time synchronization is enabled"
the command "hwclock" can save the setting to the hardware RTC.
In addition, "timedatectl" maybe have some access to the RTC chip
The RevPi has lots of enhancements (hardware and software) based on RaspberryPi, which makes RevPi outstanding in the industrial communication.
One of the enhancements is the RTC, which needs some extra treatment, like device tree overlay in /boot/overlays, some script/binary added to the filesystem, etc.
The revpi-factory-reset is used to help user to initialize those extra treatment.
So I guess "hwclock: ioctl(RTC_RD_TIME) to /dev/rtc to read the time failed: Invalid argument" is caused by non- or miss- configurations of the RTC chip in the RevPi.
Regards
Simon
Re: Time and date wrong on RevPi: RTC backup not working?
Posted: 17 Oct 2019, 14:12
by alf@emcom.no
Not sure if I should start a new thread, but it is related so ;
I have a few RevPi Connects, and they now started setting the date 3 months back.
Every time I boot - the clock goes back to april 6'th 10:58:35.
I noticed that if I did # timedatectl set-ntp true - the time would NOT be reset through a boot.
What would you recommend to ENSURE that the clock/system time stays correct no matter what ?
Re: Time and date wrong on RevPi: RTC backup not working?
Posted: 21 Oct 2019, 08:58
by raydodo
dirk wrote: ↑30 Sep 2019, 14:27
Hi did you install a new image and did not execute "revpi-factory-reset" afterwards?
Hi Dirk
I don't think so (this device has been used before). Is this what I should do? The clock seems to stay correct between consecutive reboots, but when left off over the weekend and turned on again Monday, the device does not get the time from an NTP server, despite having access.
Thanks
Ray
Re: Time and date wrong on RevPi: RTC backup not working?
Posted: 07 Nov 2019, 09:11
by zhan
Hi Ray,
I guess maybe your device is not synchronized with Network time.
Pls have a check of the configuration with timedatectl.
pi@RevPi2180:~ $ timedatectl
Local time: Thu 2019-11-07 09:05:33 CET
Universal time: Thu 2019-11-07 08:05:33 UTC
RTC time: Thu 2019-11-07 08:05:33
Time zone: Europe/Berlin (CET, +0100)
Network time on: no
NTP synchronized: no
RTC in local TZ: no
raydodo wrote: ↑21 Oct 2019, 08:58
dirk wrote: ↑30 Sep 2019, 14:27
Hi did you install a new image and did not execute "revpi-factory-reset" afterwards?
Hi Dirk
I don't think so (this device has been used before). Is this what I should do? The clock seems to stay correct between consecutive reboots, but when left off over the weekend and turned on again Monday, the device does not get the time from an NTP server, despite having access.
Thanks
Ray