Skip to main content
Graduate II
November 26, 2025
Solved

Why is my HSE crystal not working on NUCLEO-L433RC-P board ?

  • November 26, 2025
  • 9 replies
  • 601 views

I have fitted an 8MHz crystal with 8.2pF capacitors to the NUCLEO-L433RC-P development board, but it is not working.

The software goes to an error handler when configuring the clocks, becuase of a time out iduring the function HAL_RCC_OscConfig (wait till HSE is ready)...

 

/* Set the new HSE configuration ---------------------------------------*/
 __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState);
 
 /* Check the HSE State */
 if(RCC_OscInitStruct->HSEState != RCC_HSE_OFF)
 {
 /* Get Start Tick*/
 tickstart = HAL_GetTick();
 
 /* Wait till HSE is ready */
 while(READ_BIT(RCC->CR, RCC_CR_HSERDY) == 0U)
 {
 if((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE)
 {
 return HAL_TIMEOUT;
 }
 }
 }

 

The part numbers for the crystal and capacitors are below...

Crystal: CG04874-8M

https://www.ndk.com/en/products/upload/lineup/pdf/NDKX03-00009_en.pdf

Capacitors: KGM05ACG1H8R2CH

https://datasheets.kyocera-avx.com/C0GNP0-KGM.pdf

The clock configuration is below...

freeflyer_0-1764187994761.png

The board modifications are below:

- fitted X2

- fitted C47 and C48

- connected solder bridges SB67 and SB69

- disconnected solder bridges SB68 and SB70

freeflyer_2-1764188307709.png

 

freeflyer_1-1764188213990.png

 

PS.  This relates to my other post about I2S master clock speed...

 

https://community.st.com/t5/stm32-mcus-products/can-i-use-an-internal-rc-oscillator-to-achieve-an-i2s-master/m-p/859639#M289324

 

    This topic has been closed for replies.
    Best answer by gbm

    @freeflyer If something is possible with 8MHz HSE then it's also possible with 8 or 4 MHz MSI.

    9 replies

    Technical Moderator
    November 26, 2025

    Dear @freeflyer ,

    my 2 cents checks :

    1) be sure at software level that HSE is enabled and not in bypass mode 

    2) even not recommended, check using an oscilloscope probe Osc_out pin , you can check it at the solder bridge . Not touch the Osc_in pin

    3) remove the software timeout from the function HAL ( just for test ) as should using the HSI at 16MHz , when doing this switch to HSE for PLL after .

     

    let us know

    STOne-32

     

    freeflyerAuthor
    Graduate II
    November 27, 2025

    Thanks STOne-32

    I have soldered a new crystal and new capacitors to a different development board (and modified the solder bridges). HSE was set to BYPASS, so I have now changed this to Crystal/Ceramic Resonator...

    freeflyer_0-1764253982006.png

     

    But it still fails on time out.

    I commented out "return HAL_TIMEOUT;" and it just hangs there.

    Is it not possible to buy this development board with the 8MHz crystal and capacitors already fitted ?

    Below is the whole function for SystemClock_Config...

    void SystemClock_Config(void)
    {
     RCC_OscInitTypeDef RCC_OscInitStruct = {0};
     RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
    
     /** Configure the main internal regulator output voltage
     */
     if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)
     {
     Error_Handler();
     }
    
     /** Configure LSE Drive Capability
     */
     HAL_PWR_EnableBkUpAccess();
     __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
    
     /** Initializes the RCC Oscillators according to the specified parameters
     * in the RCC_OscInitTypeDef structure.
     */
     RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE
     |RCC_OSCILLATORTYPE_LSE;
     RCC_OscInitStruct.HSEState = RCC_HSE_ON;
     RCC_OscInitStruct.LSEState = RCC_LSE_ON;
     RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
     RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
     RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
     RCC_OscInitStruct.PLL.PLLM = 1;
     RCC_OscInitStruct.PLL.PLLN = 10;
     RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
     RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
     RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
     if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
     {
     Error_Handler();
     }
    
     /** Initializes the CPU, AHB and APB buses clocks
     */
     RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
     |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
     RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
     RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
     RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
     RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
    
     if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
     {
     Error_Handler();
     }
    }

     

    Super User
    November 27, 2025

    @freeflyer wrote:

    SystemClock_Config (generated by CubeMX) has the line...

    RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;

    So, yes - that is in Bypass mode.

    That means the oscillator is bypassed: it is expecting an externally-generated clock signal - eg, from the ST-Link.

    A crystal will not work with this setup.

     


    @freeflyer wrote:

    how do I change this setting in CubeMx .


    Here:

     

    AndrewNeil_1-1764253466924.png

     

    Super User
    November 27, 2025

    The X2 part looks off-center. May not be a great connection there. If you use a heat gun, which you'll pretty much have to do with that part, it should self-center when the solder flows if there is sufficient flux.

    Also this joint doesn't look great. Hard to tell.

    TDK_0-1764218266517.png

     

    What you're trying should work, so likely there's a problem somewhere, hardware or software.

    Graduate II
    November 27, 2025

    ... and these SMD crystals with the pads only on the bottom are terrible for manual soldering.

    -> use lots of soldering flux, and enough heat

    + some Nucleo soldering bridges might be so small that when removing the 0R you leave a bridge with the solder.

    freeflyerAuthor
    Graduate II
    November 27, 2025

    Thanks all, I originally soldered the components with a soldering iron but it was a very difficult task.  The capacitors are tiny (0402) and the pads on the crystal are on the bottom of the component.

    I cleaned the board with IPA and then used my hot air gun to try and reflow the crystal but it still does not work.

    I used Kapton tape and cut a square hole in the tape (for the crystal) to protect surrounding components.

    The board has wires all over the place connecting to other development boards, so this makes it even more difficult.

    My hot air gun was set to 380 degrees C, but I worry about overheating and damaging the components too.

     

    Graduate II
    November 27, 2025

    Another problem with these crystals and the footprint: 

    beware the 90° mistake!

    180° on the other hand are okay.

    freeflyerAuthor
    Graduate II
    November 27, 2025

    Unfortunately changing HSE to Crystal/Ceramic Resonator still has not fixed the problem.

    Is it not possible to buy this development board with the 8MHz crystal and capacitors already fitted ?  Its a nightmare trying to solder them without specialised equipment, which I don't have.

    The second board is now out of use, because when I used the heat gun to try and reflow the solder for the crystal and capacitors, both capacitors for the HSE crystal and one of the capacitor for the LSE crystal popped off.

    Super User
    November 27, 2025

    @freeflyer wrote:

    Is it not possible to buy this development board with the 8MHz crystal and capacitors already fitted ?


    I think it is, indeed, not possible.

    Perhaps you can find a rework facility to do this for you?

    The Nucleos are targetted for simple evaluation - It sounds like you're at the point where you need to move to your own PCB...

     

    freeflyerAuthor
    Graduate II
    November 27, 2025

    I had to order the CG04874-8M crystal from Digikey, but as this comes from the US (to the UK) the delivery cost and time is high.

    Could I use this crystal (ABM8AAIG-8.000MHZ-V2R-T3) from RS instead...

    https://docs.rs-online.com/861b/A700000012715866.pdf

     

    Graduate
    November 27, 2025

    I do not quite understand why you need this crystal. With LF crystal present you may easily generate accurate high frequency clock using MSI synchronized to LSI.

    Super User
    November 27, 2025

    Indeed.

    And you have a crystal-generated HSE clock - from the ST-Link.

    freeflyerAuthor
    Graduate II
    November 27, 2025

    I have removed the ST Link top part of the board and now use an STLINK-V3MINIE on the header pins (for VCC, GND, RST, SWDIO and SWCLK).

    Are you saying I can feed the HSE clock on the STLINK-V3MINIE i into the NUCLEO-L433RC-P board ? 

    If so, how ?

    Graduate II
    November 27, 2025

    What Andrew said, and I wonder why you mount 8 MHz in the first place when you know you need 12.288 MHz (I guess for 48k audio) ?

    The PLL doesn't have the fraction stuff which I know from the H7s, so 8 MHz doesn't really help.

    And for everything that doesn't like clock jitter, like audio and CAN, do not use HSI anyway.

    Don't know the MSI mentioned by @gbm .

    freeflyerAuthor
    Graduate II
    November 27, 2025

    Good point I should be trying to fit a 12.888mhz crystal for 48khz audio.

    but my system clock is currently running at 80mhz (now using MSI)

     

    If I fit a 12.888MHz crystal then what would the system clock run at ?

    Super User
    November 27, 2025

    @freeflyer wrote:

    Good point I should be trying to fit a 12.888mhz crystal for 48khz audio.


    I was suggesting an external oscillator rather than a crystal.

     


    @freeflyer wrote:

    If I fit a 12.888MHz crystal then what would the system clock run at ?


    That will depend on what you do with the PLL and the various dividers ...

    Graduate II
    November 28, 2025

    12.288 MHz

    Attention to detail is very important for electronics development!

    ;)

    Check all other peripherals and interfaces if they need a specific clock which might not work with 12.288 MHz *x/y.

    For PLL checking CubeMx is really great.