Go Down

Topic: Due Integrated RTC time drift (Read 1 time) previous topic - next topic

Gasoile

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  ;)
Thanks

Graynomad

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

Rob Gray aka the GRAYnomad www.robgray.com

Gasoile

#2
Dec 02, 2013, 07:10 pm Last Edit: Dec 02, 2013, 07:54 pm by Gasoile Reason: 1
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!

Graynomad

#3
Dec 02, 2013, 11:01 pm Last Edit: Dec 02, 2013, 11:03 pm by Graynomad Reason: 1
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 :)

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

noblepepper

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.

Gasoile

#5
Dec 03, 2013, 03:26 am Last Edit: Dec 03, 2013, 01:16 pm by Gasoile Reason: 1
The thing is that my board is an original Due R3 bought from an official distributor and still doesn't come with the crystal  :(
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.

garygid

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?
Cheers, Gary
Due for controlling Electric car charging.
Nissan LEAF - Mini Quick Charge (mQC)

Graynomad

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
Rob Gray aka the GRAYnomad www.robgray.com

MarkT

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!
[ I won't respond to messages, use the forum please ]

Gasoile


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  :P


mantoui

#10
Dec 05, 2013, 12:02 pm Last Edit: Dec 05, 2013, 02:44 pm by mantoui Reason: 1
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

garygid

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.
Cheers, Gary
Due for controlling Electric car charging.
Nissan LEAF - Mini Quick Charge (mQC)

Go Up