Skip to main content
Visitor
June 24, 2026
Question

STM32G474 + FL2400159 a 24 MHz HSE crystals — HAL_RCC_OscConfig always falls into the Error_Handler; I haven’t been able to figure out why

  • June 24, 2026
  • 1 reply
  • 62 views

Hi everyone,

I designed a board around the STM32G474 and I'm trying to use an external 24 MHz HSE crystal, but the crystal won't run under any configuration — the generated SystemClock_Config() call to HAL_RCC_OscConfig() returns HAL_ERROR and I land straight in Error_Handler() (infinite while(1) loop).

Crystal I'm using:

  • Manufacturer: Diodes Incorporated
  • Part Number: FL2400159
  • Frequency: 24.0000 MHz
  • Package: 3.2 x 2.5 mm, 4-pad ceramic SMD (Saronix-eCera FL series)
  • Load Capacitance (CL): 18 pF
  • ESR (Equivalent Series Resistance): 30 Ω
  • Frequency Tolerance: ±10 ppm
  • Frequency Stability: ±15 ppm
  • Operating temperature: -40°C ~ +85°C

Load capacitor values I've tried (0603 package, X7R):

  • 22 pF
  • 12 pF
  • 28 pF

Same result with all three: error. Based on the load capacitance formula (Cext = 2×(CL − Cstray), assuming Cstray ≈ 3-5pF), 28pF should be the closest to ideal, but even that didn't work.

What I've checked/done so far:

  • CubeIDE → RCC → High Speed Clock (HSE) is set to "Crystal/Ceramic Resonator" (not Bypass)
  • Increased HSE Startup Timeout from the default 100ms to 1000ms — still the same error
  • Data Cache enabled, Prefetch buffer disabled, Flash latency 4WS — probably unrelated to HSE but listing for completeness

I believe I've set everything correctly on the software/config side, but the crystal either isn't oscillating at all, or HSERDY never sets within the timeout HAL waits for. Could this be a PCB layout issue (grounding, guard ring, trace length), a pin mapping issue, or a problem with the crystal/soldering itself?

I've also attached photos of the schematic and PCB design for you guys to take a look at.
 

 

 

1 reply

mƎALLEm
ST Technical Moderator
June 24, 2026

Hello ​@ylmazuysal,

I’m sure I’ve already answered to that post, but on a thread with a different title not contaning Turkish words: STM32G474 + Diodes fl2400159 24mhz hse crystal hal rcc oscconfig always falls into error handler".

That’s strange as I didn’t find another post from you!

Anyway, I provide again my answer:

I did the exercise with the crystal STM32 compatibility calculator attached to this knowledge base article: How to select a compatible crystal and load capacitors for STM32 with layout guidelines

 

The crystal seems to be compatible with STM32G4 and the load capacitors are OK 28pF vs 30pF.

I suspect a PCB issue: solder joint issue or a bad crystal soldering orientation..

You can also share your SystemClock_Config() content.

Edit: after verification with a community moderator, there was indeed another post (a duplicated post) that has been deleted where I posted my comment.

@ylmazuysal in next time please avoid duplicating posts for the same question. Thank you.

Edit2: Just removed the wording “Diodes” from the title to prevent any misunderstanding of the context. Diodes is the manufacturer but putting that word in the title gives the impression you’ve added diodes to the HSE schematic.

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
June 24, 2026

I’m sure I’ve already answered to that post,

Yes, there was a duplicate - another moderator must have deleted it.

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.
mƎALLEm
ST Technical Moderator
June 24, 2026

Indeed. Just edited my post and mentioned that ..

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.