-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Winbond 512 mbit and 1 gbit flash chips (IDFGH-7854) #9381
Conversation
Thanks for your contribution. |
You're welcome! I'm eager to get support for these chips in IDF! |
@johnboiles Do you know if this logic for 512M/1Gbit chips is common for other vendors? If this is Winbond-specific logic, then it could be a better option to define a Winbond-specific
|
I don't know! But I doubt it's common, seems like a mistake. I'll move this logic to a Winbond specific method. Good idea |
Having checked the GD25Q512 datasheet, the ID is 0xc84020. So at least it's common between GD and Winbond. |
Is that enough reason to keep this logic in the common method you think? |
Hello, if i may add a suggestion, i would remove magic numbers in favor of defines :) thanks! |
Agree that it's worth killing magic numbers in general. What do you think this should be named? Reading the IDF 4.4.2 release notes I came across #7688 and it's a bit of a mystery to me how they were able to test the 512mbit and 1024mbit Winbond chips without this fix. |
I guess they didn't :) I would take other defines structure. also, |
Winbond W25N01GV is 1Gbit and has AA21 as identifier, so this change won't work for that. EDIT: 0x15 = 16Mbit I guess they didn't count in hex but in decimal... |
@igrr |
Just for information and confirmation, I tried with Winbond W25Q02JVTBIM with 2Mb of capacity. The proposed patch does work! Need just a other modification:
in order to add the ID (from datasheet) 0x7022 and to assign the right capacity of 262144 KB. The result is shown in the attached image. Be careful.....the format takes about 16 minutes. :). Thanks a lot. |
@lorenzopeluso please try #9566 |
Currently the flash detection logic doesn't work for Winbond chips 512 megabit and above. The bitwise math assumption that uses the last byte of the ID seems to work fine for all smaller chips but for some unknown reason there's not a clean increment of that value from 256 megabit (which has a last byte of 0x19) to 512 megabit (which has a last byte of 0x20). Seems possible this was a design mistake on Winbond's part that they now can't undo.
LittleFS has a handy list of Winbond IDs and sizes: https://github.com/PaulStoffregen/LittleFS/blob/d5de4cf8d1587aa8b2433962ea995d45a991b918/src/LittleFS.cpp#L46
This PR adds a special case for known Winbond 512 megabit and 1 gigabit flash chips mentioned in the above list. I've personally tested this against the W25Q512JVEQ chip on an ESP32-S3 and it resolves a bootloader failure that looks like this:
This makes sense, because
1 << 0x20
==4294967296
which, for auint32_t
likesize
would be the same as0
.