Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:12 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : RTC on MM+ series....

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 07:20pm 19 Sep 2017
Copy link to clipboard 
Print this post

Howdy.

I thought that the MM+'s RTC would be reasonably accurate given the crystal oscillator on these models. Is that not actually the case?

I find that even on MM+ based projects, after several days, the clock is out by quite a bit - five minutes or more over a period of days.

This is no real issue for me, as I also have an RTC module on the design, so fixing this is as simple as pressing reset or simply adding an RTC GETTIME command to the main menu screen which will update the clock every time the system goes past the main menu, so this is not causing me any problems, but I am just curious.

I know that the RTC on the 170 parts is a little drifty due to the internal oscillator, but I figured that the MM+ series would be much more accurate due to the crystal oscillator reference.

Anyone got any comments?
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 07:48pm 19 Sep 2017
Copy link to clipboard 
Print this post

The clock is only as good as the crystal.

You can improve the timing by tweaking the value of the capacitors either side of the crystal.
Also moving to a warmer climate will change things.

If you want to play, my 'timelord' program can be used on the MM+ and MMX to check the timing.
It will complain that CLOCKTRIM is not a valid command but you can ignore that error message and the program will run anyway.

http://www.thebackshed.com/forum/forum_posts.asp?TID=8294&KW=timelord

Output from a MMX first with 5 second timing then with 15 second.
The regular hiccups are most likely Windows doing it's thing. The main thing to watch is the log term average.
  Quote  RUN

15:34:16, Interval, Error, Average
15:34:21, 5.002466, 0.049%, 5.002466
15:34:26, 5.002532, 0.051%, 5.002499
15:34:31, 4.982291, -0.354%, 4.995763
15:34:36, 5.002360, 0.047%, 4.997412
15:34:41, 5.002320, 0.046%, 4.998394
15:34:46, 5.002637, 0.053%, 4.999101
15:34:51, 5.002519, 0.050%, 4.999589
15:34:56, 5.002391, 0.048%, 4.999939
15:35:01, 5.002426, 0.049%, 5.000216
15:35:06, 5.002465, 0.049%, 5.000441
15:35:11, 4.982473, -0.351%, 4.998807
15:35:16, 5.002196, 0.044%, 4.999090
15:35:21, 5.002597, 0.052%, 4.999359
15:35:26, 5.002590, 0.052%, 4.999590
15:35:31, 5.002158, 0.043%, 4.999761
15:35:36, 5.002310, 0.046%, 4.999921
15:35:41, 5.002367, 0.047%, 5.000065
15:35:46, 5.002290, 0.046%, 5.000188
15:35:51, 5.002121, 0.042%, 5.000290
15:35:56, 4.981897, -0.362%, 4.999370
15:36:01, 5.002272, 0.045%, 4.999508
15:36:06, 5.002304, 0.046%, 4.999636
15:36:11, 5.002325, 0.046%, 4.999752
15:36:16, 5.002169, 0.043%, 4.999853
15:36:21, 5.002208, 0.044%, 4.999947
Time check stopped.

RUN

15:37:33, Interval, Error, Average
15:37:48, 15.007070, 0.047%, 15.007070
15:38:03, 14.985400, -0.097%, 14.996235
15:38:18, 15.005794, 0.039%, 14.999421
15:38:33, 15.006526, 0.044%, 15.001197
15:38:48, 14.985346, -0.098%, 14.998027
15:39:03, 15.006012, 0.040%, 14.999358
15:39:18, 15.006342, 0.042%, 15.000356
15:39:33, 14.987161, -0.086%, 14.998706
15:39:48, 15.007203, 0.048%, 14.999650
15:40:03, 15.007089, 0.047%, 15.000394
Time check stopped


Jim
VK7JH
MMedit
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 08:01pm 19 Sep 2017
Copy link to clipboard 
Print this post

I have found that most computer systems that derive real time from their system clock (and most have a Xtal derived cpu clock) are "drifty". I suppose it is down to the accuracy of the xtals. +/- 100ppm is common (cheaper than 10ppm) and isn't really good enough for real time time over long periods and from tests I have done here, there is a lot of variability between CXOs... even worse with the "traditional" xtal and two caps approach.

I bought a couple of these (not these exact models; 6.144000 and 12.288000 MHz - for a precision 1sec gate pulse) and they are pretty damn excellent - expensive but when you need proper precision they can't be beaten for my meager requirements.

Have a look at Roman Black's (is he still around?) article for a DIY OCXO here

As an aside, I have just completed a project that uses an HC-06 bluetooth module on a MM and it spends days just waiting for something to do. It needs a good RTC but has none! I used the clocktrim to get things close enough (drifts about 20 secs over a day) and the android app transmits the unixtime with each command... the MM gets a clock "just in time" each time and that will be stable enough to hold things together while it is in use.


... string recieved from HC-06 expecting stuff like $U1505057122795!

dt$=HumanTime$(Val(Mid$(b$,3,10)))' mask last 3 digits of UT

On Error Skip 1:Date$=Left$(dt$,10) ' set the clock (GMT)
On Error Skip 1:Time$=Right$(dt$,8)

Print Date$;" ";Time$

... rest of code


and the codeflow on the android app does this:



Edited by CaptainBoing 2017-09-21
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 01:00pm 20 Sep 2017
Copy link to clipboard 
Print this post

Okey dokey, thanks guys.
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025