|
Forum Index : Microcontroller and PC projects : RTC GETTIME....
| Page 1 of 2 |
|||||
| Author | Message | ||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
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! |
||||
| disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 1044 |
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 F4 H7FotSF4xGT |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
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! |
||||
| Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
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, [Code]Timer=0[/code] in here 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. Cheers Phil. |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
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! |
||||
| Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
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 |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
Okey dokey - thanks for that. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
palcal![]() Guru Joined: 12/10/2011 Location: AustraliaPosts: 2006 |
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" |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
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. Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
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! |
||||
| mikeb Senior Member Joined: 10/04/2016 Location: AustraliaPosts: 177 |
@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. |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
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! |
||||
| GoodToGo! Senior Member Joined: 23/04/2017 Location: AustraliaPosts: 188 |
Means you can junk 4 of them and still be ahead! Out of interest, which particular RTC module are you using Grogster? Got a link? Cheers, GTG! ...... Don't worry mate, it'll be GoodToGo! |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
Sure do, follow this link: Small RTC module with on-board battery What I like about these ones, is that they are DS3231(cloned at that price!), on-board backup battery, and they are very small physically, so they are easy to shoe-horn into a tight space if you are running low on PCB real-estate. .....and I usually am by the time I think of adding an RTC! Smoke makes things work. When the smoke gets out, it stops! |
||||
| isochronic Guru Joined: 21/01/2012 Location: AustraliaPosts: 689 |
I guess you have tried checking/replacing the backup battery(s) (?), if there is some residual capacity it might run briefly and then lose it |
||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
Grogster, it is interesting that the link to the supplier shows the sales history and I see that a New Zealander bought 5 units on 25/08/2017. Going to own up? |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
I have 4 of these units (fleabay) and they all work ok... odd |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
@ OA47 - No. Well, OK - yes. Smoke makes things work. When the smoke gets out, it stops! |
||||
| GoodToGo! Senior Member Joined: 23/04/2017 Location: AustraliaPosts: 188 |
Those modules look handy, will have to grab a few, say 5, then throw 4 out. Never played with aliexpress, is it similar to ebay? Can Paypal be used or should I get a prepaid Visa card? GTG! ...... Don't worry mate, it'll be GoodToGo! |
||||
bigmik![]() Guru Joined: 20/06/2011 Location: AustraliaPosts: 2971 |
Hi Grogs, All, They are the same as the ones I posted back in August 2015. I posted that it was almost a drop in for my MuP PCB (Just needed 1 10mm link wire.) Forum Link Here I have used around a dozen of them and never had an issue with them, The seem pretty accurate and to date I haven't had a battery go flat. Kind Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
| Page 1 of 2 |
|||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |