This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377D: need to locate address where code was executing before watchdog fired...

Part Number: TMS320F28377D


i have configured watchdog in interrupt mode so that it generates interrupt after watchdog overflows. Then I do NV backup of debugging information and set watchdog in reset mode from ISR itself. This results in watchdog reset after executing of ISR is completed.

I'm using C28x (TMS320F28377D) controller. As per reference manual, return address is stored on XAR7/RPC/stack. Please help me to retrieve the return address when I'm in watchdog ISR.

  • Aashutosh,

    I think the only reliable way of doing this is to write an assembly ISR to grab the return address from the stack.  The attached example file shows how to load the accumulator with the interrupt return address from within the ISR by aligning the stack pointer, then using stack pointer relative addressing to extract the last 32-bit value.  You could then call any other functions you need from the ISR.

    Regards,

    Richard

    demo2806x_asmisr.asm

  • Hello Richard,
    Thanks for sharing the solution. I will try to implement that and see how it works in my case where there is no segregation of system and user stack. What I observed during testing is that the return address is pushed on the stack but it's location is not deterministic and it changes based on whatever else is pushed onto stack.

    So,in my case..On wdt interrupt I'm pushing RPC onto stack along with tasks alive flags. After storing RPC value..I pop it from stack..RPC registerv gives me the return address of last called function n I can find function name using map file.