Skip to content

Commit 82806e1

Browse files
bors[bot]Windfisch
andauthored
Merge #362
362: Fix failing flash verification on erase r=burrbull a=Windfisch When erasing a 2kb flash page, flash erase verification wanted all `u16`s with addresses starting from 0 to 2047 to be `0xFFFF`. This includes the u16 located from 2047 to 2048 (inclusive), which contains the last byte of the to-be-erased page and the first byte of the next page. Surely, this u16 cannot reasonably be expected to be 0xFFFF after the erase. Stepping over even addresses only solves this issue. Co-authored-by: Florian Jung <flo@windfis.ch>
2 parents 75d41d3 + 8f3f60f commit 82806e1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3838
- Fix i2c interactions after errors
3939
- Fix SPI3 alternate function remapping
4040
- Do not enable UART DMA flags unconditionally
41+
- Fix flash erase verification always failing
4142

4243
### Changed
4344

src/flash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'a> FlashWriter<'a> {
170170
// 'start_offset' was.
171171
let size = self.sector_sz.kbytes() as u32;
172172
let start = start_offset & !(size - 1);
173-
for idx in start..start + size {
173+
for idx in (start..start + size).step_by(2) {
174174
let write_address = (FLASH_START + idx as u32) as *const u16;
175175
let verify: u16 = unsafe { core::ptr::read_volatile(write_address) };
176176
if verify != 0xFFFF {

0 commit comments

Comments
 (0)