I'm using HCS08 and Freescale Beekit and meet a problem when I try to use NvData and WatchDog at the same time.
The timeout period of watchdog is 2^18 cycles of BUSCLK (16MHz), which is about 16.4 ms. I think that is the longest timeout period I can set. I use a timer interrupt to kick dog periodically.
NvData provides an interface to save data into Flash memory safely. However, every time program runs at NvHalErasePage(), just after pfNvHalExecuteFlashCmd(), system is reset because of watchdog timeout.
I guess one explanation could be: NvHalErasePage function takes period longer than 16.4ms, so kick dog routing must be called during NvHalErasePage. But erase page halts Flash memory and stops kick dog routing executing. The watchdog resets system eventually.
I'm thinking there may be something I can do to figure it out. But I haven't tried yet. Is there any one has solution, suggestion, or same problem to share?