cancel
Showing results for 
Search instead for 
Did you mean: 

IWDG vs. WWDG

matic
Associate III
Posted on January 02, 2016 at 23:18

Hi.

What is the main reason to use one watchdog instead of the other? I understand that IWDG is clocked by its own LSI clock, while WWDG clock is prescaled from the APB1 clock. But what are the other differences?
2 REPLIES 2
jpeacock
Associate III
Posted on January 03, 2016 at 15:04

The IWDG is a simple reset from somewhere in your program.  The problem with this type of reset is what happens if the code that resets the IWDG is in the infinite loop that's crashed the code?  The CPU never resets even though it isn't working.

The WWDG sets up a window with a minimum and maximum time between WWDG reset pulses.  Clear the WWDG too soon (i.e. inside a loop as above) and it will force a reset.  Same if the WWDG pulse is too late, resets the same as if the IWDG timed out.

Both watchdogs are useful.  I use the IWDG to make sure the RTC interrupt is running, clearing IWDG at the one second interrupt.  The WWDG reset is in a system monitor task that also handles power and temperature failures.  The monitor task is the highest priority, so if SysTick (the FreeRTOS timebase) stops or is at the wrong frequency the WWDG won't reset within the window.

A second use of the WWDG is the early warning interrupt, shortly before the WWDG times out.  The service routine can save relevant state information in non-volatile SRAM so some clue as to the cause can be used for troubleshooting.

The two watchdogs are cleared independently so I have some assurance one will fail if the other is trapped in a loop.

  Jack Peacock

matic
Associate III
Posted on January 04, 2016 at 06:29

Thanks.

As I read in RM now, also IWDG has that ''window'' feature. The main difference is that it is clocked by LSI and it does not have EWI (Early Wake-up Interrupt) feature.