2023-08-24 09:25 AM
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:
I have attached schematics and PCB connections with the crystal below (HCLK_IN goes to PH0 and HCLK_OUT to PH1)
What could be causing the HSE not to lock?
2023-08-24 10:19 AM
just guessing: 30p seem hight to me for 24M crystal; i would try some like 2x 18 pF .
2023-08-25 06:52 AM
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
2023-08-25 10:51 AM
@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/
2023-08-26 09:13 AM
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.
2023-08-28 05:19 AM
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
2023-09-04 06:47 AM
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.
2023-09-04 07:43 AM
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
or look at mouser...
2023-09-05 08:02 AM
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.
2023-09-06 05:38 AM
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: