Skip to main content
Associate II
April 14, 2025
Solved

HSE clock lagging above 16 Mhz

  • April 14, 2025
  • 11 replies
  • 1260 views

I am using 30 Mhz crystal oscillator, and when I configure clock for 30 Mhz it doesn't work properly but when I configure 16 Mhz it works properly.

This topic has been closed for replies.
Best answer by mƎALLEm

@ChaitanyaParate 

Please review this new article: How to select a compatible crystal and load capacitors for STM32 with layout guidelines

11 replies

alfsch
Associate
April 14, 2025

Using 30M as a crystal is /maybe  a problem : many crystals (over 20M or so) are made as overtone crystals, most 3. harmonic, so your 30M crystal might be a 10M crystal, thats used on 3. overtone.

If using such a crystal in standard oscillator circuit, it will run at 10M.

So better stay with lower (=standard) frequency crystals, 8 or 16 MHz , and you have a reliable clock.

If you need 30 or 40 M oscillator (why ? ) , then be sure to have not a model for use at overtone and have the load caps very small, to get it running at all.

mƎALLEm
ST Technical Moderator
April 14, 2025

Hello,

Is it the same behavior as the other thread ?

If yes start by reviewing the compatibility of the crystal by referring to the AN2867 and calculating the gain margin:mALLEm_0-1744619426448.png

 

Do you get the gain margin > 5 based on what do you have in the HW?

what do you mean exactly by lagging? running at low frequency?

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Andrew Neil
Super User
April 14, 2025

@ChaitanyaParate wrote:

I am using 30 Mhz crystal oscillator, .


Do you mean a crystal oscillator - or just a crystal ?

Difference between just a crystal, and a crystal oscillator.

 


@ChaitanyaParate wrote:

 it doesn't work properly 


What, exactly, does that mean:

  • fails to oscillate at all ?
  • does oscillates, but at wrong frequency? If so, what frequency?
  • bursts into flames ?
  • other ... ?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate II
April 14, 2025

Its a crystal oscillator .

and by lag i mean when i put HAL_Delay(1000) I get a delay of almost 3 seconds when using 30, 32 , or 48 Mhz crystal oscillator.

mƎALLEm
ST Technical Moderator
April 14, 2025

Hello,


@ChaitanyaParate wrote:

Its a crystal oscillator .


Are you sure?

If yes, in that case you need to configure HSE in Bypass mode:

mALLEm_0-1744629414083.png

That configures one input GPIO for the crystal oscillator:

mALLEm_1-1744629470703.png

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
April 25, 2025
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.