diff options
author | Damien George <damien.p.george@gmail.com> | 2016-09-27 15:49:35 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-09-27 15:49:35 +1000 |
commit | 88ca7ff5657aa6328f394a099cf52a76707ae943 (patch) | |
tree | e9a150f69217e1bf01ff801d2fe3c0643cce05bd | |
parent | 7385b018edaca5c8cbbd1b2d8a6a10a63d93150d (diff) | |
download | micropython-88ca7ff5657aa6328f394a099cf52a76707ae943.tar.gz micropython-88ca7ff5657aa6328f394a099cf52a76707ae943.zip |
stmhal/modmachine: Fix clearing of reset-cause flags.
To reset the flags we should write to the single bit only, not the entire
register (otherwise all other settings in the register are cleared).
Fixes #2457.
-rw-r--r-- | stmhal/modmachine.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stmhal/modmachine.c b/stmhal/modmachine.c index c5f33146f7..cc5ae3499b 100644 --- a/stmhal/modmachine.c +++ b/stmhal/modmachine.c @@ -68,7 +68,7 @@ void machine_init(void) { if (PWR->CSR & PWR_CSR_SBF) { // came out of standby reset_cause = PYB_RESET_DEEPSLEEP; - PWR->CR = PWR_CR_CSBF; + PWR->CR |= PWR_CR_CSBF; } else #endif { @@ -86,7 +86,7 @@ void machine_init(void) { } } // clear RCC reset flags - RCC->CSR = RCC_CSR_RMVF; + RCC->CSR |= RCC_CSR_RMVF; } // machine.info([dump_alloc_table]) |