Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:51 02 Jul 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 : Clock Drift.

Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 11:04am 11 Apr 2016
Copy link to clipboard 
Print this post

Finding the internal clock drift to be fairly severe on my MM.
It seems to be gaining pretty close to 5 minutes in 24 hours.
Certainly more than enough to cause issues some areas involving other devices.

For the short term I've delta with it like this:-


Re-Sync with RTC every hour.
if mid$(time$,4,4)="00:0" then
rtc gettime
Print "Clock Resync'd"
Endif


' Get the temperatures using Multi device read routine
GetTemps


Not a perfect solution, as it's going to repeat the first 9 seconds of the hour, probably 3 or 4 times due to the fact that the "GetTemps Sub takes around 1800ms to return.

Intentionally used the 10 sec window, mm:s=00:0 so the event didn't get missed while the GetTemps sub was being run.

Any better suggestion to grab the RTC every hour?

Cheers
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1566
Posted: 11:25am 11 Apr 2016
Copy link to clipboard 
Print this post

  Phil23 said   Finding the internal clock drift to be fairly severe on my MM.
It seems to be gaining pretty close to 5 minutes in 24 hours.
Certainly more than enough to cause issues some areas involving other devices


Did you already ClockTrim your MM?
causality ≠ correlation ≠ coincidence
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 12:17pm 11 Apr 2016
Copy link to clipboard 
Print this post

ClockTrim is something I'd overlooked.

Presume I could use a variable StartTime to read the clock on boot,
Let it run for a few hours, Break to the prompt then run these commands:-

Print Starttime
Print Time$
RTC GetTime
Print Time$

And calculate an error from that?

Is that what people would do?

Thanks.
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1566
Posted: 12:40pm 11 Apr 2016
Copy link to clipboard 
Print this post

Hi Phil,

if you are using a DS3231 RTC (or DS3232) then this thread will maybe help you.

Michael
causality ≠ correlation ≠ coincidence
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6266
Posted: 01:16pm 11 Apr 2016
Copy link to clipboard 
Print this post

If you don't want to do the calculations yourself,
this thread may help (provided you are not using FTDI USB-serial chipsets).
http://www.thebackshed.com/forum/forum_posts.asp?TID=8294&KW=clocktrim

The trim setting you need changes with temperature but you can get good resukts fairly easily.

Searching the forum for clocktrim will give you plenty of reading.

Jim
VK7JH
MMedit
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 03:31pm 11 Apr 2016
Copy link to clipboard 
Print this post

  TassyJim said   If you don't want to do the calculations yourself,
this thread may help (provided you are not using FTDI USB-serial chipsets).
http://www.thebackshed.com/forum/forum_posts.asp?TID=8294&KW=clocktrim

Jim


Thanks Jim,

I did play with your TimeLord earlier this morning & told me -6 to -7.

I've got FTDI, CP2102 & HC-05 Bluetooth here.

The MM was connected by the HC-05 when I tried your software & it seemed to run ok.

Will check it in a few hours & see how the drift compares.

Don't understand the FTDI issue; probably don't want to, but curious if the Bluetooth adaptor will have similar issues.

Or the ESP8266, which I haven't setup yet (to replace Bluetooth).

Cheers
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6266
Posted: 08:06pm 12 Apr 2016
Copy link to clipboard 
Print this post

Timelord simply times the arrival of data being sent from the micromite at a regular interval.
Windows is not very good at timing down to the microsecond level being multitasking.
Any activity with other programs while Timelord is running causes timing jitter.
This is especially evident on slower computers.

We found that FTDI chipsets do not give consistent timing, probably due to the fake chip detecting software in the drivers.
This is also evident when flashing micromites. FTDI is half the speed of other chipsets.

If you are trying to set the timing with Bluetooth or WIFI in the mix, the timing jitter will be very evident also. You can reduce the effects by using slow timing between data packets.

Jim.
VK7JH
MMedit
 
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