I try to simulate system hang by adding while(1) after calling watch dog feeding function. But watchdog event handler _wdtEventHandler() isn't called.
int main(void) {
...
wdtInit();
for (;;) {
wdtFeed();
while(1);
}
I try to simulate system hang by adding while(1) after calling watch dog feeding function. But watchdog event handler _wdtEventHandler() isn't called.
int main(void) {
...
wdtInit();
for (;;) {
wdtFeed();
while(1);
}
Watch dog event handler is working now. But soft reset can't trigger to run main() again.
How do you determine that the program is not reaching main() after the reset? Are you sure it's not just that some log messages are being lost?
Also, _wdtReboot(); could have been replaced with a while(1) as the WD will trigger a reset after the timeout event.
I have added turning on LED in main(). But LED isn't turning on after soft reset.
It doesn't make sense why the program would not reach main following a reset. Can you place a breakpoint in main and see if it is reached after the reset, and if not, halt the CPU and see where the program actually hangs?