我使用demo中的例子,注释掉了按键
void?IWDG_Feed_Init(?u16?prer,?u16?rlr?) { ????IWDG_WriteAccessCmd(?IWDG_WriteAccess_Enable?); ????IWDG_SetPrescaler(?prer?); ????IWDG_SetReload(?rlr?); ????IWDG_ReloadCounter(); ????IWDG_Enable(); } /********************************************************************* ?*?@fn??????main ?* ?*?@brief???Main?program. ?* ?*?@return??none ?*/ int?main(?void?) { ????SystemCoreClockUpdate(); ????USART_Printf_Init(?115200?); ????printf(?"SystemClk:%d\r\n",?SystemCoreClock?); ????printf(?"ChipID:%08x\r\n",?DBGMCU_GetCHIPID()?); ????Delay_Init(); ????KEY_Init(); ????printf(?"IWDG?test...\r\n"?); ????Delay_Ms(?1000?); ????IWDG_Feed_Init(?IWDG_Prescaler_32,?4000?);???//?3.2s?IWDG?reset ????while(?1?) ????{ //????????if(?KEY_PRESS()?==?1?)????//PA0 ????????{ ?????????????Delay_Ms(?100?); ????????????printf(?"Feed?dog\r\n"?); ????????????IWDG_ReloadCounter();????//Feed?dog ????????????Delay_Ms(?10?); ????????} ????} } 我注释掉了按键,按道理来说他一直在循环喂狗,不应该重启,可实际他是?每个3.2S就重启,如下??在初始化看门狗就死机了,程序都运行不到打印喂狗
[00:13:42.930]收←◆SystemClk:96000000
ChipID:20700418
IWDG test...
[00:13:47.301]收←◆SystemClk:96000000
ChipID:20700418
IWDG test...
[00:13:51.672]收←◆SystemClk:96000000
ChipID:20700418
IWDG test...
[00:13:56.045]收←◆SystemClk:96000000
ChipID:20700418
IWDG test...
热门产品 :
CH585: 集成高速USB和NFC的蓝牙MCU