I would like to suggest you to go over the QSPI Flash Read and Write code example. The code example is written for interfacing Cypress flash with PSoC 6 and I would like to confirm that enabling QSPI mode of Cypress flash also works in the exact same manner as you have mentioned about IS25LQ016B.
When the code example is run for the first time on a new flash device, the flash is in SPI mode by default. The cy_serial_flash_qspi_init() function still initializes all 4 I/O lines. Inside the Init function, the QE bit is read and checked if Quad mode is enabled or not. If Quad mode is not enabled, QE bit is set. You can avoid the extra step of initializing twice.
However, If the method mentioned by you works for you then it should not be a problem.
Thanks for your reply.
When you say that the cy_serial_flash_qspi_init() function will initialize all 4 I/O pins, then based on my test it will also use the QSPI to read the QE bit, which will fail for the first time for the serial flash as the QE bit is not set out of the factory.
The serial flash module is an abstraction layer that can be based on the SPI, QSPI and Octal SPI module, for the user, how do we specify this in the code?
I don't see an API or macro config associated with that.
My observation is that if I put two pins in the cy_serial_flash_qspi_init() function, then it will use SPI for the whole program
If I put 4 pins in the cy_serial_flash_qspi_init() function, then it will use QSPI.
I went through this datasheet of IS25LQ016B flash device. Hopefully it is the correct datasheet, and if not, then please point me to the right document.
As per my understanding, the working of Cypress flash devices and IS25LQ016B device is similar in terms of enabling quad mode in the flash part.
In IS25LQ016B part, The Quad Enable bit is the 6th bit of the Status Register and the command to read and write to this register is RDSR (05h) and WRSR (01h), respectively. There is no quad command for reading and writing to Status Register and these commands will always use only SI and SO lines. Irrespective of Whether quad mode has been enabled in the flash device or not, these commands will always make use of only two IO lines. This is also how Cypress flash devices work.
Please correct me if I am wrong.
>>based on my test it will also use the QSPI to read the QE bit, which will fail for the first time for the serial flash as the QE bit is not set out of the factory
Can you please elaborate about the tests you have performed? Do you mean IS25LQ016B device uses four lines to read and write to the SR?