Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Andrei_E_79
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi,

I want to write data to the external flash using the dev. kit CYW9P62S1-43438EVB-01.

QSPI is inited and XIP is enabled (linker .ld script is ok and WiFi firmware is running out of the QSPI flash with success. I want to read and WRITE my applciation data to an unused area of the QSPI flash. Is it possible to do that and how? I checked: direct writing to addresses (in runtime, using pointers in C code) of the mapped memory does not work in my code.

This is how I configure the QSPI:
const uint32_t bus_frequency = 50000000lu;
result = cy_serial_flash_qspi_init(smifMemConfigs[0], CYBSP_QSPI_D0, CYBSP_QSPI_D1,
CYBSP_QSPI_D2, CYBSP_QSPI_D3, NC, NC, NC, NC,
CYBSP_QSPI_SCK, CYBSP_QSPI_SS, bus_frequency);
result += cy_serial_flash_qspi_enable_xip(true);

 

Thanks in advance

0 Likes
1 Solution

Hello @Andrei_E_79 ,

This is a limitation of flash memory devices. Flash devices require multiple commands to write data like Write Enable before writing data, thus it won't work in XIP mode.  SRAM memories support both read and write operations through the XIP mode which is not the case with flash devices.  

Yes, the code example is relevant because the kit does have an onboard FRAM you can interface with. 

Q: What is the criteria that allow me to write to the flash chips in XIP mode (using direct memory access, but not SMIF because I understand that SMIF commands do not work in XIP mode)?
You cannot write to flash chips in XIP for reasons I explained earlier. For more details, you can refer to this blog. Use the Command mode (MMIO) mode to write to the flash. 

Regards,
Dheeraj

View solution in original post

0 Likes
3 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @Andrei_E_79 ,

Writes to the external flash are not supported in XIP mode. This is because the writing operation into a flash memory involves not only a write command transfer, but also a status check to verify the status of the operation.  Use the command mode to write into the flash and then switch to XIP when you need to read the code of the external memory. 

For more information please refer Page#346 Section XIP Mode in the Architecture TRM.

Hope this helps 🙂

Regards,
Dheeraj

0 Likes

Could you please confirm (or not) that there is no way to write data to a QSPI flash in XIP mode.

E.g. the TRM states that writes can be done in XIP mode, the cit. "27.2.7 Cryptography
In XIP mode, a cryptography component supports on-the-fly
encryption for write data and on-the-fly decryption for read
data. "

Also there is an example (Cypress (c) ) where FRAM is accessible for both writing and reading in XIP mode at the same time (in example it was done by using direct access to mapped region in the memory).

Are all above relevant for the dev kit I'm using?

 

And, please, give me an answer on one more Q: What is the criteria that allow me to write to the flash chips in XIP mode (using direct memory access, but not SMIF because I understand that SMIF commands do not work in XIP mode)?

 

0 Likes

Hello @Andrei_E_79 ,

This is a limitation of flash memory devices. Flash devices require multiple commands to write data like Write Enable before writing data, thus it won't work in XIP mode.  SRAM memories support both read and write operations through the XIP mode which is not the case with flash devices.  

Yes, the code example is relevant because the kit does have an onboard FRAM you can interface with. 

Q: What is the criteria that allow me to write to the flash chips in XIP mode (using direct memory access, but not SMIF because I understand that SMIF commands do not work in XIP mode)?
You cannot write to flash chips in XIP for reasons I explained earlier. For more details, you can refer to this blog. Use the Command mode (MMIO) mode to write to the flash. 

Regards,
Dheeraj

0 Likes