fix(stm32h7/flash): enhance resilience to program sequence errors (pgserr)
This commit is contained in:
parent
ad7d4494fa
commit
aab5da1d3b
1 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue