This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Watchdog Trip/Capture Stack

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.

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

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

Children