How to detect STM32F417 MCU reset source
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-26 7: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.
- Labels:
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-26 7: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-26 7:27 PM
Read the RCC->CSR register.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-26 7: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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-26 7: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.
