2024-01-07 09:35 PM - edited 2024-01-07 09:41 PM
Hello ST Community,
I am encountering a clock configuration issue that I need assistance with.
I initially began with a blank template using an internal clock, and the code ran without any problems. However, when I attempted to configure a 24MHz external oscillator, I encountered an error loop during debugging. Here's the sequence of events:
Upon investigating further, I discovered that the HSE ready bit is not set in time for some reason during the clock configuration. As a result, HAL_RCC_OscConfig() returned HAL_TIMEOUT, leading the program into an error loop. I tried Increasing the timeout value from 100 to 1000 but it didn't help.
/* Wait till HSE is ready */
while (READ_BIT(RCC->CR, RCC_CR_HSERDY) == 0U)
{
if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
My clock tree is shown below:
I also recorded a 5-minute video of my process:
The code is uploaded in the zip attachment
I faced the same issue on two brand-new G431KB NUCLEO boards. I would appreciate any insights, suggestions, or guidance on resolving this issue. If anyone has encountered a similar problem or has expertise in clock configuration on this platform, your assistance would be invaluable.
Solved! Go to Solution.
2024-01-08 12:08 AM
Hi @STOne-32
Thank you for your quick response. I've located the G431 NUCLEO board schematic here:
https://www.st.com/resource/en/schematic_pack/mb1430-g431kbt6-a02_schematic_internal.pdf
Upon reviewing the schematic, I observed that the clock signal can be selected between the STLink Master Clock Output (MCO) and the 24MHz external oscillator by configuring soldering bridges (shown in the screenshot below). The issue with the previous clock error stemmed from none of the soldering bridges being connected on the new development board, leading to no clock signal being fed into the HSE pin.
To address this, I plan to connect the SB9 and SB10 soldering bridges on the development board, as illustrated below:
Your guidance has been immensely helpful in identifying the root cause of the problem. I appreciate your support.
Have a great day!
2024-01-07 10:54 PM
Dear @xlin.1
Can you provide the schematics and how the 24MHz crystal or 24MHz oscillator is connected to the HSE pins ?
Have a good day,
STOne-32
2024-01-08 12:08 AM
Hi @STOne-32
Thank you for your quick response. I've located the G431 NUCLEO board schematic here:
https://www.st.com/resource/en/schematic_pack/mb1430-g431kbt6-a02_schematic_internal.pdf
Upon reviewing the schematic, I observed that the clock signal can be selected between the STLink Master Clock Output (MCO) and the 24MHz external oscillator by configuring soldering bridges (shown in the screenshot below). The issue with the previous clock error stemmed from none of the soldering bridges being connected on the new development board, leading to no clock signal being fed into the HSE pin.
To address this, I plan to connect the SB9 and SB10 soldering bridges on the development board, as illustrated below:
Your guidance has been immensely helpful in identifying the root cause of the problem. I appreciate your support.
Have a great day!