2021-05-26 07:24 PM
I try implement a function to detect how the MCU start from, reset from watchdog or hardfault or recycle power.
Watchdog reset, if the code goes to dead loop, it will trigger WD, but I have no good idea how to capture it.
Recycle power, I can use PVD_IRQHandler() interrupt, but I can't find how to configure the PWR_PVD parameter from STMCube .
Hardfault, I can use the HardFault_Hander() interrupt routine, it works for me.
Solved! Go to Solution.
2021-05-26 07:57 PM
> If code goes to dead loop and trigger reset, it will reset RCC->CSR, in this case can RCC->CSR set IWDGRSTF?
If the IWDG causes the reset, then IWDGRSTF will be set upon reset. Check the flags when your program starts and then clear them by setting the the RMVF bit.
2021-05-26 07:27 PM
Read the RCC->CSR register.
2021-05-26 07:53 PM
RCC->CSR is reset by system reset, IWDG is one of the system reset.
If code goes to dead loop and trigger reset, it will reset RCC->CSR, in this case can RCC->CSR set IWDGRSTF?
2021-05-26 07:57 PM
> If code goes to dead loop and trigger reset, it will reset RCC->CSR, in this case can RCC->CSR set IWDGRSTF?
If the IWDG causes the reset, then IWDGRSTF will be set upon reset. Check the flags when your program starts and then clear them by setting the the RMVF bit.