![]() |
Forum Index : Microcontroller and PC projects : Clock Drift.
Author | Message | ||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
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: GermanyPosts: 1566 |
Did you already ClockTrim your MM? causality ≠ correlation ≠ coincidence |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
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: GermanyPosts: 1566 |
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: AustraliaPosts: 6266 |
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: AustraliaPosts: 1667 |
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: AustraliaPosts: 6266 |
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 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |