I have Kinetis K66 series MCU, I have configure watchdog as enabled in my code and due to it my board gets reset. I have implemented the refresh mechanism of the watchdog and it is as per the datasheet but still the board gets reset. If I disable watchdog the board works fine so I am sure somehow my watchdog is not working as expected. Can someone give me a psuedo code as what configurations or steps I should make in order to get proper working of watchdog
Hi
UNLOCK_WDOG();
WDOG_TOVALL = (2000/5);
WDOG_TOVALH = 0;
WDOG_STCTRLH = (WDOG_STCTRLH_STNDBYEN | WDOG_STCTRLH_WAITEN | WDOG_STCTRLH_STOPEN | WDOG_STCTRLH_WDOGEN) // watchdog enabled to generate reset on 2s timeout (no further updates allowed)
extern void fnRetriggerWatchdog(void)
{
if ((WDOG_STCTRLH & WDOG_STCTRLH_WDOGEN) != 0) { // if watchdog is enabled
uDisable_Interrupt(); // protect the refresh sequence from interrupts
REFRESH_WDOG();
uEnable_Interrupt();
}
}
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html