The qspi driver seems to make a number of assumptions about the protocol that don't fit the Winbond W25M02GW (and certain other) SPI flash chips.
Two major issues I've run into:
- The QSPI driver always seems to send 32 bits of payload with the Fast Read (0x0b) opcode, even with ADDRMODE_24BIT. The Winbond chip expects 24 bits of payload. This causes the peripheral to ignore the first byte read back.
- Status register reads sent by the QSPI peripheral consist of a single 0x05 opcode with no arguments. The Winbond chip expects an argument indicating one of three types of status registers being read. I suspect this means that the QSPI peripheral will not block correctly as it can't get the BUSY signal from the device.
There are other issues too that are less critical:
- The QSPI peripheral appears to assume that the Fast Read and related instructions address all of memory. The W25M02GW has a separate instruction to load a page from memory into buffer, and Fast Read and friends only read from the buffer. Not that big a deal, as it's possible to issue the separate instruction using a custom command.
- Some of the driver documentation doesn't match what actually happens. For example, NRF_QSPI_ERASE_LEN_64KB corresponds to opcode 0xd8, which on W25M02GW erases a 128KB block (64 pages x 2048 bytes per page).
All of the above was verified by looking at the behavior of the QSPI peripheral using a logic analyser connected to the SPI bus.
Are there plans to support these types of QSPI devices in a future update?