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.
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.
Hi, Sigurd Hellesvik
wdt_disable return value: -1
Best regards
Hi,
-1 is EPERM.
From wdt_disable():
"-EPERM – If watchdog can not be disabled directly by application code. "
Maybe an easier way to achieve what you need is to save a Non-Volatile variable keeping track of the watchdog status.
Then enable the watchdog if the variables says so.
Did that make sense?
Regards,
Sigurd Hellesvik
Hi
i've no idea.
Best regards
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
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
Hi, Sigurd Hellesvik
thanks for reply, i konw your means.
go to sleep mode, dog will disable auto.
but when i will go to DFU,
dog will restart 3sec later,
however, i need restart now by call sys_reboot(0),
so it will restart twice.
maybe i can't call sys_reboot(0), only wait dog restart....
Best regards
Hi Yo,
yoyou said:maybe i can't call sys_reboot(0), only wait dog restart....
Try this.
Does it fix the problem?
Regards,
Sigurd Hellesvik
Hi
yes,fix the problem by wait dog restart,
but take time, Not timely enough.
Best regards
Hi Yo,
How do you do the DFU?
Serial or Bluetooth Low Energy?
Regards,
Sigurd Hellesvik
Hi
Serial or Bluetooth Low Energy?
Bluetooth for DFU.
Best regards