Skip to content

Add 64KB block erase functionality to QSPI#694

Merged
stephenhensley merged 3 commits intoelectro-smith:masterfrom
kidproquo:patch-1
Apr 2, 2026
Merged

Add 64KB block erase functionality to QSPI#694
stephenhensley merged 3 commits intoelectro-smith:masterfrom
kidproquo:patch-1

Conversation

@kidproquo
Copy link
Copy Markdown
Contributor

libDaisy's QSPI erase uses 4KB sector erase commands (0xD7), requiring 256 erase operations for 1MB.

Discovery: We benchmarked the erase operations:

Erase 64KB (16x 4KB sectors): 80,000ms  // Calling EraseSector 16 times
Erase 64KB (bulk Erase):       1,700ms  // Still using 4KB internally
Erase 64KB (64KB block cmd):     115ms  // Using 0xD8 command

The IS25LP080D flash chip supports 64KB block erase (command 0xD8), but libDaisy wasn't using it. This PR adds it.

Some additional context is provided in this blog post: https://scopecreeplabs.com/blog/stm32-esp32-ota/

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

Test Results

167 tests  +17   167 ✅ +17   0s ⏱️ ±0s
  1 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 0323160. ± Comparison against base commit 9498417.

♻️ This comment has been updated with latest results.

@stephenhensley
Copy link
Copy Markdown
Collaborator

Awesome! I finally had a chance to test this out a bit. Seems to work great, and is a huge improvement over the 4kB only erases.

I made a new test program that I'll add to the examples after merging that does a few tests and reports the durations.
I ran that program before checking out your branch, and after and my results aligned pretty closely with yours.

The full results of the program once checking out your branch were:

Beginning Erasure Timing Tests...
Test 1: Erase, Write and Validate a single 4kB sector.
        starting...
        Erase Time: 87ms
        Write Time: 27ms
        Validated Write: Pass
        finished.
Test 2: Erase, Write, and Validate a single 64kB block
        starting...
        Erase Time: 129ms
        Write Time: 67ms
        Validated Write: Pass
        finished.
Test 3: Erase 256kB in one call (internally 4x 64kB erases)
        Total Erase Time: 456ms
4: Erase 256kB in 4x 64kB blocks/fn calls
        0: 123ms        1: 120ms        2: 128ms        3: 123ms
        Total Erase Time: 494ms
        finished.
5: Erase 256kB in 64x 4kB blocks/fn calls
        0: 74ms 1: 78ms 2: 84ms 3: 81ms
        4: 82ms 5: 87ms 6: 77ms 7: 78ms
        8: 83ms 9: 76ms 10: 81ms        11: 91ms
        12: 83ms        13: 81ms        14: 81ms        15: 75ms
        16: 96ms        17: 85ms        18: 86ms        19: 80ms
        20: 83ms        21: 78ms        22: 77ms        23: 86ms
        24: 81ms        25: 90ms        26: 79ms        27: 81ms
        28: 78ms        29: 84ms        30: 75ms        31: 77ms
        32: 93ms        33: 85ms        34: 92ms        35: 87ms
        36: 83ms        37: 80ms        38: 89ms        39: 86ms
        40: 91ms        41: 85ms        42: 85ms        43: 83ms
        44: 83ms        45: 91ms        46: 92ms        47: 91ms
        48: 87ms        49: 96ms        50: 83ms        51: 82ms
        52: 82ms        53: 79ms        54: 88ms        55: 82ms
        56: 88ms        57: 85ms        58: 91ms        59: 88ms
        60: 84ms        61: 92ms        62: 86ms        63: 84ms
        Total Erase Time: 5381ms
        finished.
Done.

I hope you don't mind, I pushed a commit to resolve that last bit of styling errors to save you from having to go back and forth with clang-format to get this merged.

Thanks for the contribution, @kidproquo !

@stephenhensley stephenhensley merged commit e667533 into electro-smith:master Apr 2, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants