No reset while using watch dog

⚠️
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.
5 posts / 0 new
Last post
nigelyang
Offline
Last seen:2 months 1 week ago
Joined:2018-03-20 08:24
No reset while using watch dog

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

Device:
PM_Dialog
Offline
Last seen:52 min 53 sec ago
Staff
Joined:2018-02-08 11:03
Hi nigelyang,

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

nigelyang
Offline
Last seen:2 months 1 week ago
Joined:2018-03-20 08:24
hi 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

PM_Dialog
Offline
Last seen:52 min 53 sec ago
Staff
Joined:2018-02-08 11:03
Hi nigelyang,

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

bobspam@free.fr
Offline
Last seen:1 month 4 weeks ago
Joined:2018-06-20 08:07
Hi

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).