2025-11-26 12:22 PM
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...
The board modifications are below:
- fitted X2
- fitted C47 and C48
- connected solder bridges SB67 and SB69
- disconnected solder bridges SB68 and SB70
PS. This relates to my other post about I2S master clock speed...
Solved! Go to Solution.
2025-11-27 7:47 AM
@freeflyer If something is possible with 8MHz HSE then it's also possible with 8 or 4 MHz MSI.
2025-11-26 12:45 PM
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
2025-11-26 8:39 PM
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.
What you're trying should work, so likely there's a problem somewhere, hardware or software.
2025-11-27 1:07 AM - edited 2025-11-27 1:08 AM
... 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.
2025-11-27 3:04 AM
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.
2025-11-27 3:17 AM
Another problem with these crystals and the footprint:
beware the 90° mistake!
180° on the other hand are okay.
2025-11-27 6:16 AM - edited 2025-11-27 6:36 AM
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...
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();
}
}
2025-11-27 6:24 AM
@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:
2025-11-27 6:29 AM - edited 2025-11-27 6:29 AM
@Andrew Neil wrote:So, yes - that is in Bypass mode.
There's another clue here:
Note how there is only one connection to the 'Input Frequency' box.
When configured for an external crystal, you would see two:
#HSEBypass
2025-11-27 7:02 AM
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.