Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: RTC GETTIME.... Post ReplyPost New Topic
Page of 3 Next >>
Author
Message << Prev Topic | Next Topic >>
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 28 August 2017 at 10:37pm | IP Logged Quote Grogster

Hi folks.

MMBASIC 5.0405 on E64.

RTC GETTIME only gets the date - anyone seeing this?

What happens is that when I power-off a system using an RTC module(DS3231), the next day when I power-on, the date is correct, but the time is what it was when I powered it off yesterday - the time is out by hours and hours on what it should be.

RTC SETTIME works fine, so does RTC GETTIME, but it is odd because the time upon restart is NOT the current time, but rather the time that the system was powered off.
Even if somehow the system was updating the RTC at power-off, that would mean the time was still essentially correct at power-up if you see what I mean.

Really strange. Anyone got any ideas or seen anything like this before?
Have tried several different RTC modules - always the same.
To see this problem, you need to set the RTC, then power off for at least a couple of minutes to be able to 'See' the RTC error.

__________________
Smoke makes things work. When the smoke gets out, it stops!


Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
disco4now
Senior Member
Senior Member


Joined: 18 December 2014
Location: Australia
Online Status: Offline
Posts: 199
Posted: 28 August 2017 at 10:59pm | IP Logged Quote disco4now

Hi Grogs,

Have you searched your code for and unexpected TIME$= command.
Because it seems to know when it shut down is it anything to do with a VAR SAVE, VAR RESTORE thats sneaking in.

Regards
Gerry

Edited by disco4now on 28 August 2017 at 11:01pm
Back to Top View disco4now's Profile Search for other posts by disco4now
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 29 August 2017 at 3:22am | IP Logged Quote Grogster

Not that I am aware of, but I will certainly search for that.

I might hook up the logic analyser to the I2C port and see if anything odd is going on at any point. I don't understand how the DATE is retrieved fine, but the time is not. Both require the participation of the RTC, and both are read together.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1137
Posted: 29 August 2017 at 4:18am | IP Logged Quote Phil23

Can't comment on 5.0405, but just checked the 64 pinner on a CGmicro2 & an E100,
both running on 5.04.04 & they are both working fine.

One thing I did notice in some code you posted in the last few days was,
Timer=0


in here

Quote:
'---------------
'MESSAGING MENU:
'---------------
MESSAGING:
If DEBUG then Print "Messaging menu."
CtrlVal(SM_TXT)="##ENTER MESSAGE HERE..."
PAGE 20,4 'Messaging and EXIT/OK buttons
If PROMPTING then
CHDIR "\SYSTEM"
PLAY WAV
"STAFF.NSF"
Endif
GUI Interrupt EXIT_OK
Timer=0:Y=0
Do
If LCD_EXIT then
LCD_EXIT=
0 'Clear flag
If DEBUG then Print "EXIT button touched.(send a message)"
Y=
1
Endif
If LCD_OK then
LCD_OK=
0 'Clear flag
If DEBUG then Print "OK button touched.(send a message)"
MSG$=
CtrlVal(SM_TXT)
SEND_PAGE(
"",MSG$,"[MANUAL MESSAGE>")
Y=
1
Endif
If Timer>=SSDELAY*2 then Y=1 'Auto-abort if no button touched.
If Y then EXIT Do
LOOP
ON Y GOTO START


Might be worth introducing a variable for the timeout like TouchTimer.

Just found I ended up painting myself into a few corners by resetting the timer in the code. Reset it in one place & then it broke things in other places that also relied on it counting from zero.

Quote:
'---------------
'MESSAGING MENU:
'---------------
MESSAGING:
If DEBUG then Print "Messaging menu."
..
..
GUI Interrupt EXIT_OK
TouchTimer=
Timer:Y=0
Do
..
..
..
If TouchTimer-Timer>=SSDELAY*2 then Y=1 'Auto-abort if no button touched.
If Y then EXIT Do
LOOP
ON Y GOTO START


Cheers


Phil.
Back to Top View Phil23's Profile Search for other posts by Phil23
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 29 August 2017 at 5:36am | IP Logged Quote Grogster

REALLY?!?!?!

I would not have thought that the general-purpose timer would have any effect on the system clock at all, but perhaps.....

Geoff?
matherp?

I hear what you are saying Phil, but I would not have thought that the two could be connected. Can you please elaborate on some issues you were having with TIMER?

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1137
Posted: 29 August 2017 at 8:18am | IP Logged Quote Phil23

Grogster wrote:
I would not have thought that the general-purpose timer would have any effect on the system clock at all, but perhaps.....


Sorry,

Should have added that there's no relation between the two;
Timer and Time$; distractions while commenting....

Only intended to point out the Timer resetting bit.

My only issue was with the Timer; as the spaghetti grew & found I was resetting it in to many places & some rests effected other areas.

Not at all related to the RTC.

Phil

Edited by Phil23 on 29 August 2017 at 8:21am
Back to Top View Phil23's Profile Search for other posts by Phil23
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 29 August 2017 at 2:19pm | IP Logged Quote Grogster

Okey dokey - thanks for that.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
palcal
Guru
Guru
Avatar

Joined: 12 October 2011
Location: Australia
Online Status: Offline
Posts: 806
Posted: 30 August 2017 at 9:12pm | IP Logged Quote palcal

Sure seems odd, hope you get an answer soon I haven't been able to sleep wondering what the answer is.
Paul.

__________________
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
Back to Top View palcal's Profile Search for other posts by palcal
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 31 August 2017 at 12:11am | IP Logged Quote Grogster

Yeah, it's still going on. I have no idea what could possibly cause this, because the DATE is correctly updated from the RTC at power up, but the TIME is not.

Now, that is REALLY odd, because the date AND time are both read from the RTC at the same time, in the same instruction, so if one works(the date), then the other should automatically also work(the time) - but it does not.

I have more RTC modules coming. I will try another couple and see if perhaps I just had a couple of crook ones. The ones I am using, I found rolling around in a box of modules, but the new ones will be sealed so perhaps the old ones got static damaged or something - who knows at this point.

EDIT: I just used MMEDIT to search for any instance of "TIME$=" in the code, which would find me any line where I might have been setting the time in the code that I had forgotten about - zero results, so I am not doing that anywhere. I will wait and see what the new RTC modules do.

Edited by Grogster on 31 August 2017 at 12:18am


__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 05 September 2017 at 9:45am | IP Logged Quote Grogster

Some new RTC modules have arrived, and trying one of these seems to produce the goods.
I have binned the other two to be sure that they won't get back into circulation.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
mikeb
Senior Member
Senior Member
Avatar

Joined: 10 April 2016
Location: Australia
Online Status: Offline
Posts: 125
Posted: 05 September 2017 at 9:57pm | IP Logged Quote mikeb

@All,

I guess that is to be expected of cheap, Chinese, knockoffs.
Try buying the genuine, Maxim, device from a reputable supplier.
5 times the price of the entire module. A case of "You get what you pay for".

Regards, Mike B.

__________________
There are 10 kinds of people in the world.
Those that understand binary and those that don't.
Back to Top View mikeb's Profile Search for other posts by mikeb
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 05 September 2017 at 11:47pm | IP Logged Quote Grogster

Yes, I know that, and I will accept any and all scolding - WhiteWizzard normally chimes in about now.......

I designed the mainboard to accept that particular module, which is perhaps one of the smallest RTC's you can get, but....

I guess I could probably 'Grogster-ify' the Chinese ones, by removing the clone chip and putting a genuine chip on there so it would still fit in the tiny footprint, but then be running a genuine part.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 


Page of 3 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1074 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.11