Hi, everyone.
I have a couple of strange problems with W25Q32JV SPI flash chip on a piece of hardware with STM32F051 MCU. I'm running SPI at 12Mbps.
1) After the first write operation something starts inserting 2 or 3 leading zero bytes at every following read transaction. First read gets 2 or 3 zero bytes, all next reads get 2 zero bytes before actual data. Data bytes are correct, but shifted, last 2 or 3 bytes of the actual data are missing (beyond transaction window). All read operations before the first write operation return correct data without leading zero bytes.
Steps to reproduce:
1.1 erase a sector, write one or more pages, reset uC, do not power off
1.2 read one or more pages of that sector - all bytes are correct
1.3 erase the sector again and write one or more pages
1.4 read one or more pages of that sector again - every read result is now preceded with zero bytes
2) Write operations to the first page of every sector, but the first sector, seem to be ignored, while the first page of the first sector always writes successfully. Under some conditions, I haven't figured this out yet, writing to the first page of a sector individually succeeds, but after next sector erase operation that page stays empty. Zero bytes also appear over empty pages.
Steps to reproduce:
1.1 erase 2 or more adjacent sectors
1.2 write some data to these sectors
1.3 read data back - all bytes are correct except for first pages of 2nd and following sectors, these pages are still filled with 0xFF
I'm trying to figure out is it a hardware of a software problem. Since I'm not powering off the flash chip, 'first' operation I'm referring to isn't really the first for the flash chip, but they are truly first for MCU SPI hardware and firmware. After a long debugging I can say it is unlikely a memory access problem in the firmware or another bug like that and SPI flash driver looks up to documentation. Yet, something is very wrong.
Any ideas?
p.s. Would it help if I provide schematics and related pieces of firmware?