Enabling a RTC in LibreElec on a C2
-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Enabling a RTC in LibreElec on a C2
I've got a DS3231 attached, but can't figure out how to get it recognized. The directions I found are either for the Pi, or a full install on the C2.
Thanks!
Thanks!
- cdu13a
- Posts: 143
- Joined: Tue Jan 20, 2015 3:33 pm
- languages_spoken: english
- ODROIDs: C1, C2, XU4, HC1
- Contact:
Re: Enabling a RTC in LibreElec on a C2
LibreELEC for the C2 doesn't include the kernel module required to use the DS3231 RTC.
CoreELEC doesn't either, but I can look into adding the kernel module for the DS3231 RTC to CoreELEC for you.
CoreELEC doesn't either, but I can look into adding the kernel module for the DS3231 RTC to CoreELEC for you.
-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
That would be awesome. My DS3231 is soldered in 

- cdu13a
- Posts: 143
- Joined: Tue Jan 20, 2015 3:33 pm
- languages_spoken: english
- ODROIDs: C1, C2, XU4, HC1
- Contact:
Re: Enabling a RTC in LibreElec on a C2
Ok, I've made a build that includes the kernel module for the ds1307.
https://drive.google.com/drive/folders/ ... rqNr5-5wSM
I don't have that particular RTC. Which makes testing and giving instructions on how to use it a bit more difficult for me. But hopefully the following is good enough to get you started.
The following should be enough to see if you can read from the RTC.
To have the RTC be available at boot you have to add an entry for it in the device tree, and enable it.
https://drive.google.com/drive/folders/ ... rqNr5-5wSM
I don't have that particular RTC. Which makes testing and giving instructions on how to use it a bit more difficult for me. But hopefully the following is good enough to get you started.
The following should be enough to see if you can read from the RTC.
Code: Select all
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -r
To have the RTC be available at boot you have to add an entry for it in the device tree, and enable it.
Code: Select all
mount -o remount,rw /flash
cp /flash/dtb.img /flash/dtb.img.bak
fdtput -c /flash/dtb.img /i2c@c1108500/rtc@68
fdtput -t s /flash/dtb.img /i2c@c1108500/rtc@68 compatible "maxim,ds3231"
fdtput -t x /flash/dtb.img /i2c@c1108500/rtc@68 reg 0x68
fdtput -t s /flash/dtb.img /i2c@c1108500/rtc@68 status "okay"
mount -o remount,ro /flash
reboot
Last edited by cdu13a on Tue Jan 15, 2019 2:24 am, edited 1 time in total.
-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
Awesome! I will try it this weekend and report back.
-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
I just gave it a try, and it somewhat seems to work.
If I do a hwclock -r, I get:
Fri Apr 7 14:54:50 2000 0.000000 seconds
Unfortunately, I'm unable to set the time with the hwclock -w command. Am I missing something?
Thanks!
If I do a hwclock -r, I get:
Fri Apr 7 14:54:50 2000 0.000000 seconds
Unfortunately, I'm unable to set the time with the hwclock -w command. Am I missing something?
Thanks!
- cdu13a
- Posts: 143
- Joined: Tue Jan 20, 2015 3:33 pm
- languages_spoken: english
- ODROIDs: C1, C2, XU4, HC1
- Contact:
Re: Enabling a RTC in LibreElec on a C2
What is the output from
hwclock -w
when it fails?-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
Unfortunately, It's not set up at the moment, and I won't be able to try until tomorrow, but I believe there was no error. It simply didn't change the time. I was hoping that, when CoreELEC got the time from the Internet, typing hwclock -w would write the existing time to the RTC, and then running hwclock -r would show the right time, but it didn't. It could be I just don't know what I'm doing 

- cdu13a
- Posts: 143
- Joined: Tue Jan 20, 2015 3:33 pm
- languages_spoken: english
- ODROIDs: C1, C2, XU4, HC1
- Contact:
Re: Enabling a RTC in LibreElec on a C2
Output from dmesg from after you try might be helpful as well.
dmesg |paste
will upload dmesg output to a pastebin site and provide you a link you can post here, instead of directly posting the dmesg output.-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
OK, I have things up. I'll explain step by step:
Boot up, CoreELEC gets time from network, I SSH in.
Run:
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -w
hwclock -r
I get:
Sat Apr 8 19:46:02 2000 0.000000 seconds
As the date is different from the last time I tried this, I'm guessing it is correctly reading the RTC.
I never get any errors from any of these commands, but the correct time isn't being set with the hwclock -w command.
The dmesg output is here: http://ix.io/1ykh
When I tried to make the clock settings permanent, the Odroid wouldn't boot, giving this error:
cp: read error: Input/output error
*** Error in prepare_sysroot: mount_common: Could not mount /dev/SYSTEM ***
### Starting debugging shell for boot step: prepare_sysroot... type exit to quit ###
Thanks!
Boot up, CoreELEC gets time from network, I SSH in.
Run:
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
hwclock -w
hwclock -r
I get:
Sat Apr 8 19:46:02 2000 0.000000 seconds
As the date is different from the last time I tried this, I'm guessing it is correctly reading the RTC.
I never get any errors from any of these commands, but the correct time isn't being set with the hwclock -w command.
The dmesg output is here: http://ix.io/1ykh
When I tried to make the clock settings permanent, the Odroid wouldn't boot, giving this error:
cp: read error: Input/output error
*** Error in prepare_sysroot: mount_common: Could not mount /dev/SYSTEM ***
### Starting debugging shell for boot step: prepare_sysroot... type exit to quit ###
Thanks!
-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
I don't know what happened, but everything is working now. My best guess is that for whatever reason the RTC was setting the system time, then hwclock -w was simply writing the same time back. Anyway, after trying it a few more times, it worked!
I then tried again the settings to make it permanent. I think the first time I just wasn''t in the right directory when running commands. This time worked without errors.
I then powered down, disconnected the network, and booted back up to the right time.
Could this change be worked into future CoreELEC releases?
Thanks again!
I then tried again the settings to make it permanent. I think the first time I just wasn''t in the right directory when running commands. This time worked without errors.
I then powered down, disconnected the network, and booted back up to the right time.
Could this change be worked into future CoreELEC releases?
Thanks again!
- cdu13a
- Posts: 143
- Joined: Tue Jan 20, 2015 3:33 pm
- languages_spoken: english
- ODROIDs: C1, C2, XU4, HC1
- Contact:
Re: Enabling a RTC in LibreElec on a C2
Glad you got it working.
The next official release of CoreELEC will include it.
The next official release of CoreELEC will include it.
-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
That's awesome! when released, do I follow the same directions?
Also, any ETA on the release? I heard the final Leia could be released any day.
Also, any ETA on the release? I heard the final Leia could be released any day.
- cdu13a
- Posts: 143
- Joined: Tue Jan 20, 2015 3:33 pm
- languages_spoken: english
- ODROIDs: C1, C2, XU4, HC1
- Contact:
Re: Enabling a RTC in LibreElec on a C2
When the new release is available, you can manually upgrade the install on the sdcard/emmc that you installed this test build on.
In which case you won't have to do anything besides copy the the .tar file for the new release to
If you do a fresh install when the new release is available, just follow the same instructions as you did to get it working on the test build here.
As for an ETA on the next release I don't know. It will be released when it is ready.
There are to many variables, to give an exact timeline.
In which case you won't have to do anything besides copy the the .tar file for the new release to
/storage/.update
and reboot, then you will be on the official builds.If you do a fresh install when the new release is available, just follow the same instructions as you did to get it working on the test build here.
As for an ETA on the next release I don't know. It will be released when it is ready.

There are to many variables, to give an exact timeline.
- rooted
- Posts: 6265
- Joined: Fri Dec 19, 2014 9:12 am
- languages_spoken: english
- Location: Gulf of Mexico, US
- Contact:
Re: Enabling a RTC in LibreElec on a C2
@cdu13ua
Great support
Great support

-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
As an update, I installed the latest CE 8.99.1, went through the above steps, and it worked. At first it showed the wrong time, likely a different time zone, so I plugged in the Ethernet cable, and the time updated. I then powered off, unplugged the cable, powered on, and the time was correct. Thanks again!
-
- Posts: 13
- Joined: Fri Jan 04, 2019 5:31 am
- languages_spoken: english
- ODROIDs: C2
- Contact:
Re: Enabling a RTC in LibreElec on a C2
As another update, it seems I'm having problems. The time reported from the RTC seems to jump ahead 5 hours, which I'm guessing may be a timezone issue.
As an example, I ran these commands at slightly different times:
CoreELEC (official): 8.99.2 (S905.arm)
CoreELEC:~ # hwclock -r
Thu Feb 14 00:03:03 2019 0.000000 seconds
CoreELEC:~ # hwclock -w
CoreELEC:~ # hwclock -r
Wed Feb 13 19:03:19 2019 0.000000 seconds
CoreELEC:~ # hwclock -r
Thu Feb 14 01:04:38 2019 0.000000 seconds
CoreELEC:~ # hwclock -w
CoreELEC:~ # hwclock -r
Wed Feb 13 20:04:49 2019 0.000000 seconds
CoreELEC:~ # hwclock -r
Thu Feb 14 01:16:46 2019 0.000000 seconds
Is this a problem? I've rebooted without the network, and the time is correct.
As an example, I ran these commands at slightly different times:
CoreELEC (official): 8.99.2 (S905.arm)
CoreELEC:~ # hwclock -r
Thu Feb 14 00:03:03 2019 0.000000 seconds
CoreELEC:~ # hwclock -w
CoreELEC:~ # hwclock -r
Wed Feb 13 19:03:19 2019 0.000000 seconds
CoreELEC:~ # hwclock -r
Thu Feb 14 01:04:38 2019 0.000000 seconds
CoreELEC:~ # hwclock -w
CoreELEC:~ # hwclock -r
Wed Feb 13 20:04:49 2019 0.000000 seconds
CoreELEC:~ # hwclock -r
Thu Feb 14 01:16:46 2019 0.000000 seconds
Is this a problem? I've rebooted without the network, and the time is correct.
- cdu13a
- Posts: 143
- Joined: Tue Jan 20, 2015 3:33 pm
- languages_spoken: english
- ODROIDs: C1, C2, XU4, HC1
- Contact:
Re: Enabling a RTC in LibreElec on a C2
Are you in a timezone that is +/-5hours.
then
Is there a difference between the two dates/times, and is the difference the same as the timezone offset?
I believe hwclock is set to store the time as UTC not localtime(time with timezone offset applied).
date +"%Z %z"
will tell you current set timezonethen
date -u; hwclock -u;
Is there a difference between the two dates/times, and is the difference the same as the timezone offset?
I believe hwclock is set to store the time as UTC not localtime(time with timezone offset applied).
Who is online
Users browsing this forum: No registered users and 2 guests