Skip to content

Commit 10a06a6

Browse files
author
Johannes Draaijer
committed
Fix flash write error, according to errata
1 parent f9b24f4 commit 10a06a6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/flash.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ impl<'a> FlashWriter<'a> {
146146
// Start Operation
147147
self.flash.cr.cr().modify(|_, w| w.strt().set_bit());
148148

149+
// Wait for at least one clock cycle before reading the
150+
// BSY bit, because there is a one-cycle delay between
151+
// setting the STRT bit and the BSY bit being asserted
152+
// by hardware. See STM32F105xx, STM32F107xx device errata,
153+
// section 2.2.8
154+
cortex_m::asm::nop();
155+
149156
// Wait for operation to finish
150157
while self.flash.sr.sr().read().bsy().bit_is_set() {}
151158

0 commit comments

Comments
 (0)