2024-08-28 01:41 AM
I'm having an issue with initialising my watchdog, when I include the call to HAL_WWDG_INIT(&hwwdg2) in my code, it is causing any debug attempt to run into the hardfault handler due to some values in SystemClock_Config() being set to 0:
__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{
/* Configure the SysTick to have interrupt in 1ms time basis*/
if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U)
{
return HAL_ERROR;
}
...
The SystemCoreClock and uwTickFreq values both get set to 0 when the execution reaches them. If I comment out my HAL_WWDG_INIT call, the execution will work without issue. The HAL_WWDG_INIT isn't even being ran before whatever is happening happens, if I put a breakpoint on both there and in the HAL_InitTick function, the HAL_InitTick function is reached first with the values altered.
Here's my Watchdog initialisation, it seems fairly innocuous: