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

Topics about the Software of Revolution Pi
raydodo
Posts: 11
Joined: 22 Jan 2019, 16:49
Answers: 0

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

Post 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 "

Code: Select all

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

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

Code: Select all

sudo apt-get update
works, so internet access is good. If I run

Code: Select all

timedatectl
, 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
Last edited by raydodo on 26 Sep 2019, 08:38, edited 2 times in total.
pmdevigne
Posts: 5
Joined: 28 Mar 2019, 15:33
Answers: 0

Re: Time and date wrong on RevPi

Post by pmdevigne »

Hell Ray

The commands I use are :

Code: Select all

    sudo date -s "yyyy-mm-dd hh:mm"
    sudo hwclock -w
Regards
raydodo
Posts: 11
Joined: 22 Jan 2019, 16:49
Answers: 0

Re: Time and date wrong on RevPi

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

Re: Time and date wrong on RevPi

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

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

Post by dirk »

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

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

Post 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?
zhan
Posts: 52
Joined: 16 Apr 2019, 13:31
Answers: 0

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

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

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

Post 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 ?
raydodo
Posts: 11
Joined: 22 Jan 2019, 16:49
Answers: 0

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

Post 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
zhan
Posts: 52
Joined: 16 Apr 2019, 13:31
Answers: 0

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

Post 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
Simon
Post Reply