From 9f2fc04caa2da6a6739e8dfd0dbef96bc10cc56a Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 24 Sep 2023 18:37:09 -0500 Subject: [PATCH] stm32: fix bd lsi --- embassy-stm32/src/rcc/bd.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/embassy-stm32/src/rcc/bd.rs b/embassy-stm32/src/rcc/bd.rs index 4915d5e2a..5bae3edd9 100644 --- a/embassy-stm32/src/rcc/bd.rs +++ b/embassy-stm32/src/rcc/bd.rs @@ -100,13 +100,14 @@ impl BackupDomain { #[cfg(not(rtc_v3u5))] let csr = crate::pac::RCC.csr(); - Self::modify(|_| { - #[cfg(not(any(rcc_wb, rcc_wba)))] - csr.modify(|w| w.set_lsion(true)); + // Disable backup domain write protection + Self::modify(|_| {}); - #[cfg(any(rcc_wb, rcc_wba))] - csr.modify(|w| w.set_lsi1on(true)); - }); + #[cfg(not(any(rcc_wb, rcc_wba)))] + csr.modify(|w| w.set_lsion(true)); + + #[cfg(any(rcc_wb, rcc_wba))] + csr.modify(|w| w.set_lsi1on(true)); #[cfg(not(any(rcc_wb, rcc_wba)))] while !csr.read().lsirdy() {}