Hi Dialog
I use ftreertos_rtt to test watchdog function, but seems no reset when watchdog timeout. I defined dg_configUSE_WDOG as 1 and registered a watchdog, but no any sys_watchdog_notify(wdog_id); the below is my test code
// -----------test code --------------//
static void prvTemplateTask( void *pvParameters )
{
OS_TICK_TIME xNextWakeTime;
static uint32_t test_counter=0;
int8_t wdog_id;
xNextWakeTime = OS_GET_TICK_COUNT();
wdog_id = sys_watchdog_register(false); // only register watchdog without any watchdog notify
for( ;; )
{
.................... skip to paste
}
//----------------------------------------------------------------------//
I added GPIO high/low signal when power on reset, but I only got one time without any repeat signal caused by whatchdog timeout reset.
what should I do to have watchdog reset (like power on reset)?
furthermore, I want to extend the maximum watchdog timeout from 2.6s to 5 sec, is it possible to do that?
thanks for your help
Hi nigelyang,
By default the code will get stack in an endless loop (while(1)) in the the development mode. So you should bypass the default NMI handler with your own one when the watchdog expires. Please, check the follow code snippet.
#include "sys_watchdog.h"
#include "hw_watchdog.h"
void watcdog_cb(unsigned long *exception_args)
{
printf("Exit watchdog\n\r");
}
static void prvTemplateTask( void *pvParameters )
{
int8_t wdog_id __attribute__((unused));
sys_watchdog_init();
wdog_id = sys_watchdog_register(false);
/* Bypass the default NMI handler with your own one! */
hw_watchdog_register_int(watcdog_cb);
printf("Enter watchdog\n\r");
for (;;) {
}
}
Thanks, PM_Dialog
hi dialog
I read the setting, the below section , in system_init() of the DSPS project code. I do not understand what's the purpose of "idle task watch dog" ?
if I enable watchdog without using "idle task watch dog", the system seems not work. thanks for your answer
#if dg_configUSE_WDOG
// Register the Idle task first.
idle_task_wdog_id = sys_watchdog_register(false);
ASSERT_WARNING(idle_task_wdog_id != -1);
sys_watchdog_configure_idle_id(idle_task_wdog_id);
#endif
Hi nigelyang,
If you don’t use the idle task WDOG, you should comment out the sys_watchdog_notify(idle_task_wdog_id) in the vApplicationIdleHook() function. Otherwise, the idle_task_wdog_id will be undefined, the WDOG is going to be notified from an unknown value and a Hardfault will hit. We use this, in order to notify the WDOG from an IDLE task.
Thanks, PM_Dialog
Hi
If you look deeper in watchdog code there are also two things that prevent it to occur
- JTAG probe usage
- #define dg_configIMAGE_SETUP DEVELOPMENT_MODE vs PRODUCTION_MODE
Both debug are managed in the NMI handler of the watchdog and they replace the reset by breakpoints so the debug tools can be used to analyzed the cause of the watchdog (using hardware exception method).