Author Topic: My crystals are disagreeing with each other.  (Read 2450 times)

0 Members and 1 Guest are viewing this topic.

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
My crystals are disagreeing with each other.
« on: September 24, 2017, 03:08:55 pm »
The STM32F303CCT6 can operate with two crystals: one watch crystal driving the RTC, and one high-speed crystal driving the processor clock PLL.

I derived two 1Hz signals from the clocks: the slow crystal is divided down to provide the 1Hz clock for the RTC. The fast crystal is PLL'd up to 72MHz, then divided down to provide a millisecond interrupt, and software counts 1000 interrupts to generate another 1Hz clock. Those two slightly disagree with each other.

Questions:

1) Why?
2) Which crystal is at fault? How to tell?
3) How to reduce or eliminate this?
 

Online coppice

  • Super Contributor
  • ***
  • Posts: 8637
  • Country: gb
Re: My crystals are disagreeing with each other.
« Reply #1 on: September 24, 2017, 03:12:16 pm »
The STM32F303CCT6 can operate with two crystals: one watch crystal driving the RTC, and one high-speed crystal driving the processor clock PLL.

I derived two 1Hz signals from the clocks: the slow crystal is divided down to provide the 1Hz clock for the RTC. The fast crystal is PLL'd up to 72MHz, then divided down to provide a millisecond interrupt, and software counts 1000 interrupts to generate another 1Hz clock. Those two slightly disagree with each other.

Questions:

1) Why?
2) Which crystal is at fault? How to tell?
3) How to reduce or eliminate this?
How "slightly" do they disagree? Are you talking about more than just the tolerance of the crystal? If so, are the crystals loaded properly? You can pull any crystal a little with poor loading, but if you used a crystal designed for VCXO applications you might be able to pull it quite a lot.
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: My crystals are disagreeing with each other.
« Reply #2 on: September 24, 2017, 03:16:00 pm »
The STM32F303CCT6 can operate with two crystals: one watch crystal driving the RTC, and one high-speed crystal driving the processor clock PLL.

I derived two 1Hz signals from the clocks: the slow crystal is divided down to provide the 1Hz clock for the RTC. The fast crystal is PLL'd up to 72MHz, then divided down to provide a millisecond interrupt, and software counts 1000 interrupts to generate another 1Hz clock. Those two slightly disagree with each other.

Questions:

1) Why?
2) Which crystal is at fault? How to tell?
3) How to reduce or eliminate this?
How "slightly" do they disagree? Are you talking about more than just the tolerance of the crystal? If so, are the crystals loaded properly? You can pull any crystal a little with poor loading, but if you used a crystal designed for VCXO applications you might be able to pull it quite a lot.
It is within the tolerance of the crystals, but it is there regardless. Those are properly loaded with 22pF (fast clock) and 3pF (slow clock) capacitors.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: My crystals are disagreeing with each other.
« Reply #3 on: September 24, 2017, 03:21:01 pm »
It is within the tolerance of the crystals, but it is there regardless.
:palm:
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
Re: My crystals are disagreeing with each other.
« Reply #4 on: September 24, 2017, 03:27:30 pm »
It is within the tolerance of the crystals, but it is there regardless.
:palm:
;D ;D

Yep, lesson one about crystals.
Because of how there physics work (how they are build), they WILL be different.

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: My crystals are disagreeing with each other.
« Reply #5 on: September 24, 2017, 03:28:28 pm »
"A man with one watch knows what the time is, a man with two is never sure!"

Of course the things differ (And neither one is actually 'right'), but if they are both in tolerance then why do you care?

Regards, Dan. 

 

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1719
  • Country: se
Re: My crystals are disagreeing with each other.
« Reply #6 on: September 24, 2017, 03:59:25 pm »
What everyone else said...

But I'll add this:
If you've used the HAL and SysTick, there's a nice little bug that will set the relevant registers with a value some ppm off for a "real" 1ms interrupt, for some PLL configurations.
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline cstratton

  • Regular Contributor
  • *
  • Posts: 62
  • Country: us
Re: My crystals are disagreeing with each other.
« Reply #7 on: September 24, 2017, 04:10:59 pm »
If you want to know which is at fault (or more likely, how much each is wrong by in which direction) you need a more trustworthy reference timebase.

For example, the 1 pps output of a GPS.

Or a temperature controlled reference oscillator.
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: My crystals are disagreeing with each other.
« Reply #8 on: September 25, 2017, 01:09:59 am »
What everyone else said...

But I'll add this:
If you've used the HAL and SysTick, there's a nice little bug that will set the relevant registers with a value some ppm off for a "real" 1ms interrupt, for some PLL configurations.

I am not using HAL - just hand-programmed registers.
 

Offline technixTopic starter

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: My crystals are disagreeing with each other.
« Reply #9 on: September 25, 2017, 01:14:06 am »
If you want to know which is at fault (or more likely, how much each is wrong by in which direction) you need a more trustworthy reference timebase.

For example, the 1 pps output of a GPS.

Or a temperature controlled reference oscillator.
I do have a Wi-Fi module on it with the intention of implementing NTP. Does NTP from a GPS-disciplined Stratum 1 NTP server on the same LAN offer good enough accuracy?
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 3713
  • Country: us
Re: My crystals are disagreeing with each other.
« Reply #10 on: September 25, 2017, 04:53:02 am »
NTP will be eventually be more accurate than a crystal, so that should work.  But it sounds like you crystals are in spec, so I wouldn't worry about it.  Crystals typically have similar aging and temperature drift as their accuracy spec.  That means that even if you measure them to 1 ppb today, it won't necessarily be that good tomorrow.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7369
  • Country: nl
  • Current job: ATEX product design
Re: My crystals are disagreeing with each other.
« Reply #11 on: September 25, 2017, 09:20:37 am »
It is within the tolerance of the crystals, but it is there regardless. Those are properly loaded with 22pF (fast clock) and 3pF (slow clock) capacitors.
I dont understand the question then. You already should know the answer.
1) Because tolerance
2) There is no fault, it is whiting spec.
3) The one which has smaller tolerance
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf