Merge pull request #2539 from badrbouslikhin/stm32h7-flash-improvements

fix(stm32h7/flash): enhance resilience to program sequence errors (pgserr)
This commit is contained in:
Dario Nieuwenhuis 2024-02-06 15:58:50 +00:00 committed by GitHub
commit 2c5426aa5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -77,12 +77,12 @@ pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE])
}
}
bank.cr().write(|w| w.set_pg(false));
cortex_m::asm::isb();
cortex_m::asm::dsb();
fence(Ordering::SeqCst);
bank.cr().write(|w| w.set_pg(false));
res.unwrap()
}
@ -100,6 +100,10 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E
w.set_start(true);
});
cortex_m::asm::isb();
cortex_m::asm::dsb();
fence(Ordering::SeqCst);
let ret: Result<(), Error> = blocking_wait_ready(bank);
bank.cr().modify(|w| w.set_ser(false));
bank_clear_all_err(bank);