SPIFlash support for W25N01GV

NAND flash is pretty different from NOR flash and the SpiFlashRK library is not at all intended to support NAND flash.

There is no chip erase or sector erase on NAND flash, which is why those times are not listed. There is only a block erase on NAND flash, 128K on the W24N01GV. The sectors on most NOR flash are 4K.

On NOR flash, the addresses are linear from the start, with one exception. For NOR flash larger than 16 Mbyte (128 Mbit), they can operate either in paged mode with 24-bit addressing, or 32-bit linear addressing. There aren’t NOR flash larger than 4 GB so what happens when 32-bit linear addressing is no longer possible hasn’t been run into yet, but 40-bit addressing is theoretically possible.

WIth NAND flash it’s always paged read and write with a weird page size of 2,112 bytes for the W24N01GV. So you always have to set the page and work with a page at a time, for both read and write. The SpiFlashRK library only works in linear mode and has no concept of working with paged mode.

The other important thing with NAND flash is that you need to maintain the bad block list. For NOR flash, blocks fail only when writing. For NAND flash, blocks can also fail reading, which requires special bad block management. LittleFS sort of works with NAND flash, but does not have built-in support for read block failure management so you’d need to do that yourself.