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.
My microcontroller sometimes resets. To chase down this problem, I want to configure the watchdog so that it interrupts, then, inside the wake interrupt, read the value of the return program counter, write it to EEPROM, then reset. Assuming this can work, my biggest obstacle is how to access the RPC register -- i.e., read its value into a C symbol. Can someone describe the procedure for doing this in assembly?
Hello Peter,
Referring to the C28x Instruction Set, you can only access the RPC by pushing/popping it from the stack. What you could do is push it to the stack and then pop it into a register to view it, but this would need to be done in assembly.
See this thread: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/693819/ccs-tms320f280049-how-to-read-rpc
Best regards,
Omer Amir
The indicated thread is unfortunately not helpful. I need to know the function that called the wake ISR, not the function that called the assembly function. I agree that pushing and popping are required, but I don't myself know how to get the RPC into a C symbol.
The indicated thread is unfortunately not helpful. I need to know the function that called the wake ISR, not the function that called the assembly function. I agree that pushing and popping are required, but I don't myself know how to get the RPC into a C symbol. Perhaps a more targeted question would be: How do I move the ACC into C symbol?
Hello Peter,
How do I move the ACC into C symbol?
You can refer to the C28x Instruction Set I linked in my initial post. All assembly instructions are described there. For your question, if you have the address of the symbol then you can use the MOVL instruction (or MOV instruction if you're only saving the lower word of the ACC register):
Best regards,
Omer Amir
Here is something that appears to work. Perhaps it will be helpful to others.
uint32 rpc = 0uL;
interrupt void WatchDog_IntHandler(void) {
asm(" ASP");
asm(" PUSH DP");
asm(" PUSH DP");
asm(" PUSH RPC");
asm(" POP ACC");
asm(" MOVW DP, #_rpc");
asm(" MOVL @_rpc, ACC");
asm(" POP DP");
asm(" POP DP");
asm(" NASP");