我专门测试了CC2541硬件复位功能HAL_SYSTEM_RESET,该功能只在两种时钟模式下才能正常复位,代码如下:
/* disable interrupts, set watchdog timer, wait for reset */
#define HAL_SYSTEM_RESET() st( HAL_DISABLE_INTERRUPTS(); WDCTL = WD_RESET1; WDCTL = WD_RESET2; for(;;); )
只有当WD_RESET1和WD_RESET2为0x03和0x02时,系统才能可靠复位,即看门狗定时器工作在1.9 ms和15.625 ms时才可以复位,其它模式如0.25 s和1s都不能复位。
//10: Clock period × 512 (approximately 15.625 ms)
//11: Clock period × 64 (approximately 1.9 ms)