Skip to content

Commit bd7ef99

Browse files
committed
STM32H7: Reset Reason update
1 parent 769b9a3 commit bd7ef99

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

targets/TARGET_STM/reset_reason.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,36 @@ reset_reason_t hal_reset_reason_get(void)
2727
}
2828
#endif
2929

30+
#ifdef RCC_FLAG_LPWR1RST
31+
if ((__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR1RST))||(__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR2RST))) {
32+
return RESET_REASON_WAKE_LOW_POWER;
33+
}
34+
#endif
35+
3036
#ifdef RCC_FLAG_WWDGRST
3137
if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST)) {
3238
return RESET_REASON_WATCHDOG;
3339
}
3440
#endif
3541

42+
#ifdef RCC_FLAG_WWDG1RST
43+
if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDG1RST)) {
44+
return RESET_REASON_WATCHDOG;
45+
}
46+
#endif
47+
3648
#ifdef RCC_FLAG_IWDGRST
3749
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST)) {
3850
return RESET_REASON_WATCHDOG;
3951
}
4052
#endif
4153

54+
#ifdef RCC_FLAG_IWDG1RST
55+
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDG1RST)) {
56+
return RESET_REASON_WATCHDOG;
57+
}
58+
#endif
59+
4260
#ifdef RCC_FLAG_SFTRST
4361
if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST)) {
4462
return RESET_REASON_SOFTWARE;
@@ -69,7 +87,11 @@ reset_reason_t hal_reset_reason_get(void)
6987

7088
uint32_t hal_reset_reason_get_raw(void)
7189
{
90+
#if TARGET_STM32H7
91+
return RCC->RSR;
92+
#else /* TARGET_STM32H7 */
7293
return RCC->CSR;
94+
#endif /* TARGET_STM32H7 */
7395
}
7496

7597

0 commit comments

Comments
 (0)