Skip to main content
Explorer
August 24, 2023
Question

STM32MP157C Custom Board not locking HSE

  • August 24, 2023
  • 3 replies
  • 3750 views

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?

    This topic has been closed for replies.

    3 replies

    Super User
    August 24, 2023

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

    Technical Moderator
    August 25, 2023

    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

    Graduate II
    August 25, 2023

    @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/

    Technical Moderator
    August 28, 2023

    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

    Explorer
    September 4, 2023

    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.

    Super User
    September 4, 2023

    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