STM32 crystal choice and design - Page 1
Forum section: electronics / projects

author: Bronn
author_rank: Newbie
timestamp: January 23, 2022, 12:11:37 am
content: Hi, I just need a little help to double check if Im doing this right.Im designing a breakout board for an STM32L431C8T6 and am trying to pick a crystal for the HSE oscillator. Ive been following the AN2867 Oscillator design guide as best I can.So far I have been looking at this crystal.MCU:https://datasheet.lcsc.com/lcsc/1811081824_STMicroelectronics-STM32L431CBT6_C277951.pdfCrystal:https://datasheet.lcsc.com/lcsc/2008211535_JWT-CF4040M00015T8188060_C709171.pdfdesign guide:https://www.st.com/resource/en/application_note/an2867-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdfrelevant information on the MCU:QuoteUsing the formula from the guide I haveCode:Rext = 0;CL = 8e-12; % LoadC0 = 5e-12; % Shuntf = 40e6; % freqESR = 30;gm_crit_max = 1.5; %MCUgm_crit = 4*(ESR + Rext)*(2*pi*f)^2*(C0+CL)^2 * 1000 % mA/VCode:>> gm_crit =1.2810So since 1.281 < 1.5 this should be ok?A couple of concerns.The crystal data sheet states only 1 value of C_L as 8pF for the whole range from 8MHz - 54MHz. Im worried they only gave a value for the lowest frequency and the frequency Im using may be more than this?And the other problem is Im not sure how to calculate the R_ext value, if its needed. The design guide requires measuring the current which I can't really do.How do you go about choosing a crystal if you can't do this measurement? It seems common to choose 0Ω but Im not sure if I can make that call since this is much higher speed than all YouTube examples Ive seen.Thanks

author: betocool
author_rank: Regular Contributor
timestamp: January 23, 2022, 02:19:51 am
content: I've done a few STM32 designs on different families.For ease most of the time I chose an oscillator. However, since that is not your question, in cases where I've used crystals, I took the design guide as reference / rule of thumb. So, for a 25Mhz crystal, off the top of my head, I'd have gone with 18pf I believe, with 33R or 50R series resistor. Good thing about resistors, you might not even really need them, so you can add a bridge if that is the case.One thing, both caps I used where always the same value, do I understand correctly that you're using 5 and 8 pf?Cheers,Alberto

author: Bronn
author_rank: Newbie
timestamp: January 23, 2022, 02:31:04 am
content: Thanks.I hadn't calculated the load capacitors yet but if I wanted CL= 8pF and using assumption that C_stray = 5pF then I guess I would be using a pair of 2(8-5) = 6pF?At the moment Im just trying to see if the MCU can start up and run this crystal safely. I have used out of the box values/crystal I borrowed from YouTube on other designs but for this one I thought I would try and go through the process myself and pick a crystal.

author: Bronn
author_rank: Newbie
timestamp: January 23, 2022, 02:57:46 am
content: ThanksQuoteI did check out some Nucleo boards designs. I couldn't find any that used frequencies above 16MHz and the crystals in that range seemed to fit well below specs. I guess just this crystal is kinda on the edge of the values is what brings uncertainty to me. Furthermore, I m planning to use JLCPCB's assembly option so I'm limited to their stock and can't exactly pick the same components from Nucleo BOM.QuoteYeah, I guess worst case I can just desolder parts and use components/values I know will work.QuoteIve tried searching for this value. Maybe I just don't know what I'm looking for, what is it listed as? Is it in the section Ive attached? is it just Vdd?Thanks for the suggestions, Ill have to go through them in detail.

author: julian1
author_rank: Frequent Contributor
timestamp: January 23, 2022, 11:05:53 pm
content: I went down the same rabbit hole trying to calculate xtal currents following stm32 design guidance,https://www.eevblog.com/forum/beginners/santity-check-units-is-10uw-a-plausible-drive-level-for-mcu-crystal/msg3417874/The way I approach it now, is to just include an optional footprint for an extra series resistor, and then probe the osc amplitude.If the current/ amplitude is too large (ie greater than 2-2.5V) then add some series resistance. In general, smaller physical crystals - ie smt versus through-hole crystals have higher ESR. And lower freq (8MHz v 16MHz) will also have higher esr. In practice for 8MHz and small smd xtal with a 0R series is fine. I forget, but ST (or maybe someone else?) already adds some series resistance to the cmos driver.For caps, the value depends on the xtal loading capacitance, and board trace stray capacitance - which is almost always reasonably constant. In practice - if one picks crystals with the same loading capacitance regardless of manufacturer part, formfactor or freq, then one can use the same cap values between designs.