Enabling 4kb sector erase and smaller erasable filesizes on winbond chips#67
Open
matthewcieplak wants to merge 2 commits intoPaulStoffregen:masterfrom
Open
Enabling 4kb sector erase and smaller erasable filesizes on winbond chips#67matthewcieplak wants to merge 2 commits intoPaulStoffregen:masterfrom
matthewcieplak wants to merge 2 commits intoPaulStoffregen:masterfrom
Conversation
matthewcieplak
commented
Mar 14, 2020
| delayMicroseconds(1); | ||
| CSASSERT(); | ||
| if (f & FLAG_32BIT_ADDR) { | ||
| SPIPORT.transfer(0x20); |
Author
There was a problem hiding this comment.
Here is the new special command from the winbond datasheet
Contributor
|
Not wanted: #3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This feature takes advantage of winbond's 4kb sector-erase feature to enable smaller erasable filesizes.
I noticed that I couldn't save more than 16 erasable files to my winbond w25q80, and did some investigating into this library's size allocation. I discovered that it assumes all chips use 256kb erase blocks, so I added a feature detection flag for winbond chips and auto-sizing function for erasable files smaller than 256kb. (Right now this auto-size feature uses powers of two but could potentially work in 4kb blocks instead.)
This is tested in hardware on the w25q80 and seems to work fine! So far as I can tell from reading datasheets all winbond serial flash uses 4kb erase sectors, but I am not super-familiar with their product lines so would appreciate a double-check.
The erase function looks quite different but is substantially the same, and should accommodate alternate erase sector sizes if other manufacturers use them.