2018-07-30 09:02 AM
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:
thanks for your help
roseanne
Solved! Go to Solution.
2018-07-30 11:01 AM
You did not care to tell us your mcu model, but if it has a WWDG you can use that instead of IWDG (with the respective changes of course); WWDG does have an Early Warning Interrupt.
Another approach is to replace the watchdog by a timer, for debugging purposes.
JW
2018-07-30 09:13 AM
You'd need to provide instrumentation/telemetry to understand the flow of your code and why it didn't kick the watchdog. You can either output, or record, checkpoint information, and process that post reset.
You should be able to pull the reset cause (ie watchdog, standby) but not the what/where of your code.
2018-07-30 11:01 AM
You did not care to tell us your mcu model, but if it has a WWDG you can use that instead of IWDG (with the respective changes of course); WWDG does have an Early Warning Interrupt.
Another approach is to replace the watchdog by a timer, for debugging purposes.
JW
2018-07-31 11:44 AM
thanks for your answers!
I may try to need use timer or IWDG
thanks
roseanne