Skip to main content
b.a.
Associate III
November 10, 2022
Question

How to choose crystal speed?

  • November 10, 2022
  • 9 replies
  • 7481 views

I just was wondering how you guys proceed to choose an external crystal, specifically what speed it should have...

The clock management with its tons of PLLs and dividers seems to be able to scale up almost any source to a desired frequency.

for the L4+ range that operate at 120MHz, it looks like that can be achieved from a 4MHz as easy as from a 48MHz crystal.

So what are the benefits and caveats of using a faster/slower crystal?

Or just stick with the 8MHZ of the Nucleo boards, which I think can be considered somewhat as a reference design?

9 replies

Peter BENSCH
ST Technical Moderator
November 10, 2022

You will find answers if you read the AN2867 carefully and try to ensure the stability of the oscillator with common high-frequency crystals and the required capacitors (including board parasitics) and over the whole temperature range.

It is simply cheaper and easier to realise if you use low-frequency crystals such as 4...8MHz for HSE.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
b.a.
b.a.Author
Associate III
November 11, 2022

Thanks Peter,

I had found that document already and am eagerly reading :)

AScha.3
Super User
November 10, 2022

my 2 cts : dont use a crystal, take crystal oscillator, frequ. medium, as reference boards use, maybe 8 or 12 or 25 MHz, and select the cheapest, thats available from different sources.

and set "bypass" in Cube for oszillator .

and put 80 or 100 ohm in clock connection, to avoid reflections and new trouble. (my way...)

"If you feel a post has answered your question, please click ""Accept as Solution""."
Tesla DeLorean
Guru
November 11, 2022

And if you have a strong need for a specific frequency TCXO. For example the use case calls for 10, 19.2, 26, 30.72 or 44 MHz. Radio being an application where tight on frequency and stable has significant benefits.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Piranha
Principal III
November 11, 2022

The first question is whether the device needs HSE at all. Many devices can run from HSI/MSI just fine.

Javier1
Principal
November 14, 2022

80% of the pain from my current job is to implement a ton of error corrections and line checks for some canbus XTALless products, someone tought back in the day no XTAL was needed since it worked okay in the lab with just HSI.

hit me up in https://www.linkedin.com/in/javiermuñoz/
Piranha
Principal III
November 15, 2022

As CAN is asynchronous, that just seems to be a bad decision, which most likely doesn't respect the specification.

b.a.
b.a.Author
Associate III
November 11, 2022

It sure will run, but if you want somewhat decent timing accuracy, it's sure not the way to go.

The specs are quite poor compared to a standard crystal setup...

Javier1
Principal
November 17, 2022

use XTAL, not those pesky resonators, a proper XTAL, and you will live longer and happier

hit me up in https://www.linkedin.com/in/javiermuñoz/
Piranha
Principal III
November 12, 2022

The question is whether the specific device needs that accuracy. For example, SPI, I2C and other synchronous interfaces doesn't need crystal level accuracy. Ethernet needs +/-50 ppm, which obviously needs a crystal. USB needs +/-0,25 %, but your MCU can do it with MSI synced with LSE or HSI48 with clock recovery based on USB SOF sequences.

S.Ma
Principal
November 12, 2022

Usb host would command external precise hse, then for usb device, msi would relax the constrains. Ethernet would probably require 25mhz which could be buffered by external transceiver fed to the mcu. For the hse value, clive gave some clues. Msi has some sweet frequencies. Otherwise, check flash wait states vs mhz and if low power is a concern on non msi mcu, running with pll bypass at high frequency enables instant prescaling gearing down and up.

gregstm
Senior II
November 14, 2022

If possible, I use no crystal. If I need a crystal for accurate audio generation/analysis, I just use the 32KHz crystal (which can be used to trigger DMA etc. up to 64KHz), as long as the 32KHz is providing an accurate drum beat, I don't care if the main processor is running at an imprecise frequency. I only resort to a higher frequency crystal when MHz clock frequency accuracy is required eg. generating a video signal.

BarryWhit
Lead
June 29, 2024

use XTAL, not those pesky resonators, a proper XTAL, and you will live longer and happier

As I learned quite recently on this very forum, recent MEMS oscillators (which are emphatically not quartz crystals) are low-power and have excellent characteristics. They cost more (1.15$ vs. 0.3$) but their performance is competitive with crystals (and can exceed it in terms of power consumption).

 

Also, for more generalized applications which employ crystals, you may learn about the trade-offs between low and high-frequency crystals here :face_with_tears_of_joy:

 

 

Update: One argument I haven't seen above is that although the PLLs can generate many different frequencies from your reference frequency, they are limited to specific ratios. If you need a specific frequency, the PLL may be able to achieve it based on crystal frequency and not with another. This can be important for interfaces with specific frequency requirements, or when you want to generate several specific frequencies by dividing the generated PLL clock. You have to get it right so you can get all the frequencies you need from one reference frequency. This SE may be useful.

 

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."
Tesla DeLorean
Guru
June 29, 2024

Watch out for environments with helium in them. Say Boeing Starliner..

The frequency chosen may be dictated by the specific interface and standard. Boards with Ethernet preferring 25 MHz sources over PLL or synthesized ones.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
BarryWhit
Lead
June 29, 2024

Helium???

 

One more consideration. "Power consumption in oscillators is essentially a linear function of frequency".

Example From STM32G4 datasheet:

OSC_pwr.jpg

 

If you're working to minimize power consumption, an extra 200uA can be very substantial.

 

"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."