2016-09-20 02:20 AM
Hi all.
I am trying to catch the last PC value before WD reset. For doing that I am configuring the WWDG and enabling its interrupt. then, while the WD interrupt fire I am writing the important information (i.e., the PC value before the the exception occurs), in dedicated location, and then the reset occurs. I was thinking that the LR register will do for me the job but it seems useless (something like 0xFFFFFFE1). So I changed my mind back to the old and good - the stack and SP register. Indeed, I managed to find the last value of PC at address SP + 0x20 1. Is there more convenient way to do that? 2. Does the offset of 0x20 will be consistent? Thank you very much Yonatan Sade #!stm32f4 #iwdg #wwdg #watchdog2016-09-20 07:19 AM
The SRAM is preserved, but I don't think there is any behaviour about a RESET here that is defined to carry through. You could track most recent PC seen in say a SysTick, and revisit that to see if it is a loop that the code is stuck in. You could also instrument your code to understand the flow that's causing the watchdog to fire.