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  <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.
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.