From 8f3f60f45634549579f8de26a1dbc3c2f4977e44 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 16 Aug 2021 18:02:30 +0200 Subject: [PATCH] Fix failing flash verification on erase --- CHANGELOG.md | 1 + src/flash.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 202542e1..255b99c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix i2c interactions after errors - Fix SPI3 alternate function remapping - Do not enable UART DMA flags unconditionally +- Fix flash erase verification always failing ### Changed diff --git a/src/flash.rs b/src/flash.rs index 6c31d33a..6a9e1926 100644 --- a/src/flash.rs +++ b/src/flash.rs @@ -170,7 +170,7 @@ impl<'a> FlashWriter<'a> { // 'start_offset' was. let size = self.sector_sz.kbytes() as u32; let start = start_offset & !(size - 1); - for idx in start..start + size { + for idx in (start..start + size).step_by(2) { let write_address = (FLASH_START + idx as u32) as *const u16; let verify: u16 = unsafe { core::ptr::read_volatile(write_address) }; if verify != 0xFFFF {