how to find the reason when watchdog reset happens
Dear Sir/Madam:
I have a problem and would need your help.
when I write a watchdog like the following:
void init()
{
..
SystemClock_Config();
/*######## Configure watchdog timer ############################*/
// Watchdog clock is LSI, runs at 32kHz. The below settings give
// a max watchdog period of 4 sec before reset.
WDHandle.Instance = IWDG;
WDHandle.Init.Prescaler = IWDG_PRESCALER_256;
WDHandle.Init.Reload = 511;
HAL_IWDG_Init(&WDHandle);
HAL_IWDG_Start(&WDHandle);
}
in the main loop function
int main()
{
...
while(1)
{
HAL_IWDG_Refresh(&WDHandle);
func1();
func2();
....
}// while
}
sometimes, whatdog reset happen, I do not know which func cause the watchdog problem.
my question is:
- whether am I correct for the usage of watchdog?
- how could I find which one cause watchdog reset?
- is there any watchdog interrupt, once the watchdog reset, this interrupt routine give/print some cause before the system reset?
thanks for your help
roseanne
