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
The following commit(s) were added to refs/heads/master by this push:
new 6b81c5844 stm32/hal_reset: Fix reported reset reason
6b81c5844 is described below
commit 6b81c58446a3f8a92553dd08d81c4fce10e6f29c
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sat May 18 16:47:02 2024 +0200
stm32/hal_reset: Fix reported reset reason
Often when device is powered up Reset pin is also activated.
This cause power on never to be reported in favor of reset pin.
Now Power On has highest priority.
Independent watchdog that is actually used in mynewt was not
reported at all as reset reason. Only Windowed watchdog would
be reported but is not used in mynwet-core.
This adds flag check so Watchdog reset can be detected.
---
hw/mcu/stm/stm32l0xx/src/hal_reset_cause.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/mcu/stm/stm32l0xx/src/hal_reset_cause.c
b/hw/mcu/stm/stm32l0xx/src/hal_reset_cause.c
index b9d3074cb..c13930a6c 100644
--- a/hw/mcu/stm/stm32l0xx/src/hal_reset_cause.c
+++ b/hw/mcu/stm/stm32l0xx/src/hal_reset_cause.c
@@ -32,7 +32,9 @@ hal_reset_cause(void)
reg = RCC->CSR;
- if (reg & RCC_CSR_WWDGRSTF) {
+ if (reg & RCC_CSR_PORRSTF) {
+ reason = HAL_RESET_POR;
+ } else if (reg & (RCC_CSR_WWDGRSTF | RCC_CSR_IWDGRSTF)) {
reason = HAL_RESET_WATCHDOG;
} else if (reg & RCC_CSR_SFTRSTF) {
reason = HAL_RESET_SOFT;