diff --git a/targets/TARGET_STM/reset_reason.c b/targets/TARGET_STM/reset_reason.c index 6772c34ebc..b73d1f1869 100644 --- a/targets/TARGET_STM/reset_reason.c +++ b/targets/TARGET_STM/reset_reason.c @@ -27,18 +27,36 @@ reset_reason_t hal_reset_reason_get(void) } #endif +#ifdef RCC_FLAG_LPWR1RST + if ((__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR1RST))||(__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR2RST))) { + return RESET_REASON_WAKE_LOW_POWER; + } +#endif + #ifdef RCC_FLAG_WWDGRST if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST)) { return RESET_REASON_WATCHDOG; } #endif +#ifdef RCC_FLAG_WWDG1RST + if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDG1RST)) { + return RESET_REASON_WATCHDOG; + } +#endif + #ifdef RCC_FLAG_IWDGRST if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST)) { return RESET_REASON_WATCHDOG; } #endif +#ifdef RCC_FLAG_IWDG1RST + if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDG1RST)) { + return RESET_REASON_WATCHDOG; + } +#endif + #ifdef RCC_FLAG_SFTRST if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST)) { return RESET_REASON_SOFTWARE; @@ -69,7 +87,11 @@ reset_reason_t hal_reset_reason_get(void) uint32_t hal_reset_reason_get_raw(void) { +#if TARGET_STM32H7 + return RCC->RSR; +#else /* TARGET_STM32H7 */ return RCC->CSR; +#endif /* TARGET_STM32H7 */ }