2019-03-18 07:31 AM
Hi,
Being new to QSPI technique I have to ask for some help to find out if I have misunderstood the whole concept.
Our target is to have two QSPI flash memories and run the code from the first one (xip) and use the second one for data storage to be used e.g. as flash file system. The cpu used is STM32F730x8.
After investigating the example projects and documents I can't find out how this is done: since there's only one instance of QSPI peripheral in the chip, and if the dual memory mode is not used, is there any way for targeting the FLASH2 while running the code from FLASH1?
And if we were using the two memories in dual memory mode, how do we perform sector write/read operation while running the code from the same flash?
Any help appreciated,
BR Jukka Lamminmäki
2019-04-24 03:33 AM
If anyone is wondering this kind of QSPI questions, the answer via ST is: two QSPI flashes can NOT be used simultaneously unless configured to dual memory mode. It would require two separate QSPI instances in the chip.
I.e. if another one is needed for data storage, it must be used via normal SPI interface.
2019-04-24 09:14 AM
The answer from ST is obviously correct. However, depending on your precise requirements, it might be possible. If you indend to use the second flash for a proper flash file system, then you'd in general never access the flash directly from your application, but only via the file system layer, which in turn would employ appropriate low level read and write fuctions. If these low level functions would be located in the internal flash, and all interrupt service routines as well, it would be possible. Just flip the FSEL bit in QSPI interface upon entering the read/write functions, and revert to the old setting upon return. Data goes via RAM anyway, so no problem.
Of course, there are more implications, i. e. if you want non-blocking i/o or an operating systems, you'd have to toggle the FSEL bit back on context switch and forth when resuming the i/o. So, it *IS* certainly possible, but complicated. Like in the old days of 16-bit address busses with bank switching to support memory beyond 64k.
Whether you actually need non-blocking i/o is worth a second thought: For reads, the QSPI will deliver the data almost instantly, so no problem. For writes and in particular erase it's different. However, after pushing the data to be written into the page buffer of the flash (again, no wait required) or issuing an erase command, it's possible to switch *immediately* to the other flash chip: As soon as CS goes inactive, the flash starts the page write or erase operation and does *NOT* need any further activity by the SPI master.
It sufficiently to check periodically the flash's status register.
2019-04-24 10:27 PM
Thanx Andreas for your informative reply,
Since we are using RTOS, we considered the separate write functions in internal FLASH or RAM to be too complex, and since our use for data storage should be only occasional, easiest solution for software side would be to handle the FLASH2 via normal SPI line.