This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R: cc2642 看门狗无法关闭问题

Part Number: CC2642R

问题描述:

1.看门狗开启成功,超时后也可以触发复位(看门狗触发到成功复位有一个比较长的时间间隔)

2.使用`Watchdog_close`将看门狗关闭后,达到看门狗的触发周期依然可以触发看门狗的复位.

看门狗相关代码:

```

Watchdog_Params watchdog0Params;
Watchdog_Handle watchdog0Handle = NULL;

unsigned char set_watchdogs(unsigned char status)
{
    unsigned char ret = 0xFF;
    switch(status){
    case 0x00:
        ret = 0x00;
        if(watchdog0Handle != NULL){
            Watchdog_clear(watchdog0Handle);
            Watchdog_close(watchdog0Handle);
        }else{
            DBG_E("Watchdog isn`t enabled");
        }
       
        break;
    case 0x01:
        ret = 0x01;
        if(watchdog0Handle != NULL){
            Watchdog_open(CONFIG_WATCHDOG_0, &watchdog0Params);
            Watchdog_clear(watchdog0Handle);
        }else{
            DBG_E("Watchdog isn`t init");
            my_watchdog_config();
        }
       
        break;
    default:
        break;
    }
    DBG_F("%s watchdogs", status?"Enable":"Disable");
    return ret;
}

void WatchdogCallbackFxn(Watchdog_Handle handle)
{
    printf("Watchdog timer triggered!\n");
    // releaseResources();
}

int my_watchdog_config()
{
    int ret = 0;
    Watchdog_init();
    Watchdog_Params_init(&watchdog0Params);
    watchdog0Params.resetMode = Watchdog_RESET_ON;
    watchdog0Params.callbackFxn = (Watchdog_Callback)WatchdogCallbackFxn;
    watchdog0Handle = Watchdog_open(CONFIG_WATCHDOG_0, &watchdog0Params);
    if(watchdog0Handle == NULL){
        ret = -1;
    }else{
        ret = 0;
    }
    return ret;
}

```