My crystals are disagreeing with each other. - Page 1
Forum section: electronics / general

author: technix
author_rank: Super Contributor
timestamp: September 24, 2017, 03:08:55 pm
content: 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?

author: coppice
author_rank: Super Contributor
timestamp: September 24, 2017, 03:12:16 pm
content: Quote from: technix on September 24, 2017, 03:08:55 pmHow "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.

author: technix
author_rank: Super Contributor
timestamp: September 24, 2017, 03:16:00 pm
content: Quote from: coppice on September 24, 2017, 03:12:16 pmIt 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.

author: fcb
author_rank: Super Contributor
timestamp: September 24, 2017, 03:21:01 pm
content: Quote from: technix on September 24, 2017, 03:16:00 pm

author: b_force
author_rank: Super Contributor
timestamp: September 24, 2017, 03:27:30 pm
content: Quote from: fcb on September 24, 2017, 03:21:01 pmYep, lesson one about crystals.Because of how there physics work (how they are build), they WILL be different.

author: dmills
author_rank: Super Contributor
timestamp: September 24, 2017, 03:28:28 pm
content: "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.

author: newbrain
author_rank: Super Contributor
timestamp: September 24, 2017, 03:59:25 pm
content: 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.

author: cstratton
author_rank: Regular Contributor
timestamp: September 24, 2017, 04:10:59 pm
content: 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.

author: technix
author_rank: Super Contributor
timestamp: September 25, 2017, 01:09:59 am
content: Quote from: newbrain on September 24, 2017, 03:59:25 pmI am not using HAL - just hand-programmed registers.

author: technix
author_rank: Super Contributor
timestamp: September 25, 2017, 01:14:06 am
content: Quote from: cstratton on September 24, 2017, 04:10:59 pmI 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?

author: ejeffrey
author_rank: Super Contributor
timestamp: September 25, 2017, 04:53:02 am
content: 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.

author: tszaboo
author_rank: Super Contributor
timestamp: September 25, 2017, 09:20:37 am
content: Quote from: technix on September 24, 2017, 03:16:00 pmI dont understand the question then. You already should know the answer.1) Because tolerance2) There is no fault, it is whiting spec.3) The one which has smaller tolerance