how to uninstall watch dog in NCS2.0.2?

Hello,

NCS2.0.2, nRF5340, VScode, watchdog

i want to uninstall watch dog before  sys_reboot(0)  for DFU;

but as follow no use. it will Restart twice.

void gog()
{
    feed_dog();
    wdt_disable(wdt);
   sys_reboot(0);
}
how to uninstall watch dog?
       
Best regards
Parents Reply
  • Hi,

    You can not call wdt_disable from you application.

    I suggest you do something like this in your code instead:

    #define WDT_TMP_DISABLE_ID 1
    
    int wdt_tmp_disabled[1];
    nvs_read(fs,WDT_TMP_DISABLE_ID,wdt_tmp_disabled,sizeof(wdt_tmp_disabled));
    if(wdt_tmp_disabled){
        wdt_tmp_disabled = 0;
        nvs_write(fs,WDT_TMP_DISABLE_ID,wdt_tmp_disabled,sizeof(wdt_tmp_disabled));
    }
    else{
        wdt_install_timeout(...)
        wdt_setup(...)
    }
    // ...
    // ...
    
    //If you want to restart temporary withour watchdog:
    wdt_tmp_disabled = 1
    nvs_write(fs,WDT_TMP_DISABLE_ID,wdt_tmp_disabled,sizeof(wdt_tmp_disabled));
    sys_reboot(0)

    Did the code example help your understanding?

    Regards,
    Sigurd Hellesvik

Children
Related