Shop OBEX P1 Docs P2 Docs Learn Events
Frequency accuracy — Parallax Forums

Frequency accuracy

jmspaggijmspaggi Posts: 629
edited 2008-06-04 18:40 in General Discussion
Hi,

I'm trying to do use Timer to delay, and I have some concerns regarding the accuracy.

I first tried timeoutSec methode, but it seems that it's giving only approx delay, and it can delay for one hour.

So I calculated the low and high value myself using 8,68us tick time. With those values, I got about 18sec/h gap.

After reading to some other posts, I found that is not 8,68 exactly, but 1000000/115200 us. So I redo all my calculations, this time for 10 hours in order to get a beter view. This number is based on the internal 115200 frequency for UAT checking.

I just read the result this morning.

Start at 21:19:09, end at 06:18:06. So my 10 hours delay was, in fact, 9h58m57s. Which mean 63s gap => 6s/h.

It's better, but it's still not accurate enough. I don't want to use an external rtc since I have no more pin available. I have another test running, so I will know the result at 16:19 today.

So my questions are:
- What is the exact internal frequency for the timer? Is it 115200? Based on my last test, seems to be close to 115392.
- Do all the javelins have exactly the same internal frequency? My final application will run with more than one Javelin, and I would like all of them to stay allign.

Here are my calc:

Tick time = 1000000/115200 us

10 Heures:
36000000000 useconds
4147200000 ticks
11110111001100010100000000000000 tickes
High = 1111011100110000 = 0000100011001111 = -2255
Low = 0100000000000000 = 16384

Thanks,

Jean-Marc

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-06-04 13:49
    The interrupt occurs every 217 clockcycles. For the 25MHz crystal that leads
    to interrrupt cycle time of 217/25,000,000 = 8.68 usec
    Now the crystal frequence may vary slightly from·25MHz due to temperature variations.
    So·the Timer·accuracy is identical to the crystal accuracy + temperature variation.
    measured inaccuracy = 6s/h = 6s/3600s = 1/600 = 0.17%
    That's not·too bad.
    To·keep multiple processors time-aligned, make one processor·the·time-master
    and sync the other processors periodically to this time-master.

    regards peter
    ·
  • jmspaggijmspaggi Posts: 629
    edited 2008-06-04 14:20
    Hi Peter,

    Thanks for your reply. Will have I the same inaccuracy if I get a RTC chip? Or is it more accurate?

    Regards,

    JM
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-06-04 14:25
    An external RTC is usually better because of temperature compensation on chip
    and these usually use small 32.768kHz crystals which are very accurate.

    regards peter
  • jmspaggijmspaggi Posts: 629
    edited 2008-06-04 17:15
    Hi Peter,

    Thanks for your reply. Does it mean there is many qualities of 32.768kHz crystals? Also, I found DS3234 on the net, do you think that it's something which will be possible to use with the Javelin? The accuracy seems to be ±1min/yr.

    Thanks,

    JM

    Link: http://www.maxim-ic.com/products/timers/ds3234.cfm
    Update: Look like it's not a i2c one. This one should be: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/5283

    Message Edité (jmspaggi) : 6/4/2008 5:31:36 PM GMT
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-06-04 17:48
    The two most common available 32.768 kHz crystals have 6pF or 12.5pF capacitance.
    Be sure to use the correct one for the device.

    The device you linked is a very good candidate. Maxim/Dallas has a wide range of rtc chips.
    Another option is use a RF receiver to receive time via RF, like DCF77 (europe).
    http://www.compuphase.com/mp3/h0420_timecode.htm

    regards peter
  • jmspaggijmspaggi Posts: 629
    edited 2008-06-04 18:01
    Ho!

    RF seems to be a good idea. Do you know if we have that in North America?

    Also, if I want o buy a DS32C35 from Maxim/Dallas, do you know where I can found that? I don't want to buy 1 000 of then in bulk from Dallas [noparse];)[/noparse]

    Thanks,

    JM
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-06-04 18:09
    The USA uses WWVB.
    See here for a receiver circuit:
    http://www.ntp-time-server.com/wwvb-receiver/wwvb-receiver.htm

    A wwvb receiver connected to basic stamp.
    http://www.parallax.com/dl/docs/cols/nv/vol2/col/nv51.pdf

    regards peter

    Post Edited (Peter Verkaik) : 6/4/2008 6:18:37 PM GMT
  • jmspaggijmspaggi Posts: 629
    edited 2008-06-04 18:40
    Hi Peter,

    Thanks a lot for all this information. Look like for me, I will need to synch with CHU http://en.wikipedia.org/wiki/CHU_(radio_station) since I'm not in the signal range for WWVB (Montreal/QC). Do you know if modules built for CHU exists?

    With such signal, I will not need any RTC, I will just have to use an home made internal clock + CHU/WWVB sync.

    Regards,

    JM


    Coverage: http://tf.nist.gov/stations/wwvbcoverage.htm
Sign In or Register to comment.