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.
/* 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)
/* USER CODE BEGIN WWDG_Init 2 */
/* USER CODE END WWDG_Init 2 */
void HAL_WWDG_MspInit(WWDG_HandleTypeDef* wwdgHandle)
/* USER CODE BEGIN WWDG_MspInit 0 */
/* USER CODE END WWDG_MspInit 0 */
/* WWDG clock enable */
/* USER CODE BEGIN WWDG_MspInit 1 */
/* USER CODE END WWDG_MspInit 1 */
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?