Support for the Microchip SST25VF040B flash.

Programming is slow, only one byte at a time :-(
This commit is contained in:
Stephan Ruloff
2022-03-25 21:15:09 +01:00
parent f8da6717ce
commit 8c4b1b3afd
2 changed files with 20 additions and 0 deletions
+7
View File
@@ -311,6 +311,10 @@ int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
if ((status & 0x1c) != 0)
must_relock = true;
}
if ((_jedec_id >> 8) == 0xbf258d) {
if ((status & 0x1c) != 0)
must_relock = true;
}
/* if it's needs to unlock */
if (must_relock) {
@@ -334,6 +338,9 @@ int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
int size = 0;
for (int addr = 0; addr < len; addr += size, ptr+=size) {
size = (addr + 256 > len)?(len-addr) : 256;
if ((_jedec_id >> 8) == 0xbf258d) {
size = 1;
}
if (write_page(base_addr + addr, ptr, size) == -1)
return -1;
progress.display(addr);