2023-05-15 5:24 AM
I enabled WWDG on the MX and there were no other settings. MX_WWDG_Init(); As the function executes, the CPU resets, and when I look closely, I see that __HAL_RCC_WWDG_CLK_ENABLE(); As soon as the function runs, the CPU is reset. What should I do?
Below are WWDG setting values. This is also a program created automatically by MX.
void MX_WWDG_Init(void)
{
/* USER CODE BEGIN WWDG_Init 0 */
/* USER CODE END WWDG_Init 0 */
/* USER CODE BEGIN WWDG_Init 1 */
/* USER CODE END WWDG_Init 1 */
hwwdg.Instance = WWDG;
hwwdg.Init.Prescaler = WWDG_PRESCALER_8;
hwwdg.Init.Window = 127;
hwwdg.Init.Counter = 127;
hwwdg.Init.EWIMode = WWDG_EWI_DISABLE;
if (HAL_WWDG_Init(&hwwdg) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN WWDG_Init 2 */
/* USER CODE END WWDG_Init 2 */
}
void HAL_WWDG_MspInit(WWDG_HandleTypeDef* wwdgHandle)
{
if(wwdgHandle->Instance==WWDG)
{
/* USER CODE BEGIN WWDG_MspInit 0 */
/* USER CODE END WWDG_MspInit 0 */
/* WWDG clock enable */
__HAL_RCC_WWDG_CLK_ENABLE();
/* USER CODE BEGIN WWDG_MspInit 1 */
/* USER CODE END WWDG_MspInit 1 */
}
}
2023-05-16 9:11 AM
Hi @wkim.4 ,
Which STM32 are you using ?
You should know that ;)
"The watchdog circuit generates an MCU reset on expiry of a programmed time period, unless the program refreshes the contents of the down-counter. An MCU reset is also generated if the 7-bit down-counter value (in the control register) is refreshed before the down-counter has reached the window register value"
In you code, the watchdog counter and the window have the same value, did you try to reduce the hwwdg.Init.Window value?
Thanks
A.MVE
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.