我想通过选项字节设置看门狗硬件方式启动,代码如下:
FLASH_OB_Unlock();
FLASH_OB_UserConfig(OB_IWDG_HW, OB_STOP_NoRST, OB_STDBY_NoRST);//OB_IWDG_HW
FLASH_OB_Launch();
FLASH_OB_Lock();
但是程序每次执行FLASH_OB_Launch()这句的时候就停止了,不知道是处于什么状态,必须要给它一个复位程序才能运行。
按照手册上看来,执行FLASH_OB_Launch();应该是产生一个系统复位,但也不至于程序停止啦,下面是手册上对OBL_LAUNCH位的描述
Bit 18 OBL_LAUNCH: Launch the option byte loading
This bit is set by software to launch the option byte loading. This bit is cleared only when the
option byte loading has completed. It cannot be written if OPTLOCK is set.
When this bit is set, a reset is generated.
0: Option byte loading complete
1: Option byte has to be loaded |