How to use 4-byte addressing on Micron SPI NOR Flash?
((I realize I'm asking about Micron flash on a Microchip forum. I'm using a Microchip processor in assembly language.))
I'm trying to access (program) the Micron NOR Flash on the AC701, using single wire SPI. (Part number N25Q256A13ESF40G.) I need to access >128MB, and so I'm using 4-byte address mode. However, it's not working, the datasheet is very unclear about how 4-byte addressing works, and I've Googled my heart out to no avail.
Perhaps someone knows the answers...
(1) About the B7h command to "Enter 4-Byte Address Mode". After doing 06h (Write Enable) and B7h, can this be followed by any number of commands, including special 4-byte memory address commands? (Note that I haven't even gotten to adding an 06-E9 command sequence afterward to exit the mode.) Or is it necessary to repeat the 06h-B7h sequence before EVERY INDIVIDUAL 4-byte memory address command, as well as the 06-E9 sequence?
(2) I've adapted some existing code to test this for me. But it's not working. Specifically, when the code runs in 3-byte address mode, there is a Subsector Erase (20h) that takes many seconds to complete. During this busy time, the status register is read (05h) repeatedly and it returns WE+Busy bits set. Eventually status returns 0 (Ready), and the code continues. HOWEVER, in 4-byte address mode, the 4-byte Subsector Erase (21h) takes no time at all. The first status register read (05h) returns WE. It doesn't return 0 (Ready), and it doesn't return WE+Busy. It returns WE. The existing code continues because the flash didn't say it was busy.
(3) Below is a screenshot of a spreadsheet with the working and failing cases. In the failing case, blue background cells show the new data transfers for the failing case. The working case above it has gray background cells inserted merely to line up some of the transfers in the two examples. However, where the working case has gray background cells and the note "Time Delay While Erasing (repeating busy)", the failing case has pink background cells and the note "Fails (there is no time delay) Status was NOT busy". (I realize there's a data transfer in both directions every clock. I didn't write the underlying code. I've done my best to show the data being transferred.) In those blank spreadsheet cells that aren't just there to align the two cases, blank "Bytes Sent" are probably NOP "00", and blank "Bytes Received" might be "00" of "FF".
(4) I also tried postponing and shortening the B7 command, so that the transmitted command sequence was 06 00 B7 00 20 00 00 0F FC, but that didn't help.
((I have attached an image. Hopefully it's visible...))