Crystal oscillator variability between PICs?


+ Reply to Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Jan 2009
    Location
    Huntsville, AL
    Posts
    29

    Default Crystal oscillator variability between PICs?

    I have a timing critical application and am running an 8Mhz xtal with a 16F628a. When I program chip 1 with given HEX code (compiled with PBP), it runs roughly 23 ppm slow. I programmed a different 16F628a with the exact same code (same xtal and osc caps, same board, same ambient temperature, same spot on the table), and it runs about 800 ppm slow. What could explain this much variation between PICs with the same external crystal oscillator? Could some threshold or internal capacitance be slightly different between the two chips to affect oscillator freq that much? Everything's soldered on the board except the chip, which uses a socket.

    Also here's the obligatory monkey wrench: chip 1 seemed to run just fine with an 8Mhz crystal with the XT osc setting, so I am using the XT osc setting for both chips. Could that have something to do with it? When I have a chance to get back to the workbench, I plan on changing to HS to see if that does anything to either chip, but wanted to see if anyone had any experience with something like this.

    Thanks in advance!
    Dave

  2. #2
    Join Date
    Sep 2009
    Posts
    716

    Default Re: Crystal oscillator variability between PICs?

    You should be using HS. Try it...

  3. #3
    Join Date
    Jan 2009
    Location
    Huntsville, AL
    Posts
    29

    Default Re: Crystal oscillator variability between PICs?

    Yeah, that was it. After switching to HS it went from about 800ppm slower than I wanted to about 125ppm faster. The first chip also went from 23ppm slower to roughly 125ppm faster. For clarity, being 125ppm faster doesn't mean the crystal is off by 125ppm, it just means I need to add some pauseus statements to get my code spot-on.

    Thanks,
    Dave

  4. #4
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    395

    Default Re: Crystal oscillator variability between PICs?

    You got me thinking; you are using an old PIC. The PIC itself has a part in driving the oscillator crystal. Would a newer PIC, with "better" technology be more accurate than 125 ppm?? I have a time-critical project I'm using a PIC18F27Q43 with a 16 MHz crystal to generate a 64 MHz Fosc (w/PLL). It seems to be as accurate as my scope can show. Just thinking out loud.

  5. #5
    Join Date
    Dec 2010
    Location
    Melbourne Australia
    Posts
    87

    Default Re: Crystal oscillator variability between PICs?

    Yeah, I've read somewhere the new internal oscillators are supposed to be better than the old PICs.

    Some things to also keep in mind for really time critical applications - temperature of the oscillator which is manageable, but also acceleration if the oscillator is used in a dynamic environment. This includes substantial vibration. It has been suggested by some that this is the primary reason why all off-the-shelf GPS/GNSS modules are nominally limited to 4g acceleration before losing positional lock.

    Troy

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,104

    Default Re: Crystal oscillator variability between PICs?

    By internal oscillator you mean the RC internal oscillator, that has nothing to do with eternal Xtal oscillator.

    The RC will always be off because of tolerances and temperatures.

    Now, regarding the Xtal itself, will be off a bit by construction. But little and well defined on the datasheet. The most important factor though, for the precision of the frequency is the loading of the xtal (some are loaded in series, most are parallel loaded). User have to read the datasheet and see what capacitance needs the Xtal so it operates as expected. Too much or too little loading may result in slower or no oscillation. One of the loading capacitors may be a trimmer cap and be adjusted to obtain precise frequency.

    Ioannis

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,573

    Default Re: Crystal oscillator variability between PICs?

    If you need high precision timing ... just do use external oscillators like those : https://www.mouser.fr/datasheet/2/96...HS-1665263.pdf

    just my two cents ...

    poor man will add a trimmer capacitor in the Xtal circuit, but to be trimmed for each chip ...

    Other cheap solution is to turn to a 16F88 or 87 ( pin compatible ) and play with the OSCTUNE register ...

    Alain
    Last edited by Acetronics2; - 7th May 2021 at 12:51.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,104

    Default Re: Crystal oscillator variability between PICs?

    Once again I do not receive notifications of new post. Does anyone else have the same problem?

    Ioannis

  9. #9

    Default Re: Crystal oscillator variability between PICs?

    Yes same problem here. I used to but not anymore.

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,104

    Default Re: Crystal oscillator variability between PICs?

    Lester has taken care of this and hopefully we do receive replies now.

    Please post to test others.

    Ioannis

  11. #11

    Default Re: Crystal oscillator variability between PICs?

    Well I didn't receive a notification that this thread was replied to. I guess it's still not working.

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,104

    Default Re: Crystal oscillator variability between PICs?

    I am sure it does work. Check it please.

    Ioannis

  13. #13
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,573

    Default Re: Crystal oscillator variability between PICs?

    Hi, Ioannis

    I didn't receive any notification nor for posts 8 to 11 ... just for the last one ( Yours )

    Best Regards
    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  14. #14

    Default Re: Crystal oscillator variability between PICs?

    It's working for me now.

  15. #15
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,104

    Default Re: Crystal oscillator variability between PICs?

    Alain, about the time I posted Lester resolved the problem.

    It should be OK now.

    Ioannis

Similar Threads

  1. 1 x external crystal oscillator for multiple PICs
    By harryweb in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th November 2013, 14:05
  2. Multiple PICS from Same Crystal?
    By WOZZY-2010 in forum General
    Replies: 2
    Last Post: - 6th February 2010, 15:18
  3. 2 PICs driven by one Crystal problem
    By ivanzop in forum Schematics
    Replies: 1
    Last Post: - 9th August 2009, 15:40
  4. Crystal oscillator tied to supply voltage?
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th March 2009, 17:28
  5. Crystal oscillator problems on a 16f628a
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th February 2009, 16:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts