»
(006) Watchdog Summary
(008) CubeIDE Implementation of USB Peripherals*
(018) C99 pointer*
(019) C99 With only value assignment*
(022) POSIX pthread multi-threads mutex*
(023) POSIX pthread multi-threads programming*
(027) C99 time and wait*
(028) High-precision calculation with GMP*
(029) Web Service Lib*
(030) International Components for Unicode (ICU)*
(031) Performance of C is higher than C++, because...*
本看门狗总结基于网络知识以及个人STM32F03C8T6RC的实验,不涉及任何业务。
1、如果设置了看门狗,要把它清除掉
if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST) ==SET){
RCC_ClearFlag();
}
2、解除写保护
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
3、配置分频与重装值,间隔时间4秒:
IWDG_SetPrescaler(IWDG_Prescaler_32);//设置对LSI的分频,LSI时钟32767Hz
IWDG_SetReload(0x0FFF);/装载值4k
4、喂狗
IWDG_ReloadCounter();
5、启动看门狗
IWDG_Enable();
6、while循环中不断地喂狗
while(1){
IWDG_ReloadCounter();
}
IWDG一旦开启,在单片机带电过程中,无法关闭,只能重新设置分频和重装值来扩展间隔时间。在STM32CubeMX中,默认的IWDG配置的间隔时间为0.5秒。
————www.v-signon.com学习者共勉