This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 733fe888ea435bc0a64f3c361902ab7ac4004baf
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Mon Jun 10 13:04:46 2024 +0200

    mcu/stm32f7: Fix reset reason
    
    POR was not correctly reported.
    POR and BOR moved up.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/mcu/stm/stm32f7xx/src/hal_reset_cause.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/hw/mcu/stm/stm32f7xx/src/hal_reset_cause.c 
b/hw/mcu/stm/stm32f7xx/src/hal_reset_cause.c
index 19cbccc41..04014c5f8 100644
--- a/hw/mcu/stm/stm32f7xx/src/hal_reset_cause.c
+++ b/hw/mcu/stm/stm32f7xx/src/hal_reset_cause.c
@@ -31,16 +31,18 @@ hal_reset_cause(void)
     }
 
     reg = RCC->CSR;
-    if (reg & RCC_CSR_WWDGRSTF || reg & RCC_CSR_IWDGRSTF) {
+    if (reg & RCC_CSR_PORRSTF) {
+        reason = HAL_RESET_POR;
+    } else if (reg & RCC_CSR_BORRSTF) {
+        reason = HAL_RESET_BROWNOUT;
+    } else if (reg & RCC_CSR_WWDGRSTF || reg & RCC_CSR_IWDGRSTF) {
         reason = HAL_RESET_WATCHDOG;
     } else if (reg & RCC_CSR_SFTRSTF) {
         reason = HAL_RESET_SOFT;
     } else if (reg & RCC_CSR_PINRSTF) {
         reason = HAL_RESET_PIN;
-    } else if (reg & RCC_CSR_BORRSTF) {
-        reason = HAL_RESET_BROWNOUT;
     } else {
-        reason = HAL_RESET_POR;
+        reason = HAL_RESET_OTHER;
     }
     RCC->CSR |= RCC_CSR_RMVF;
     return reason;

Reply via email to