Re: How to obtain and save the return address inside an interrupt?
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.discuss |
|---|---|
| Message-ID | <[email protected]> |
The simplest way is to make sure that you are using the watchdog in watchdog mode, not timer mode, then use the RESET_VECTOR to trap the interrupt. This might be complicated in C, since it involves trapping the _startup routine at the RESET_VECTOR. By the time this routine has executed and control is passed to your program the data in the stack, SP and WDTIFG is no longer valid. Perhaps the best way might be to configure a breakpoint to trigger when the RESET_VECTOR is accessed. You can then examine the stack, check the value of SP and check the IFG1 register to see if the reset was triggered by the WDT. Al On 18/01/2015 10:42 PM, [email protected] [msp430] wrote: > > > I am using MSP430F2618 and the IAR Workbench (version 6.20). > > > From time to time I get a watchdog reset. I think I can use the > watchdog as a timer, then have an interrupt when it times out. Inside > the interrupt I would like to find the return address and maybe even > save it in flash. If I could do this, I could find out where the > problem is. > > > Would you have suggestions as to how to find out the return address? I > know I have to look at the Stack Pointer and may be at some registers > to have the full 20 bit return address. But I do not know what exactly > I need to look for. ( Unfortunately, I do not know how to program in > assembly.) > > > Thank you for your suggestions. > > > >