Pages: [1]   Go Down
Author Topic: Due Integrated RTC time drift  (Read 1463 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all.
I need to sync the RTC time and date with GPS and then, based on the RTC time drift, define intervals of synchronization to to make sure that the system will be accurate to the millisecond.  During my tests, I found that the RTC of Due lose around 6us/s at 15ºC. Isn't that too much?
My strategy was store the system's microseconds on the rising edge of the 1pps output of the GPS and subtract that to the microseconds on the "new second" interrupt of the RTC, store the results for over 3 hours and then compute the median of that values...

here is the RTC time loss graph...


Hope that anyone can confirm this results  smiley-wink
Thanks
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you added a 32kHz crystal to get the RTC working?

If so AFAIK they are really crap accuracy although I can't remember how many PPM you would expect.

______
Rob

Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think that's it!
I can see that the Due board doesn't have the 32.768Khz crystal oscillator specified on the SAM3X datasheet, so I have to add it on XIN32 and XOUT32 (pins 48 and 49). I think the board should come with the oscillator, since it's present on the schematic!
I will add the oscillator and than report back the time drift.

Thanks for the help!
« Last Edit: December 02, 2013, 01:54:47 pm by Gasoile » Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah yes, if you are using the internal clock that would explain it I'm sure, it is spec'd at running between 20 and 44kHz so all bets are off WRT accuracy.

As to why the schematics don't match the board being sold, this is not the only example and we've commented on this several times. The answer seems to be everything from  "we're too busy to update them" to "the manufacturers can load what components they like", both of which must be bollocks. Go figure, but (technically at least) I guess this means that the Due is not open source smiley

______
Rob
« Last Edit: December 02, 2013, 05:03:06 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Nashville Tennessee, USA
Offline Offline
Sr. Member
****
Karma: 15
Posts: 366
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I believe all "official" dues except the very early ones have the crystals. Even with a crystal it is far from a precision clock if you get accuracy within a few milliseconds you are doing very well.

There are lots of counterfeit boards out there. If you bought it on eBay it is probably counterfeit.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The thing is that my board is an original Due R3 bought from an official distributor and still doesn't come with the crystal  smiley-sad
Off-course that if the board is counterfeit I couldn't complain...

I think I can get an error of less than 400 microseconds if I sync the RTC every minute, witch may be not that critical on my application... But i'll try the crystal anyway, since I don't have power restrictions.
« Last Edit: December 03, 2013, 07:16:32 am by Gasoile » Logged

Laguna Hills, CA 92653
Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When using the RTC_Clock library, one uses XTAL or RC as the
argument to the instantiation call, to get the External Crystal,
or the internal RC (resistor-capacitor) oscillator:

RTC_Clock rtc_clock(XTAL) ; // use RC for internal osc.

Has anybody verified that it works as expected?

Even when using the External crystal (my genuine boards
all have the oscillator chip installed)  I get substantial time
variations, or so it seems, and the error appears to vary
substantially, but perhaps my "reference" is not good?
Logged

Cheers, Gary
Due for controlling Electric car charging.
Nissan LEAF - Mini Quick Charge (mQC)

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
perhaps my "reference" is not good
That's the first question, what is your reference?

Next question is "What are 'substantial' time variations?"

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11672
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The RTC uses a watch crystal, 6ppm is pretty good going for a watch crystal, only 4 seconds
a week!

I notice that on my Due (R3) the actual crystal package has a transparent top and you can
see the tuning-fork shaped piece of quartz inside!
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The RTC uses a watch crystal

hummm, so probably everything is right with my board and I just couldn't identify the crystal. I was looking to the RTC diagram on the SAM3X datasheet and I see that it choose between the crystal/RC oscillator using a multiplexer. So if the board didn't have the crystal, and I am not using the RC oscillator, then it would simply not work. It has to be there!
I will check that again when I get back to it on the weekend  smiley-razz

Logged

Offline Offline
Jr. Member
**
Karma: 9
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here are some data on drift of MCU crystals and RTC's including DUE
 https://github.com/manitou48/crystals

crystals.txt has the drift data.  drift is affected by voltage, temperature, age, and capacitance.
 your mileage may vary.

Here are specs for MCU crystal and RTC from the DUE schematic/bom
   Y1,12MHz KX-7 20pF     CRYSTAL-3.2-2.5           CRYSTAL-3.2-2.5  probably 30ppm
   Y2,32.768Khz,RESONATOR_EPSON_FC_145,RESONATOR_EPSON_FC_145   20ppm 12.5pf
« Last Edit: December 05, 2013, 08:44:41 am by mantoui » Logged

Laguna Hills, CA 92653
Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, with about 4000 seconds per hour (really 3600), and
about 25 hours a day, there are about 100,000 seconds per day.

A 10 ppm (parts per million) error, would be about 1 second per day.
One course, then 20 ppm would be about 2 seconds per day.

I will need to check against a better "reference", but I thought
that I got 30 seconds or a minute error in 12 hours, and
sometimes plus and sometimes minus... I will re-test.
Logged

Cheers, Gary
Due for controlling Electric car charging.
Nissan LEAF - Mini Quick Charge (mQC)

Pages: [1]   Go Up
Jump to: