SPI2 Internal Flash Page Program Using Non-blocking Mode


The internal SPI flash memory that I believe it is Micron N25Q. The memory size is 2 MB.

I have a problem to program memory when it goes across the page boundary (256-byte) with non-blocking mode. Meaning that in my system, I do not want to use blocking mode which uses while loop to wait Tx/Rx status register changes. Instead of using while loop, I use state machine running in the background loop to check any register value change. State machine can exit whether the register value is changed or not.

The workaround that I found is that I need to restart whole program page process with a delay (e.g. 5ms) before it starts the new page program. Otherwise it fails to write to the next page. My assumption is that there will be some timing issue with SPI clocks which ADSP-CM40xF provides because the clock will be gated only data is transferring.

I check the N25Q manual, but there was no information regarding SPI clock when it is paused while it program across the page boundaries. Therefore, I am wondering that the workaround I found is right way to do it, or there will be different/correct way to do it.

Please advise.