We would like to use the watchdog timer as a safety mechanism. However, we cannot seem to get it to run. The system_init() fuinction does indeed start it running, but then it is turned off (frozen) in several places, such as the periph_init() function (this operates directly on the registers), and also in main_func() before sleep. But we do not seem to be able to find anywhere where it is resumed (via wdg_resume() I would expect). I presume this should happen on wake, but we can't find it. Yet the documentation implies that it will be running. Could you let me know where it is supposed to be resumed? Or do I need to add a wdg_resume() myself somewhere (for example in arch_resume_from_sleep())?
Thanks,
Paul.
Device:
Hi pvmellor,
By default the watchdog timer is reloaded and resumed when the system wakes up. When the chip goes to sleep, the WDOG will be powered-off and the registers will be reset with the default values. So, upon wake-up, the BLE_WAKEUP_LP_Handler() will be executed, but there is no need to call the wdg_resume() because it’s automatically resumed. Do you have the CFG_WDOG macro defined in da1458x_config_basic.h in order to enable the WDOG? Also, is the CFG_DEVELOPMENT_DEBUG macro defined?
Thanks, PM_Dialog
结果是在arch_mai下面的代码n.c, main_func(void)
This code seems to freeze the WDOG before entering sleep but does not un-freeze it afterwards (if it had been running). So the WDOG stays off. We've simply commented this line out. If the debugger halts the CPU the WDOG is automatically stopped anyway, so I'm not sure I understand why this code is here in the first instance...?
To answer your questions anyway: yes CFG_WDOG is defined, but no CFG_DEVELOPMENT_DEBUG is not defined. I'm presuming the latter does not change the WDOG.
Anyway, with the line above commented out, it all seem sto work ok - thanks.
Paul.
Hi pvmellor,
If the CFG_DEVELOPMENT_DEBUG is defined, the debug mode is enabled and sets code execution in breakpoint in Hardfault and NMI (Watcdog) handleres. So, it It allows developer to hot attach debugger and get debug information. I would suggest you to have this macro defined.
Thanks, PM_Dialog