2021-01-17 08:34 PM
I am working on STM32H7 (Cortex-M7) and using IWDG for monitoring. I am wondering if there is a way to record Cortex-M7 CPU registers (General Purpose (Rx), SP, LR and PC) when IWDG runs out. Either before or after the reset.
I understand the RCC register can provide a flag indicating source of the reset, but is there a way to get CPU registers value when the reset occurred?
2021-01-17 08:45 PM
There's not a way to do this with IWDG. I mean, you can read the registers after reset, but they won't have the same information in them.
The WWDG has an early wakeup interrupt you can enable which will get called prior to reset. The WWDG can be used instead of the IWDG in most scenarios.
Edit: Those registers (most, at least) are going to get trashed when the early wakeup interrupt is called as well, so nevermind.