I'm working with an MC13234 and recently enabled KBI interrupts to trigger on an active-low external signal. I can successfully trigger the ISR while the processor is in STOP3, but when I look at the stack trace, the calling functions are all messed up. As I step through from the interrupt, the debugger crashes as execution is resumed from nonsensical/illegal addresses.
If I look at memory at where the stack pointer is pointing immediately after entering the interrupt, I can see that the return address I would expect is a few bytes away from the stack pointer, but for some reason the return address being used occupies memory immediately preceding the stack pointer (and this address is shown in the stack trace on the debugger). It seems like the correct return address was pushed onto the stack correctly, but instead of popping a few bytes off and using the correct return address, the memory locations right before the stack pointer is being used (and is garbage).
Any ideas what could be causing this? What could be causing the return in address to be referenced immediately before the stack pointer in this case, but usually it uses the address saved on the stack a few bytes back (and this appears to be how it should work from the datasheet)? Many other interrupts are working properly, including RTC timer, IRQ pin, and radio interrupts. Is there something special about the KBI interrupts I'm missing?
Any help would be greatly appreciated!