Watchdog timer is not running

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
pvmellor
Offline
Last seen:1 year 5 months ago
Joined:2017-04-27 20:30
Watchdog timer is not running

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:
PM_Dialog
Offline
Last seen:2 days 13 hours ago
Staff
Joined:2018-02-08 11:03
Hi pvmellor,

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

pvmellor
Offline
Last seen:1 year 5 months ago
Joined:2017-04-27 20:30
It turned out to be the

结果是在arch_mai下面的代码n.c, main_func(void)

// In extended or deep sleep mode the watchdog timer is disabled // (power domain PD_SYS is automatically OFF). Although, if the debugger // is attached the watchdog timer remains enabled and must be explicitly // disabled. if ((GetWord16(SYS_STAT_REG) & DBG_IS_UP) == DBG_IS_UP) { wdg_freeze(); // Stop watchdog timer }

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.

PM_Dialog
Offline
Last seen:2 days 13 hours ago
Staff
Joined:2018-02-08 11:03
Hi pvmellor,

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