2025-04-14 1:11 AM
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.
Solved! Go to Solution.
2025-04-25 4:11 AM
Please review this new article: How to select a compatible crystal and load capacitors for STM32 with layout guidelines
2025-04-14 1:20 AM
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.
2025-04-14 1:31 AM
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:
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?
2025-04-14 1:55 AM - edited 2025-04-14 2:03 AM
@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:
2025-04-14 4:09 AM
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.
2025-04-14 4:18 AM - edited 2025-04-14 4:18 AM
Hello,
@ChaitanyaParate wrote:
Its a crystal oscillator .
Are you sure?
If yes, in that case you need to configure HSE in Bypass mode:
That configures one input GPIO for the crystal oscillator:
2025-04-14 5:47 AM
after selecting Bypass code is entering Error_Handler() in line
HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK
2025-04-14 6:11 AM
Hello;
Is it the same crystal and the same project as this thread? if yes why did you accept it as solution? Please clarify this point. Is it the same project?
And this is NOT a cystal oscillator but this is only a crystal.
Did you replace R16 by a solder bridge?
2025-04-14 6:12 AM
So look into HAL_RCC_OscConfig and see what is causing it to fail.
What result is it returning?
2025-04-15 7:25 AM