I was using standard 24-bit addressing on this part for read, write, sector erase and bulk erase. The hardware is a Enclustra ZX3 SoM, so a Xilinx Zynq.
However, when switching to the extended addressing commands described in 9.1.1 of the data sheet, I am no longer reading the correct values. I am, instead, always receiving a value of 0x00. Other commands, such as reading flash ID, register read/write, etc. seem to continue to work properly. My guess is that bulk erase is also still working but I can't confirm that since I am always reading a value of 0x00.
I am wondering if I might be doing something wrong with these reads and writes or what else I may have missed to cause this problem.
I would like to point out that the command which you have used for read operation (0x6C) is the Quad Output Read command, which means that the output data from the flash comes on all four IO lines. See figure below.
For using quad commands, you need to first enable the Quad mode by setting the Quad bit (CR1) in Configuration Register 1. Can you please confirm whether you have enabled quad mode on your flash device?
If you don't want to use the quad mode, and are only going to use the Single SPI read command that expects four bytes of address then you should be using the 4READ (0x13) command.
Hope this solves your problem. If not, please let me know your queries.
To be clear, Quad Mode does work with 3-byte addresses. It is when I switch to the 4-byte addresses and the associated commands that I seem to be getting the incorrect data.
A couple of things to clear up and add:
1) I am actually receiving values of 0xFF for all extended address quad reads (not 0x00).
2) The code I showed you above didn't have the offset correction to account for the dummy byte on a quad read (I had been testing non-quad and didn't get it changed back). Correct code below.
3) I have noticed by switching back and forth between 3/4 byte addressing that the 4-byte addressing seems to work for writes only. The reads always return 0xFF.
4) I also noticed an interesting difference in behavior between the commands 0x02 (Page Program) and 0x12 (Ext Addr Page Program): When writing a single byte, 0x02 seems to modify the subsequent 3 bytes by setting them to 0x00. 0x12 does not exhibit this behavior. I've seen this with two different qspi drivers.
Thank you so much for the clarification.
"Quad Mode does work with 3-byte addresses. It is when I switch to the 4-byte addresses and the associated commands that I seem to be getting the incorrect data."
>> Are you reading the same memory location every time and getting the wrong result with 3 byte address command but correct result with 4 byte address command ?
Please answer my below questions based on the information you have provided -
1. I would like to inform you that when a flash memory part is shipped, it is a completely erased part, which means all memory locations have data 0xFF. Can you please confirm that you are not reading an erased sector? If you are reading an erased sector, 0xFF is the correct output.
3. How have you confirmed that the program operation has completed successfully? Are you capturing the SPI waveforms? Have you tried reading the Status Register at the end of the program operation? Are you observing any of error bits being set?
4. Is it possible for you to provide SPI waveforms for the below operations?