Odroid C2, Android OS - How to change RTC date and time
-
- Posts: 5
- Joined: Wed Jun 20, 2018 7:43 pm
- languages_spoken: english
- ODROIDs: Odroid C2
- Contact:
Odroid C2, Android OS - How to change RTC date and time
I have the PCF8563 RTC Shield on my odroid board, and I’m trying to change the date and time of the RTC.
I’ve tried using the Android terminal emulator, to do things such as “date -s” or just “date”, however it only changes the system time and date, not the RTC’s time and date.
Any idea how to do this?
I’ve tried using the Android terminal emulator, to do things such as “date -s” or just “date”, however it only changes the system time and date, not the RTC’s time and date.
Any idea how to do this?
- tobetter
- Posts: 2629
- Joined: Mon Feb 25, 2013 10:55 am
- languages_spoken: Korean, English
- ODROIDs: X, X2, U2, U3, XU3, C1
- Location: Paju, South Korea
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
Can you run this command in terminal and show me how it is?OdoroidAndroid26 wrote:I have the PCF8563 RTC Shield on my odroid board, and I’m trying to change the date and time of the RTC.
I’ve tried using the Android terminal emulator, to do things such as “date -s” or just “date”, however it only changes the system time and date, not the RTC’s time and date.
Any idea how to do this?
Code: Select all
$ ls -l /dev/rtc*
-
- Posts: 5
- Joined: Wed Jun 20, 2018 7:43 pm
- languages_spoken: english
- ODROIDs: Odroid C2
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
Of course, this is what was displayed:tobetter wrote:Can you run this command in terminal and show me how it is?OdoroidAndroid26 wrote:I have the PCF8563 RTC Shield on my odroid board, and I’m trying to change the date and time of the RTC.
I’ve tried using the Android terminal emulator, to do things such as “date -s” or just “date”, however it only changes the system time and date, not the RTC’s time and date.
Any idea how to do this?Code: Select all
$ ls -l /dev/rtc*
Code: Select all
crw-r----- system system 252, 0 2018-06-21 10:58 rtc0
- rooted
- Posts: 6263
- Joined: Fri Dec 19, 2014 9:12 am
- languages_spoken: english
- Location: Gulf of Mexico, US
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
Use:
sudo hwclock -w
sudo hwclock -w
-
- Posts: 5
- Joined: Wed Jun 20, 2018 7:43 pm
- languages_spoken: english
- ODROIDs: Odroid C2
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
rooted wrote:Use:
sudo hwclock -w
I presume you mean trying
Code: Select all
su
Code: Select all
hwclock -w
however it get the following back:
hwclock: failed: No such file or directory
- rooted
- Posts: 6263
- Joined: Fri Dec 19, 2014 9:12 am
- languages_spoken: english
- Location: Gulf of Mexico, US
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
Oh I somehow missed you were on Android, I'm not sure how it works here. Sorry about that.
- tobetter
- Posts: 2629
- Joined: Mon Feb 25, 2013 10:55 am
- languages_spoken: Korean, English
- ODROIDs: X, X2, U2, U3, XU3, C1
- Location: Paju, South Korea
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
If only /dev/rtc0 is there, it should work. Is your Android version is the latest one? Even the time is not set from Settings?
-
- Posts: 5
- Joined: Wed Jun 20, 2018 7:43 pm
- languages_spoken: english
- ODROIDs: Odroid C2
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
/dev/rtc0 Is the only one there. And I have Android Marshmallow (v4.2) installed to the odroid c2 device.tobetter wrote:If only /dev/rtc0 is there, it should work. Is your Android version is the latest one? Even the time is not set from Settings?
Using the
Code: Select all
date
i.e
Code: Select all
date 1111111111.11
and the command
Code: Select all
date
will return the newly set date.
However
Code: Select all
hwclock
will still return whatever the date and time previously was on the rtc. So when the device is powered off and back on, the system reverts to this date again.
The same applies if I change the time/date through settings.
- tobetter
- Posts: 2629
- Joined: Mon Feb 25, 2013 10:55 am
- languages_spoken: Korean, English
- ODROIDs: X, X2, U2, U3, XU3, C1
- Location: Paju, South Korea
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
Can you try if you can see these?
Also, try to run # cat /sys/class/rtc/rtc0/date. If it shows errors like these, I2C is not working with RTC module or RTC module itself could have a problem.
Maybe you could post a picture how you connected the RTC module.
Code: Select all
root@odroidc2:/ # ls /sys/class/rtc/rtc0/ -l
-r--r--r-- root root 4096 2018-08-24 13:38 date
-r--r--r-- root root 4096 2018-08-24 13:38 dev
lrwxrwxrwx root root 2018-08-24 13:38 device -> ../../../1-0051
-r--r--r-- root root 4096 2018-06-26 13:35 hctosys
-rw-r--r-- root root 4096 2018-08-24 13:38 max_user_freq
-r--r--r-- root root 4096 2018-08-24 13:38 name
drwxr-xr-x root root 2018-06-26 13:35 power
-r--r--r-- root root 4096 2018-08-24 13:38 since_epoch
lrwxrwxrwx root root 2018-08-24 13:38 subsystem -> ../../../../../class/rtc
-r--r--r-- root root 4096 2018-08-24 13:38 time
-rw-r--r-- root root 4096 2018-06-26 13:35 uevent
Code: Select all
[ 83.062566@0] i2c i2c-1: [aml_i2c_xfer] error ret = -5 (-EIO)
[ 83.062674@0] i2c i2c-1: token 1, master_no(1) 300K addr 0x51
[ 83.068465@0] i2c i2c-1: [aml_i2c_xfer] error ret = -5 (-EIO)
[ 83.074121@0] i2c i2c-1: token 1, master_no(1) 300K addr 0x51
[ 83.079840@0] i2c i2c-1: [aml_i2c_xfer] error ret = -5 (-EIO)
[ 83.085482@0] i2c i2c-1: token 1, master_no(1) 300K addr 0x51
[ 83.091151@0] rtc-pcf8563 1-0051: pcf8563_get_datetime: read erro
-
- Posts: 5
- Joined: Wed Jun 20, 2018 7:43 pm
- languages_spoken: english
- ODROIDs: Odroid C2
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
The rtc module is connected the same way as in the image linked below:tobetter wrote:Can you try if you can see these?Also, try to run # cat /sys/class/rtc/rtc0/date. If it shows errors like these, I2C is not working with RTC module or RTC module itself could have a problem.Code: Select all
root@odroidc2:/ # ls /sys/class/rtc/rtc0/ -l -r--r--r-- root root 4096 2018-08-24 13:38 date -r--r--r-- root root 4096 2018-08-24 13:38 dev lrwxrwxrwx root root 2018-08-24 13:38 device -> ../../../1-0051 -r--r--r-- root root 4096 2018-06-26 13:35 hctosys -rw-r--r-- root root 4096 2018-08-24 13:38 max_user_freq -r--r--r-- root root 4096 2018-08-24 13:38 name drwxr-xr-x root root 2018-06-26 13:35 power -r--r--r-- root root 4096 2018-08-24 13:38 since_epoch lrwxrwxrwx root root 2018-08-24 13:38 subsystem -> ../../../../../class/rtc -r--r--r-- root root 4096 2018-08-24 13:38 time -rw-r--r-- root root 4096 2018-06-26 13:35 uevent
Maybe you could post a picture how you connected the RTC module.Code: Select all
[ 83.062566@0] i2c i2c-1: [aml_i2c_xfer] error ret = -5 (-EIO) [ 83.062674@0] i2c i2c-1: token 1, master_no(1) 300K addr 0x51 [ 83.068465@0] i2c i2c-1: [aml_i2c_xfer] error ret = -5 (-EIO) [ 83.074121@0] i2c i2c-1: token 1, master_no(1) 300K addr 0x51 [ 83.079840@0] i2c i2c-1: [aml_i2c_xfer] error ret = -5 (-EIO) [ 83.085482@0] i2c i2c-1: token 1, master_no(1) 300K addr 0x51 [ 83.091151@0] rtc-pcf8563 1-0051: pcf8563_get_datetime: read erro
https://www.hardkernel.com/main/_Files/ ... 375783.jpg
I got the same output as you when running the command
Code: Select all
ls /sys/class/rtc/rtc0/ -l
Code: Select all
cat /sys/class/rtc/rtc0/date
- tobetter
- Posts: 2629
- Joined: Mon Feb 25, 2013 10:55 am
- languages_spoken: Korean, English
- ODROIDs: X, X2, U2, U3, XU3, C1
- Location: Paju, South Korea
- Contact:
Re: Odroid C2, Android OS - How to change RTC date and time
If that's the case, ODROID-C2 can talk with RTC shield, but RTC is not ticking??
Did you see time changes whenever you run hwclock?
Can you run the command hwclock -f /dev/rtc0 if it is still same?
Could you try to run Ubuntu for ODROID-C2 and do the same using hwclock in order to check RTC Shield is ok or not?
Did you see time changes whenever you run hwclock?
Can you run the command hwclock -f /dev/rtc0 if it is still same?
Could you try to run Ubuntu for ODROID-C2 and do the same using hwclock in order to check RTC Shield is ok or not?
Who is online
Users browsing this forum: No registered users and 1 guest