Re: Jtag Ice MKII
2009-04-08 by Dave VanHorn
Even more fun.. I decided to trap this condition at boot, and force the WDT off in code. I'm uploading a file, MADWDT.PNG that shows a screen cap. At the first breakpoint, I'd run the code, and let it reset on it's own. The contents of Temp (R24) at that point was 0x00, which says that the chip has no idea why it got reset! AFAIk that shouldn't even be possible. At the second breakpoint, you can see that I've set up the WDT in a fairly normal fashion. Disabled, slowest clock, and interrupt enabled rather than reset. But on the right, the clock prescaler does not match what I programmed, the WDT is enabled, (though it DID take the WDIE). In ASM, I would have done it slightly differently, loading up the values first, then setting WDCE, and loading the values in the next instruction, but this is close enough since I have four cycles to get there. In simulation, this WDT code works fine. If I step this through with the ICE, I can see it load up the values and attempt to set the WDT, but it isn't happening. If I let it run, it will not hit the breakpoint I have on the WDT interrupt vector, it just ends up back at the initial breakpoint with 0 in MCUSR again. Again, the only reason I'm doing any of this at this point, is that somehow the WDT is always enabled, despite my erasing the chip, explicitly setting the "always on" fuse to off, and not enabling the WDT in code till after all other inits, just before main.