Electronics > Projects, Designs, and Technical Stuff

STM32 crystal choice and design

(1/2) > >>

Bronn:
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.pdf

Crystal: https://datasheet.lcsc.com/lcsc/2008211535_JWT-CF4040M00015T8188060_C709171.pdf
design guide: https://www.st.com/resource/en/application_note/an2867-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf


relevant information on the MCU:

--- Quote ---...For C_L1 and C_L2, it is recommended to use high-quality external ceramic capacitors in the 5 pF to 20 pF range (typ.)...
..Gm Maximum critical crystal transconductance = 1.5mA/V..

--- End quote ---

Using the formula from the guide I have

--- Code: ---Rext = 0;
CL = 8e-12; % Load
C0 = 5e-12; % Shunt
f = 40e6; % freq
ESR = 30;
gm_crit_max = 1.5; %MCU
gm_crit = 4*(ESR + Rext)*(2*pi*f)^2*(C0+CL)^2 * 1000 % mA/V

--- End code ---


--- Code: --->> gm_crit =

    1.2810


--- End code ---

So 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

betocool:
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

Bronn:
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.

evb149:
Just a general comment -- you did well getting the relevant application note and following its guidance.
But from a practical "confirming typical design details" standpoint, it would be wise to also download all of the
application notes / CAD resources relevant to developer kits and reference design PCBAs and "minimal BOM" type
publications.  I assume there would be at least one devkit, one or more reference design boards, and maybe a minimal BOM / circuit example related AN.

In all of those cases you'd get some example BOM part numbers for actual crystals they use with a comparable MCU family member in the
similar package you have.  The devkit and reference design should also show the component positioning and tracking they commend in addition to
whatever the crystal oscillator design and layout notes suggest.

One variable is the PCB stackup materials and outer layer to ground capacitance you will have from the crystal / load capacitor pads and tracking and also the
MCU xin / xout PCB pads themselves.  If you have a closely spaced ground plane or something underneath and / or to the side that can be quite significant.

So you may pick up a couple / few pF of parasitic capacitance from those sources as well as the crystal / load capacitor packaging etc.

You should use C0G / NPO type capacitors with relatively precise capacitance tolerances for this (why not, if you want the frequency to be accurate).  They're usually
commonly available and quite inexpensive.  Since this is a common design need for almost every crystal oscillator design as well as for RF circuit filter / coupling caps etc.
it is good to have a variety of these class 2 dielectric MLCCs handy in your favorite package size(s) e.g 0603, 0402 imperial.
So why not just order 10-25 each of 3.3pF or whatever up through 27pF in the common values every few pF and then you'll have adequate parts on hand.
There are also low-ish cost C0G MLCC sample packs / kits with 10-25 or whatever pieces per value of all the common values in a certain range on cut tape and with some
kind of little pouch / binder / book or something maybe to organize them.

Anyway my other point is because it isn't an exact science to pick the right capacitor value you should guess the right one from the calculations and reference designs / application notes and try it but maybe due to your particular PCB or whatever you'll actually do better with a slightly different value couple pF either way in which case you can measure the actual oscillation frequency against a GPS PPS signal or something or cheap $10 calibrated TCXO frequency counter and then tweak the capacitance up or down as needed.  It'll probably work fine with a range of values but maybe you'll be a few ppm off one way or another depending on the crystal and circuit etc.

The ESR of the crystal should be given in the crystal data sheet for a particular model or range of frequencies so that answers one question.
The AC amplitude of the oscillation drive voltage applied to the crystal by the MCU should be specified by the MCU data sheet for a given MCU supply operating voltage.
That's the other parameter.  Then you can find the compatible drive level to stay within the maximum drive level for a given crystal and the current etc.

You might want to read other information about XOSC design e.g. the ANs from the common crystal manufacturers they can shed more light on measurement and design too.

If the data sheet for the part you are considering is not so complete as you'd like with definitive specifications etc. then maybe find another vendor that does, there are like half a dozen common crystal manufacturers and dozens more less well known ones with parts in stock for common frequencies.

This is a valuable / useful exercise in crystal oscillator design but also pragmatically you could also consider just putting down the footprint for an integrated crystal oscillator with
the appropriate supply voltage and output type / level for the MCU..Then you have zero analog tuning / design concerns, not nearly as much sensitivity to PCB related noise on the oscillator performance, and less soldering (resistor, capacitors) needed.



Bronn:
Thanks


--- Quote ---Just a general comment -- you did well getting the relevant application note and following its guidance.
But from a practical "confirming typical design details" standpoint, it would be wise to also download all of the
application notes / CAD resources relevant to developer kits and reference design PCBAs and "minimal BOM" type
publications.  I assume there would be at least one devkit, one or more reference design boards, and maybe a minimal BOM / circuit example related AN.

--- End quote ---
I 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.


--- Quote ---Anyway my other point is because it isn't an exact science to pick the right capacitor value you should guess the right one from the calculations and reference designs / application notes and try it but maybe due to your particular PCB or whatever you'll actually do better with a slightly different value couple pF either way in which case you can measure the actual oscillation frequency against a GPS PPS signal or something or cheap $10 calibrated TCXO frequency counter and then tweak the capacitance up or down as needed.  It'll probably work fine with a range of values but maybe you'll be a few ppm off one way or another depending on the crystal and circuit etc.

--- End quote ---
Yeah, I guess worst case I can just desolder parts and use components/values I know will work.



--- Quote ---The AC amplitude of the oscillation drive voltage applied to the crystal by the MCU should be specified by the MCU data sheet for a given MCU supply operating voltage.

--- End quote ---
Ive 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.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version