[SOLVED] RTC with Android

Post Reply
JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

[SOLVED] RTC with Android

Post by JediMax2 »

I connect RTC module (PCF8563) to Odroid with Android. Board read information from RTC module when Android starts. But how I can write correct time to RTC module. When I set local time, time in Android changes. But, when Odroid reboots, I see, time not write to RTC module.
What have I do to fix it?

User avatar
odroid
Site Admin
Posts: 35266
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 1074 times
Been thanked: 822 times
Contact:

Re: RTC with Android

Post by odroid »

When Android OS do shutdown process, it updates the hwclock RTC.
Please try proper power off and on to check the RTC functionality.

We will check it with "reboot" soon.

User avatar
joerg
Posts: 1149
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 55 times
Been thanked: 128 times
Contact:

Re: RTC with Android

Post by joerg »


User avatar
odroid
Site Admin
Posts: 35266
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 1074 times
Been thanked: 822 times
Contact:

Re: RTC with Android

Post by odroid »

joerg wrote:Here are some usefull information: http://forum.odroid.com/viewtopic.php?f ... &hilit=rtc
C2 RTC Shield should not have the time draft issue.

User avatar
joerg
Posts: 1149
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 55 times
Been thanked: 128 times
Contact:

Re: RTC with Android

Post by joerg »

Yes I know, but I linked because the commands to update time and check. With ntpd time should also the written to rtc. Don't wanted to confuse, sorry.

User avatar
odroid
Site Admin
Posts: 35266
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 1074 times
Been thanked: 822 times
Contact:

Re: RTC with Android

Post by odroid »

Ah... you are right. Sorry for my wrong interpretation. :(

JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by JediMax2 »

odroid wrote:When Android OS do shutdown process, it updates the hwclock RTC.
Please try proper power off and on to check the RTC functionality.

We will check it with "reboot" soon.
Sorry, but not working. I wait for results of your check.

User avatar
joerg
Posts: 1149
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 55 times
Been thanked: 128 times
Contact:

Re: RTC with Android

Post by joerg »

I saw in the data sheet of PCF8563 that it don't have pin fot backup battery. My question: How it is connected to the Odroid. Does your module have battery on board or is it connected to other power supply? If not I assume that loosing time when you power off.

JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by JediMax2 »

My RTC modulr has bacup battery. It connected like on the picture
Image

Clock inside RTC chip works good. But I can't set it to right time.

User avatar
rooted
Posts: 7974
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 724 times
Been thanked: 243 times
Contact:

Re: RTC with Android

Post by rooted »

You tried using the hwclock command? What is the error?

User avatar
joerg
Posts: 1149
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 55 times
Been thanked: 128 times
Contact:

Re: RTC with Android

Post by joerg »

With the two diodes is o.k, but you should connect to 3.3V not to 5V. Only recommendation to not to destroy the C2 as the gpio pins are 3.3V. Also the communication can be disturbed, to connect a 5V device to a 3.3V device it would be needed a level shifter for the sda and scl pins. And for me also interesting what rooted asked.

JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by JediMax2 »

Of course, I connect RTC to +3.3 volts.
When I enter hwclock command, I get date/time from RTC module.
When I enter

Code: Select all

hwclock -w
ant then

Code: Select all

hwclock
, I see, that RTC time set to system time. I think, all working. But, when Odroid reboots or shutdowns, RTC clock not set. And i think it is not very good. My idea is RTC set time when I set time in android.
I use last Android version (2.2)
Last edited by JediMax2 on Sun Oct 02, 2016 7:00 pm, edited 1 time in total.

User avatar
joerg
Posts: 1149
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4
Location: Germany
Has thanked: 55 times
Been thanked: 128 times
Contact:

Re: RTC with Android

Post by joerg »

As I made my investigations on C1 for RTC, i also saw that time not always was corrected. At the end I gave up fixing it, because one must dive deep into the Android source code to find where this all happen and i was tired of this. Then let's wait if Hardkernel developers find something. One day, I will change the C1 in my car to C2 and I will need also functional RTC.

JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by JediMax2 »

I have idea. I make some script like

Code: Select all

while true
   pause 3600
   hwclock -w
done
this script will be set RTC to system time every 3600 sec (1 hour)

JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by JediMax2 »

I see, it's a new firmware version presented. With fix RTC bug. I install Andriod v2.3 to my Odroid C2. Yes, when Odroid shootting down or reboot, current time set to RTC. But with some problem.
When I set tome zone to GMT 0 - all working good.
When I set it to my local GMT +3 (Eastern Europe) and set local time to (for example) 17-00, when Odroid reboots (or shooting down and boots) the system time will be 14-00. Of course, I can set system time to 20-00, and after reboot it will be correct 17-00. But it is not good, as I think. :-)

User avatar
rooted
Posts: 7974
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 724 times
Been thanked: 243 times
Contact:

Re: RTC with Android

Post by rooted »

JediMax2 wrote:I see, it's a new firmware version presented. With fix RTC bug. I install Andriod v2.3 to my Odroid C2. Yes, when Odroid shootting down or reboot, current time set to RTC. But with some problem.
When I set tome zone to GMT 0 - all working good.
When I set it to my local GMT +3 (Eastern Europe) and set local time to (for example) 17-00, when Odroid reboots (or shooting down and boots) the system time will be 14-00. Of course, I can set system time to 20-00, and after reboot it will be correct 17-00. But it is not good, as I think. :-)
Are you setting the timezone in Android settings or another way?

JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by JediMax2 »

In Android settings.

User avatar
rooted
Posts: 7974
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 724 times
Been thanked: 243 times
Contact:

Re: RTC with Android

Post by rooted »

JediMax2 wrote:In Android settings.
Should be working then.

frueht
Posts: 3
Joined: Sat Mar 21, 2015 11:27 pm
languages_spoken: english
ODROIDs: C1, C1+ and C2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by frueht »

I find out exactly the same problem with RTC as JediMax2 described at "Wed Oct 05".
I'am shure there is an issue in combination of android and RTC PCF8563 and timezones.
I install Andriod v2.3 to my Odroid C2 and set the timezone in the Android setting.

User avatar
odroid
Site Admin
Posts: 35266
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 1074 times
Been thanked: 822 times
Contact:

Re: RTC with Android

Post by odroid »

You must edit /init.odroidc2.board.rc file to enable the RTC driver.
http://odroid.com/dokuwiki/doku.php?id= ... tc#android

Oleg Robonuka
Posts: 5
Joined: Fri Sep 30, 2016 3:46 pm
languages_spoken: english
ODROIDs: ODROID-C2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by Oleg Robonuka »

I am watchingt exactly the same problem with RTC as JediMax2 described at "Wed Oct 05" and frueht at " Fri Oct 21".
/init.odroidc2.board.rc file editing does not help.

User avatar
odroid
Site Admin
Posts: 35266
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 1074 times
Been thanked: 822 times
Contact:

Re: RTC with Android

Post by odroid »

Can you show me your modified rc file?

JediMax2
Posts: 53
Joined: Sat Sep 10, 2016 3:37 am
languages_spoken: english, russian
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: RTC with Android

Post by JediMax2 »

odroid wrote:You must edit /init.odroidc2.board.rc file to enable the RTC driver.
http://odroid.com/dokuwiki/doku.php?id= ... tc#android
It's working on my Odroid. Thank you.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest