We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am looking for help in capturing and analyzing a C161 stack upon a watchdog trip. Since the watchdog trip resets the processor, I have been assuming I need to use assembly in my startup file which copies the stack to my desired location prior to initialization. Can anyone confirm this and does anyone have any samples of doing this? Also, does anyone know if I am able to determine what the stack pointer was when the watchdog trip occurred? Thanks.
As long as your watchdog is set to bite the reset pin if not petted regularly, there's almost certainly no way you'll be able to retrieve the state of the stack pointer. If that's what you want to do, you'll have re-target the watchdog to bite a regular interrupt pin instead, and issue a reset from the handler of that interrupt, after having saved the stack pointer in some place where it'll survive the reset. Generally I have some doubt what you're doing here makes any sense. The goal should be to avoid the watchdog ever biting in the first place, not to find something clever to do if id does.
I agree - I do not want the watchdog to trip. I am trying to find a clever way to determine why it is tripping.
An ICE or the simulator could be much better way of analysing that.