AnsweredAssumed Answered

Watchdog kicks in for 22F

Question asked by Cecylia Wati on Jul 22, 2015
Latest reply on Jul 22, 2015 by Cecylia Wati

Hi there,

 

I've got a working code running happily on Freedom eval stack.  Now the production board comes in, and the same software doesn't run anymore.
The only difference in the board is Eval board has 512 memory and the production is using 256 (MK22FN256xxx12).

I've made changes to the include paths/ files etc to use 256 instead of 512

 

I could trace the code and blinks some LEDs, however, then the watchdog kicks in.

I got stopped at Watchdog_IRQHandler.

 

Thread [1] <main> (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
Watchdog_IRQHandler() at startup_MK22F25612.S:356 0x518
<signal handler called>() at 0xfffffff9
hardware_init() at hardware_init.c:37 0x9a7c
main() at main.c:478 0xa2f2

 

 

 

I notice that we do go through the SystemInit (in system_MK22F25612.c) and the disabling of the watchdog.  But for most of my experiment, I did not stop there to make sure that I don't interfere with the startup timing within which we have to disable the watchdog.

 

So, how do I:
1. know that WDOG is already disabled?
In main, I could see watchdog registers as follows.  It seems like WDOG is already disabled in CTRLH.

0x1d2           CTRLH

0x1           CTRLL

0x4c           TOVALH

0x4b4c      TOVALL

0x0      WINH

0x10      WINL

0xb480      REFRESH

0xd928      UNLOCK

0x0      TMROUTH

0x0      TMROUTL

0x0      RSTCNT

0x400      PRESC

 

2. Is it possible that in this production board I don't get to SystemInit fast enough, ie failed to disable the watchdog after time has expired?
Is there a way to check how many bus cycles have passed before I reach it?
Or, this doesn't make sense? I didn't really change the code coming from Freescale.

 

Any help/insights in very appreciated.

 


Oh another thing is, I was going to check if EWM is enabled by accident.  But we're not interested in enabling any watchdog so I doubt there'd be any "accident" like that.  But when I try to read that register, guess what, watchdog kicks in.  Here was how I tried to read it.  But even in eval board this happens, so I guess I'm not supposed to touch it anyways.

 

        tmp[0]= EWM_CTRL;

        tmp[1]= EWM_SERV;

        tmp[2]= EWM_CMPL;

        tmp[3]= EWM_CMPH;

        tmp[4]= EWM_CLKPRESCALER;

 

 

Thanks,

Cecylia

Outcomes