最后发现貌似还有一个看门狗:WWDG,这个窗口看#include "wwdg.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
WWDG_HandleTypeDef hwwdg;
/* WWDG init function */
void MX_WWDG_Init(void)
{
hwwdg.Instance = WWDG;
hwwdg.Init.Prescaler = WWDG_PRESCALER_8;
hwwdg.Init.Window = 0x40;
hwwdg.Init.Counter = 0x7f;
hwwdg.Init.EWIMode = WWDG_EWI_ENABLE;
if (HAL_WWDG_Init(&hwwdg) != HAL_OK)
{
Error_Handler();
}
}
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();
/* WWDG interrupt Init */
HAL_NVIC_SetPriority(WWDG_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(WWDG_IRQn);
/* USER CODE BEGIN WWDG_MspInit 1 */
/* USER CODE END WWDG_MspInit 1 */
}
}
门狗看起来虽然复杂一些,但是貌似会被待机模式关闭,说干就干,这就用CUBE来一段: |