0 Members and 1 Guest are viewing this topic.
Huixun Product Page
Bronn
STM32 crystal choice and design
«
on: January 23, , 12:11:37 am »
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 AN Oscillator design guide as best I can.
So far I have been looking at this crystal.
MCU: https://datasheet.lcsc.com/lcsc/_STMicroelectronics-STM32L431CBT6_C.pdf
Crystal: https://datasheet.lcsc.com/lcsc/_JWT-CFMT_C.pdf
design guide: https://www.st.com/resource/en/application_note/an-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..
Using the formula from the guide I have
Code: [Select]
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 * % mA/V
Code: [Select]
>> gm_crit =
1.
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
« Last Edit: January 23, , 12:15:37 am by Bronn »
betocool
Re: STM32 crystal choice and design
«
Reply #1 on: January 23, , 02:19:51 am »
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
Re: STM32 crystal choice and design
«
Reply #2 on: January 23, , 02:31:04 am »
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.
Bronn
Re: STM32 crystal choice and design
«
Reply #3 on: January 23, , 02:57:46 am »
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.
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.
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.
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.
« Last Edit: January 23, , 02:59:35 am by Bronn »
julian1
Re: STM32 crystal choice and design
«
Reply #4 on: January 23, , 11:05:53 pm »
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/msg/
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.
The following users thanked this post: Bronn
Hello Ryan,
As long as the crystal oscillator meets the required specs for the device which are outlined in Section 24.9.5 Main Oscillator Specifications that should be fine. We also have a list of crystal oscillators provided in the device datasheet. For this device you can find the full list on Table 24-19 Crystal Parameters. This also provides the values of any external components that should pair with those oscillators. Most customers use this to find a suitable oscillator for their design.
For more information, please visit crystal oscillator manufacturer.
Regarding the internal clock running at 80MHz, this is done by using the PLL inside of the device. The PLL can operate as long as the external oscillator ranges from 5 MHz up to 25 MHz. When running, the PLL operates at 200 MHz. From there, a clock divisor of 2.5 is applied in order to get the 80 MHz system clock frequency.
This is done in TivaWare with the following API:
//
// Set the system clock to run at 80MHz off PLL with external crystal as
// reference.
//
SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |
SYSCTL_OSC_MAIN);
For more details about the PLL and Clocking schema for the TM4C123x, I would recommend reviewing Section 5.2.5 Clock Control of the device datasheet.
For more frequency control productsinformation, please contact us. We will provide professional answers.