2025-06-19 4:07 AM
Hello, I have a custom board wich is based on the evspin32g4-dual Board. I generated the code with motorcontrol work bench and could upload it with a j-link. I added an uart output in the startup and noticed that it kept printing it, so the board was constantly resetting. When I stepped through the code the problem was in HAL_Delay, as the HAL_GetTick() function always returned the same value, thus not leaving the function. Could there be an error with the external Crystal? I am using a ECS-240-8-37-CKM-TR with 8pF caps.
Thanks!
2025-06-19 4:27 AM
Hello @QuirinS,
The HAL_GetTick() function relies on the SysTick timer, which in turn depends on a stable clock source, so yes, probably it's an issue with the crystal.
You can refer to AN2867 for oscillator design guidelines.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-06-19 4:31 AM
I would try to verify this by building a version using the internal oscillator (HSI).
Check the PLL settings to get the same system clock rate as with the HSE.
2025-06-19 5:24 AM
Thanks for your reply, I just checked the project and HSI is already in use.
2025-06-19 5:25 AM
If the code is running, it's not likely a crystal problem.
Probably you're calling HAL_Delay in an interrupt context, or with interrupts disabled.
Set SysTick priority to 0 and everything else above that.
2025-06-19 5:43 AM
I was able to step over the delay and ran into a breakpoint in SysTick_Handler, so the reset is caused by something else.
2025-06-19 5:47 AM
Well, then "run a little further"! ;)
2025-06-19 5:52 AM
If it's resetting, look at RCC->CSR after startup to determine why.