• AVR Freaks

Hot!INTOSC consistency?

Page: 12 > Showing page 1 of 2
Author
upand_at_them
Super Member
  • Total Posts : 681
  • Reward points : 0
  • Joined: 2005/05/16 07:02:38
  • Location: Pennsylvania
  • Status: offline
2020/09/24 17:42:52 (permalink)
0

INTOSC consistency?

I want to test some suspect watch crystals, connecting each to Timer1 of a PIC16F1825.  I first thought that I could gate Timer1 with my function generator.  But then realized that I don't need an accurate gate, just a consistent one.  Can I expect the internal HFINTOSC oscillator to be consistent from one minute to the next to produce a consistent gate time?  Same PIC, same setup, same ambient temp, etc.
#1

23 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18976
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: INTOSC consistency? 2020/09/24 18:37:01 (permalink)
    +1 (1)
    It will drift a little as the chip changes temperature.  And will drift over time.
    It depends on the accuracy you need.
    #2
    davea
    Super Member
    • Total Posts : 389
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: INTOSC consistency? 2020/09/24 18:58:59 (permalink)
    +1 (1)
    are you going to hot swap the crystals 
    if not powering on and off may change the HFINTOSC oscillator
    is your function generator a GOOD one ??
     
    #3
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/24 19:05:38 (permalink)
    0
    Function generator is only 20ppm stability/accuracy.
     
    I could hot swap, or power down/up.  Either one.
    #4
    davea
    Super Member
    • Total Posts : 389
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: INTOSC consistency? 2020/09/24 19:23:45 (permalink)
    +1 (1)
    I would hot swap
    if can you adjust the function generator to 32.768 khz
    send the OSC to a pin then
    look on a scope for the beat note between the two
    #5
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/24 19:49:14 (permalink)
    0
    I didn't know I could output the oscillator?  It's running in async mode.
     
    I just checked.  The CLKOUT is only on RA4, which I'm already using for the watch crystal.  So, no dice.
    post edited by upand_at_them - 2020/09/24 19:56:20
    #6
    davea
    Super Member
    • Total Posts : 389
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: INTOSC consistency? 2020/09/24 21:00:31 (permalink)
    0
    FIGURE 5-1: SIMPLIFIED PIC® MCU CLOCK SOURCE BLOCK DIAGRAM
    T1OSC
    Clock Source Option
    for other modules
     
    THERE ARE NONE....
     
    #7
    NorthGuy
    Super Member
    • Total Posts : 6350
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 05:57:37 (permalink)
    +1 (1)
    HFINTOSC is not good enough to verify the accuracy of the watch crystal.
     
    The easiest way to check, is to run the PIC from the watch crystal and check it against known time base, such as 1 Hz pulse, which you capture with CCP. Roughly, if you don't deviate within 2 sec, your crystal is within 20 ppm.
     
    If you want to check against another crystal, get another PIC, run it from this crystal  and bit-bang it to produce a pulse every 8192 clocks - this will be your 1 Hz reference pulse.
    #8
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 17:01:23 (permalink)
    0
    Here's what I wound up doing.
     
    Setup:
    - PIC16F1825
    - watch crystal (32,768Hz) running the dedicated secondary oscillator and incrementing Timer1
    - function generator outputting 1Hz TTL square wave to CCP1 pin
    - CCP1 capture triggers on 4th rising edge
    - when Timer1 overflows I increment an overflow counter
    - when CCP1 triggers I subtract current value (in [overflow:CCPPR1H:CCPR1L]) from the previous value
     
    And it does show that the crystals I measured as being fast by 1 second every 5 hours (~50ppm) are counting 32770 every second.  And they're *supposed* to be 20ppm.  And it's taking more capacitance that I thought to bring it down.  Was using 15pF caps, which I calculated as the correct load.  I'm now at 33pF caps and still only getting down to 32769 per second.
    #9
    NorthGuy
    Super Member
    • Total Posts : 6350
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 17:49:04 (permalink)
    0
    May be the function generator is too slow? You can buy a new good crystal and see if it is the same as others.
    #10
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 18:00:16 (permalink)
    0
    These are new crystals.  Just not good. :)
     
    #11
    ric
    Super Member
    • Total Posts : 28677
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: INTOSC consistency? 2020/09/25 18:21:47 (permalink)
    +1 (1)
    upand_at_them
    ...
      And it's taking more capacitance that I thought to bring it down.  Was using 15pF caps, which I calculated as the correct load.  I'm now at 33pF caps and still only getting down to 32769 per second.

    Can we double check your calculations?
    What data did you base them on?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #12
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 18:37:07 (permalink)
    0
    [delete]
    post edited by upand_at_them - 2020/09/25 18:42:52
    #13
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 18:42:10 (permalink)
    0
    Terrible formatting in previous post.
     
    CL = (C1 x C2)/(C1 + C2) + Cstray
     
    CL = 12.5pF (datasheet)
    Cstray ~ 5pF (estimate)
    ...C1 = C2 = 15pF
     
    #14
    davea
    Super Member
    • Total Posts : 389
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 19:46:24 (permalink)
    0
    CL = 12.5pF (datasheet) thats 25pF on each side
    are you using a R series ?
    there are 4 or 5 AP notes that talk about SOSC and cap values
    I ended up using 27pF and 33pF on the OSC out side
    still not exact...   
     
    #15
    ric
    Super Member
    • Total Posts : 28677
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: INTOSC consistency? 2020/09/25 19:55:00 (permalink)
    0
    davea
    CL = 12.5pF (datasheet) thats 25pF on each side

    That is the crude rule of thumb that disregards stray capacitance.
    upand_at_them has used the more accurate formula that does allow for it,
    although I think the 5pF allowance is a bit high.
    If you brought that back to 2pF, then the caps should be 21pF, so still lower than he found necessary.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #16
    davea
    Super Member
    • Total Posts : 389
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: INTOSC consistency? 2020/09/25 20:14:53 (permalink)
    0
    then the caps should be 21pF, so still lower than he found necessary

    I found that to be true
    and even 33pF both sides is not enough (one of the app notes showed 33pF has slow startup) 
    also found R series > 47k starts to draw more current...
    and made little difference.
    Im waiting for the "real answer" 
     
     
    #17
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/26 05:09:44 (permalink)
    +1 (1)
    Also, more capacitance causes more crystal aging.
     
    Well, I ran it for 12 hours, as a clock, with 33pF both sides and it's almost 1 second fast.  So that's about right for 20ppm, which is 1 second per 13.88 hours.  Would still like to get it better.  I have another crystal, different manuf, that is accurate to less then 1 second over two days (with 15pF and 22pF).
     
    #18
    davea
    Super Member
    • Total Posts : 389
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: INTOSC consistency? 2020/09/26 10:35:59 (permalink)
    0
    I have one timer using a S09 freescale and citizen crystal 12.5pF 22pF each side (CFS-145 20ppm)
    that has been running over 5 YEARS and it currently fast by 7 min.
    what makes microchip SOSC so different and hard to setup correctly ??
    waiting for upand_at_them's results...
    #19
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: INTOSC consistency? 2020/09/26 12:40:51 (permalink)
    -1 (1)
    My results?...For what test(s)?
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5