I am attempting to use a PSoC 6 with an external QSPI Flash Memory via the SMIF hardware module, and I have stumbled onto a strange issue that appears both on my company's custom board and on the PSoC 6 BLE Pioneer Kit board.
The API provides two main vectors by which one can check if the data transfer is complete: Cy_SMIF_BusyCheck(), or via passing in a callback function. The SMIF example project (CE220823_PSoC6MCU_SMIFMemoryWriteandReadOperation) uses the BusyCheck function. However, it appears that these are not correctly identifying the end of data transmission; if the read data is used too quickly after calling for a read, the data will not be as expected. In the sample project, immediately after each write and read, a function prints the entire buffer to terminal (PrintWriteData and PrintReadData). If I remove these print functions, as well as a couple of status register reads and the associated prints of those, the comparison in the sample project fails. If I then replace every commented out section with a static delay via Cy_Syslib_Delay(1000), the comparison succeeds. This implies that the time taken to print the buffer is masking the fact that BusyCheck does not actually indicate if the device is indeed busy.
This all uses the BusyCheck function call, but in my main project I also attempted to use the callback function to similar ends. I have yet to recreate that in this sample, but I could if someone wanted to see it play out.
What I can surmise from all this is that, irrespective of the flash hardware used, the SMIF API fails to accurately generate a signal to inform the processor that data transfer is complete.
My question is this: has anyone else yet used the SMIF interface to interact with a flash device successfully without immediately printing the buffers? Is there a better method to check if data transfer has completed than the two the API seems to offer for you? My current solution is to add long static delays after both the read and the write functions, which hamper performance too much to be used in production.
To this post, I have attached the captured terminal outputs for the three arrangements of the sample project (unmodified being the freshly created sample project, modified being output where various unnecessary checks and prints are removed, and modified_delay_added being where those commented out sections have a seconds worth of delay added to them.) I also attached an archive of the modified sample project.