Author: WangS_81 Version: **
The access to the SMIF block can be by two modes: MMIO mode or XIP mode. The MMIO mode lets you use the QSPI block as a peripheral talking to an external device (like how you use SPI to talk to an external memory). Typically, this mode is used when the SMIF writes to an external flash memory. The memory or XIP mode configures the SMIF block to respond to AHB bus transfer requests. The typical use case for the XIP mode is to execute code placed in external memory.
If you have already mapped the external memory to a XIP address space (0x18000000 to 0x1FFFFFFF), any data/code requests in that region automatically gets serviced by the SMIF block. However, if the block is not configured for proper read/write commands, these accesses will result in bus faults.
In MMIO mode, external NOR/NAND flash does not support byte writing (they usually require a block-erase followed by block-write command for proper writing). These sort of write transfers are not supported in the memory/XIP mode. Only byte-wise read and byte-wise write commands can be used in memory/XIP mode.
For setting the mode, use the Cy_SMIF_SetMode() API. The CY_SMIF_NORMAL parameter puts it in MMIO mode and the CY_SMIF_MEMORY parameter puts it in memory/XIP mode.