cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 crystal configuration times out?

SKarl.19
Associate II

I have a few boards using an STM32L4 part.

Some of the boards are working as expected, but others are not. The ones that don't work reach a timeout in the SystemClock_Config() function call. Specifically, they time out in the while loop at line 558 of stm32l4xx_hal_rcc.c

At this point, HAL is waiting for the HSE to be 'ready', which on these boards apparently never happens. I've probed the boards and the 24MHz crystal never starts oscillating like it does on the boards that do work.

Any idea what can be going on here? Could this happen if there is too much capacitance across the crystal? Maybe stray capacitance on the board making all the boards marginal?

3 REPLIES 3
Piranha
Chief II

Have you read the AN2867?

What is the crystal's load capacitance and capacitor values? How much board layers?

Measuring the actual HSE frequency through MCO, timer output or some other output against some known reasonably precise reference (oscilloscope should be OK) can also show how far from the target frequency the actual working boards are.

SKarl.19
Associate II

Thanks for the response, Piranha.

The crystal on the board is ECS p/n: ECS-240-8-47-CKM-TR

Its load capacitance is 8pF. On the board I've got two 16pF caps to GND from RCC_OSC_IN/OUT. Board is 6 layers. Traces between caps, crystal and STM32 are very short and compact.

I'm thinking that low load capacitance is getting pulled. I'm going to look for an alternative crystal to try out.

Piranha
Chief II

The capacitors are much too large. In this case it seems that 6,8 pF could be a good fit or at least a good value to start.

Read that application note or at least this:

https://blog.adafruit.com/2012/01/24/choosing-the-right-crystal-and-caps-for-your-design/

Also my post there:

https://community.st.com/s/question/0D53W00001JCWlASAX/stm32f103c8-production-board-schematic