Skip to content

Enabling 4kb sector erase and smaller erasable filesizes on winbond chips#67

Open
matthewcieplak wants to merge 2 commits intoPaulStoffregen:masterfrom
matthewcieplak:master
Open

Enabling 4kb sector erase and smaller erasable filesizes on winbond chips#67
matthewcieplak wants to merge 2 commits intoPaulStoffregen:masterfrom
matthewcieplak:master

Conversation

@matthewcieplak
Copy link

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.

delayMicroseconds(1);
CSASSERT();
if (f & FLAG_32BIT_ADDR) {
SPIPORT.transfer(0x20);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the new special command from the winbond datasheet

@matthewcieplak matthewcieplak changed the title Enabling 4kb sector erase and smaller erasable filesizes on windbond chips Enabling 4kb sector erase and smaller erasable filesizes on winbond chips Mar 14, 2020
@FrankBoesing
Copy link
Contributor

FrankBoesing commented Mar 15, 2020

Not wanted: #3

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