Watchdog_Params_init(&wdtParams);
wdtParams.resetMode = Watchdog_RESET_ON;
wdtHandle = Watchdog_open(Board_WATCHDOG0, &wdtParams);
if (wdtHandle == NULL) {
while (1);
}
wdttickValue = Watchdog_convertMsToTicks(wdtHandle,60000 );
Watchdog_setReload(wdtHandle, wdttickValue);
代码如上,CC1310中watchdog在60秒超时后不会立刻重启,而且是延时时几十秒后才重启,为什么?
换为如下代码,采用在WatchdogCallBack函数中直接调用SysCtrlSystemReset()就可以立刻重启。
// ======== watchdogCallback ========
void watchdogCallback(uintptr_t unused)
{
SysCtrlSystemReset();
}
static void oledTaskFunction(UArg arg0, UArg arg1)
{
uint8_t add=0, valveTimers=0, i=0,len=0;
char stringBuf[60]={0};
int16_t h=0,t=0,v=0,r=0;
uint32_t wdttickValue=0;
/* Create and enable a Watchdog with resets disabled */
Watchdog_Params_init(&wdtParams);
wdtParams.resetMode = Watchdog_RESET_OFF;
wdtParams.callbackFxn = (Watchdog_Callback)watchdogCallback;
wdtHandle = Watchdog_open(Board_WATCHDOG0, &wdtParams);
if (wdtHandle == NULL) {
while (1);
}
// set wathdog timeout period to 60s
wdttickValue = Watchdog_convertMsToTicks(wdtHandle,60000 );
Watchdog_setReload(wdtHandle, wdttickValue);
da qin zheng sheng:
软件复位是立刻执行的。
看门狗是第二次喂狗失败后动作。
xie wei:
回复 da qin zheng sheng:
也就是说第一次超60秒不执行,要第二次超60秒才重启?但第一次超60秒后程序就卡住不动了。
da qin zheng sheng:
回复 xie wei:
另外还要注意是否启动了低功耗。
Viki Shi:
回复 da qin zheng sheng:
排查下是否有开启低功耗,低功耗会影响看门狗的使用,具体描述如下:
Once started, the Watchdog will keep running in Active or Idle mode. When the device enters Standby mode, the Watchdog timer will stop counting down but the counter value will be preserved
Felix ZF:
第一轮计时到会产生中断,并开始第二轮计时,如果在第二轮计时到时没有喂狗,就会产生复位。
the WDT can be configured to generate an interrupt to the microcontroller (MCU) on its first time-out andto generate a reset signal on its second time-out.
If the interrupt is cleared before the 32-bit counter reaches its second time-out, the 32-bitcounter is loaded with the value in the WDT:LOAD register, and counting resumes from that value.