2025-06-11 11:24 AM
I have a brand new Nucleo G474RE board. I see that the default HSE is X3 at 24MHz. The solder bridges and capacitors are OK as per the board documentation, and checked to be physically on the board.
But I cannot get HSE to oscilate. The (autogenerated) clock config code times out here
HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
[...]
/* 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; <--- I end up HERE
}
}
}
I also probed pin 5 PF0 and pin 6 PF1 with an osciloscope with a 10X probe and they have no signal (both at 0VDC).
My MX configuration regarding the clocks is as follows:
- RCC -> HSE: Crystal/Ceramic Resonator
- PLL Source MUX: HSE
- divs and muls by default to reach SYSCLK=170MHz
If I switch back to HSI, the board works fine and my code executes normally.
I don't know what else to check for!
TIA.
Solved! Go to Solution.
2025-06-12 6:10 AM
Update: My board suddenly works. I don't understand what happened, since all I did was configure HSI, try it out, and then reconfigure back to HSE. But nevermind.
Thank to all that have replied!
2025-06-11 11:46 AM
Looks like you've be thorough. Not sure I recollect any complaints recently, but could just be bad board or crystal.
Which version of the circuit board?
Do any of the CubeG4 examples for the board work?
If you walk through the enabling in the debugger, and looking at the RCC registers, does it look to start at all, perhaps longer than the timeout?
Check SB25/SB26 present
https://www.st.com/resource/en/schematic_pack/mb1367-g474re-c04_schematic.pdf#page=3
Perhaps an image of the board would be helpful
2025-06-11 12:08 PM
This is from the Documentation:
HSE on-board oscillator from X3 crystal (default): For typical frequencies and its capacitors and
resistors, refer to the STM32 microcontroller datasheet and to the Oscillator design guide for STM8S,
STM8A and STM32 microcontrollers Application note (AN2867) for the oscillator design guide. The X3
crystal has the following characteristics: 24 MHz, 6 pF load capacitance, 20 ppm. It is recommended to use
NX2016SA-24MHz-EXS00A-CS10820 manufactured by NDK. The configuration must be:
– SB25 and SB26 ON
– SB24 and SB28 OFF
– SB27 OFF
– C56 and C59 soldered with 6.8 pF capacitors
So I checked SB25, SB26 ON
SB24 SB28 OFF
SB27 OFF
C56 and C59 soldered --- I did not check their value since they are tiny and soldered. I assume they are OK.
I am checking the examples and the cofig code for HSE is exactly the one I use, absolutely the same:
/* -2- Enable HSE Oscillator, select it as PLL source and finally activate the PLL */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV6;
RCC_OscInitStruct.PLL.PLLN = 85;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
/* Initialization Error */
Error_Handler();
}
but `HAL_RCC_OscConfig()` times out as explained above.
It does look I have a faulty Xtal or similar.
Does ST offer free board replacements? How to claim it? Or do I have to purchase a new board??
2025-06-11 12:36 PM
If you can't get an example from STM32CubeG4 package working, this is definetely a hardware issue.
Claim that issue aside with the distributor from which you purchased the board.
2025-06-12 6:10 AM
Update: My board suddenly works. I don't understand what happened, since all I did was configure HSI, try it out, and then reconfigure back to HSE. But nevermind.
Thank to all that have replied!