raydodo
Topic Author
Posts: 5
Joined: 22 Jan 2019, 16:49

Time and date wrong on RevPi: RTC backup not working?

18 Sep 2019, 14:23

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 "
sudo date -set
...." 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
sudo timedatectl set-time "2019-09-18 13:13"
, I receive the reply
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
sudo apt-get update
works, so internet access is good. If I run
timedatectl
, I get
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
Last edited by raydodo on 26 Sep 2019, 08:38, edited 2 times in total.
 
pmdevigne
Posts: 5
Joined: 28 Mar 2019, 15:33

Re: Time and date wrong on RevPi

19 Sep 2019, 11:21

Hell Ray

The commands I use are :
    sudo date -s "yyyy-mm-dd hh:mm"
    sudo hwclock -w
Regards
 
raydodo
Topic Author
Posts: 5
Joined: 22 Jan 2019, 16:49

Re: Time and date wrong on RevPi

23 Sep 2019, 13:03

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:
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
 
pmdevigne
Posts: 5
Joined: 28 Mar 2019, 15:33

Re: Time and date wrong on RevPi

27 Sep 2019, 15:44

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.
 
User avatar
dirk
KUNBUS
Posts: 537
Joined: 15 Dec 2016, 13:19

Re: Time and date wrong on RevPi: RTC backup not working?

30 Sep 2019, 14:27

Hi did you install a new image and did not execute "revpi-factory-reset" afterwards?
 
alf@emcom.no
Posts: 18
Joined: 25 Sep 2018, 10:17

Re: Time and date wrong on RevPi: RTC backup not working?

03 Oct 2019, 15:13

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?
 
zhan
KUNBUS
Posts: 30
Joined: 16 Apr 2019, 13:31

Re: Time and date wrong on RevPi: RTC backup not working?

10 Oct 2019, 10:34

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
Simon
 
alf@emcom.no
Posts: 18
Joined: 25 Sep 2018, 10:17

Re: Time and date wrong on RevPi: RTC backup not working?

17 Oct 2019, 14:12

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 ?
 
raydodo
Topic Author
Posts: 5
Joined: 22 Jan 2019, 16:49

Re: Time and date wrong on RevPi: RTC backup not working?

21 Oct 2019, 08:58

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

Who is online

Users browsing this forum: Google [Bot] and 0 guests