Skip to main content
Visitor II
April 14, 2025
Solved

HSE clock lagging above 16 Mhz

  • April 14, 2025
  • 4 replies
  • 1226 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.

    4 replies

    Visitor II
    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.

    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?

    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 ... ?
    Visitor 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.

    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

     

    mƎALLEmAnswer
    Technical Moderator
    April 25, 2025