cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157C Custom Board not locking HSE

Otavio Borges
Associate III

Hi all,

I am designing a custom board using the STM32MP157CAD. But I haven't been able to get a lock on HSE crystal.

Still on tf-a, I removed st,bypass to use the internal oscillator, also used the DTS generated by STM32CubeMX, following my PCB design. But was only able to boot the board using HSI.

Enabling TF-A debug messages I was able to see that software was enabling HSE crystal and hanging on HSERDY flag until timeout. I tried to increase the timeout value but not even after 10s software was able to achieve a lock.

My crystal specs:

  • Freq: 24MHz;
  • Load capacitance: 20pF;
  • Freq. stability: +-30ppm
  • ESR: 40r

I have attached schematics and PCB connections with the crystal below (HCLK_IN goes to PH0 and HCLK_OUT to PH1)

OtavioBorges_0-1692893811807.png

OtavioBorges_1-1692894227542.png

What could be causing the HSE not to lock?

9 REPLIES 9
AScha.3
Chief II

just guessing: 30p seem hight to me for 24M crystal; i would try some like 2x 18 pF .

If you feel a post has answered your question, please click "Accept as Solution".
PatrickF
ST Employee

HI @Otavio Borges ,

Check again that bypass is not used by TF-A (maybe add some register dump).

I confirm that 30pF is huge, using a 24MHz crystal with 20pF load seems also high.
On our AN5031, we give example with 2x6.8pF using NX2016SA 24 MHz crystal (8pF crystal load spec).

Routing seems perfectible. Crystal must have ground plane and short wires without any other signals crossing around.

Please have a look to AN2867 for routing guidelines and also to choose right crystal specs and compute load capacitance.
https://www.st.com/resource/en/application_note/an2867-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

@PatrickF wrote:

HI @Otavio Borges ,

Check again that bypass is not used by TF-A (maybe add some register dump).

I confirm that 30pF is huge, using a 24MHz crystal with 20pF load seems also high.
On our AN5031, we give example with 2x6.8pF using NX2016SA 24 MHz crystal (8pF crystal load spec).

Routing seems perfectible. Crystal must have ground plane and short wires without any other signals crossing around.

Please have a look to AN2867 for routing guidelines and also to choose right crystal specs and compute load capacitance.
https://www.st.com/resource/en/application_note/an2867-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf


Most people just copy and paste what they found on some other schematic (“12MHz + 22pF? … sounds good!”). Unfortunately, if you want to get accurate and stable results out of the crystal, you need to match the capacitors to the specific crystal you chose, and it varies from model to model even with the same manufacturer

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

I end overlooking the load capacitors. I use the C=2*(CL + Cstray) formula to get those, but probably forgot to divide the value by 2 (with 5pF as stray, that would give 25pF).

I will try changing those to 12pF and will post the results.

PatrickF
ST Employee

Hi,

by computation for a Crystal with CL=20pF, assuming CStray = 4pF, I end up to CL1=CL2=32pF .

But this crystal might not oscillate because the transconductance (gm) required is too big (assuming C0=5pF, I end up to 2.3 mA/V) versus HSE datasheet (max 1.5 mA/V).

With crystal from AN5031 (NX2016SA, CL 8pF, 80 ohms, C0 = 1pF), gm is 0.6mA/V (so below the max of 1.5 mA/V).

If you put smaller capacitor on your 20pF crystal, it might oscillate as you reduced gm value, but then you are not using the crystal within its specified load, so I don't know what could the impact (for sure some frequency error).

Regards

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

I can confirm those. Reducing load capacitors allow HSE to lock on TF-A. But, by the time u-boot is loaded, there is too many frequency errors. Serial has multiple wrong characters and peripherals are not working. Gonna try ordering some new 24MHz crystals and matching capacitors and try it out.

ok.

but just ...you use a big and expensive cpu - why not spend some cents more for a oscillator , not just a old style crystal. i use only oscillators in my designs, no worry about capacitors or stray in spikes.

24M , cheap as 71 ct

https://www.mouser.de/ProductDetail/Epson-Timing/SG-210STF-24.0000ML5?qs=Li%252BoUPsLEnsd33bROKUfZA%3D%3D

 

or look at mouser...

https://www.mouser.de/c/passive-components/frequency-control-timing-devices/oscillators/standard-clock-oscillators/?frequency=24%20MHz&instock=y&sort=pricing

If you feel a post has answered your question, please click "Accept as Solution".

Big and expensive cpu increases my bom cost, so I will save the cents where I can, on a 300+ parts PCB those cents sum up to saved dollars.

Also, I never had problems using crystals with ST, so I assumed this time would be the same.

Finally, I am bound to what my fab house can supply.

I use the C=2*(CL + Cstray) formula to get those, but probably forgot to divide the value by 2 (with 5pF as stray, that would give 25pF).

First, in the formula one has to multiply, not divide. Second, the formula is wrong. The correct one is:

C = 2 * (CL - Cstray)

Therefore for a CL = 20 pF and Cstray = 5 pF, the capacitors should indeed be C = 30 pF. If it doesn't start because of other factors, then you have to use a different crystal. Not respecting the load capacitance requirement leads to frequency accuracy going significantly out of specification:

https://community.st.com/t5/stm32-mcus-boards-and-hardware/stm32f103c8-production-board-schematic/m-p/140430/highlight/true#M4541