Crystal selection... where theory [fails] reality. Why are two caps necessary if one works?

Discussion in 'Embedded Systems and Microcontrollers' started by s_mack, Aug 4, 2015.

  1. s_mack

    Thread Starter Member

    Dec 17, 2011
    187
    5
    I designed a circuit and just got prototypes made and the first thing that was tried was, of course, powering it up. The oscillation failed to start.

    Using an STM32F2 MCU, I followed the recommendations set out by the datasheet as well as STM's AN2867. Did the math, calculated 22pF capacitors. Of course, we have to guess a bit at stray capacitance, so the calculation isn't expected to be perfect. Still, the target gain margin worked out to 8.8, which is higher than their recommended margin of "5 or greater" so I fully expected the oscillation to start.

    Now, what I'm a little confused on is why removing one of the two 22pF caps solved the issue. Just popped that sucker off and now it seems fine. EVERY bit of documentation I've ever read on the subject suggests you need two same-value caps on either side of the crystal. I'm just curious on why that's not really the case. I didn't expect operating with a single 22pF (on the OSC_OUT pin) would work but it did. And was 8.8 just too close to their magic number of 5? I mean, 5 was supposed to just give wiggle room from 1, right? So do we really need margin on top of margin? Is this indicative of some other issue?

    One thing I'm wondering (and awaiting confirmation from the assembly house) is if the crystal that was placed was really the crystal I specified. Maybe the true values for its shunt/load capacitances and/or ESR are not the same as what I was using in the equations, so maybe my 8.8 is really below < 5. Or perhaps my stray capacitance is far higher than it should be, although I can't imagine I could have gotten the caps any closer to the crystal, nor the crystal any closer to the MCU.
     
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    The ratio of the capacitors determines the feedback factor to the oscillator. If the oscillator fails to start (low gain in the inverter, low Q crystal), increasing the feedback might make it start. Increasing the feedback means playing with the ratio of the two capacitors. Note that with no external capacitor, there is still about 10pF of stray capacitance on any IC pin, so leaving it out reduced that capacitor from (22+10)pF to 10pF. Got it?

    I'll bet if you took out the other capacitor and put the first back in, it wouldn't oscillate, because you upset the balance the wrong way.
     
    Last edited: Aug 4, 2015
  3. s_mack

    Thread Starter Member

    Dec 17, 2011
    187
    5
    Thanks Mike.
     
Loading...