armink / SFUD

An using JEDEC's SFDP standard serial (SPI) flash universal driver library | 一款使用 JEDEC SFDP 标准的串行 (SPI) Flash 通用驱动库
MIT License
1.25k stars 444 forks source link

Erase granularity not set correctly on non-uniform flash #55

Open davidk88 opened 2 years ago

davidk88 commented 2 years ago

Hello,

I'm using S25FL127S which does not support uniform 4k erase.

Library correctly reports via SFDP that flash chip does not supports uniform 4k erase, but it sets erase_gran and erase_gran_cmd to 4k erase anyway.

I modified library in such way that if sfdp.4k_erase is 0 then erase_gran and erase_gran_cmd is set to first eraser size which is larger than 4k, but I'm not sure if this is the correct way. I also dif not find any flags in SFDP that would tell which erase size is uniform for whole device.

Best regards

armink commented 2 years ago

Yes, when an unsupported erase size is found, and the erase size can be enlarged. You can submit your changes by PR.