i.MX RT1050 FlexSPI XIP and Write to Flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX RT1050 FlexSPI XIP and Write to Flash

Jump to solution
8,479 Views
brucebarnes
Contributor I

There is an driver example project in the SDK flexspi_hyper_flash_polling_transfer that shows how to access the FlexSPI flash but only when running from RAM.  Is it possible to erase/write to a sector of the FlexSPI flash when executing in place (XIP)?

Labels (1)
1 Solution
6,131 Views
igorpadykov
NXP Employee
NXP Employee

Hi Bruce

this may depend on used flash part and one can consult with its vendor, as

if the processor is running in XIP mode using the SPI interface, one can’t simply modify
(i.e., erase/write) that SPI flash device. That’s because it may require taking the SPI peripheral
out of XIP mode and putting it into SPI mode, which could crash the system.

More considerations can be found for example on

http://www.electronicdesign.com/embedded-revolution/xip-linux-new-spin-embedded-architecture 

SPI Flash - SEGGER - Support Wiki 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
8 Replies
6,131 Views
2winkle
Contributor III

Hi brucebarnes‌,

It is not possible to erase/write flash when in xip from the same flash.

You can use a small hack though.

If you have enough amount of RAM available, you can execute all the code dealing with flexspi and qspi from the RAM. Thus, it would not interfere with any xip sequences.

6,131 Views
sbuligan
Contributor IV

Hi 2winkle

Regarding your statement "It is not possible to erase/write flash when in xip from the same flash." 

Is this because of the (I am assuming Linux is used in this case):

  1. i.MX RT1050 SOC or
  2. how the Linux kernel/file system handles XIP or
  3. the NOR chip itself not being able to read while write or

   4. any combination of the above or some other reason?

In case it's the SOC, do you know if i.MX 8qx/dx can do such a thing?

0 Kudos
Reply
6,131 Views
2winkle
Contributor III

Hi sbuligan@visteon.com‌,

As per my understanding, a NOR flash accessed via SPI interface can be read from and written at the same time, as SPI interface is bi-directional (full-duplex). But, if in XIP mode, and the code implementing the read/write transactions are present in the NOR flash, read and write will not be possible simultaneously. Please do correct me if I am wrong.

I have not worked with XIP in linux, but I think that the kernel will already be executing from some form of RAM. So, using the SPI drivers in the kernel shouldn't affect the read/write cycle. I am not entirely sure though.

This query along with the one for i.MX 8qx/dx can be asked as a separate question tagged with linux, xip and imx8. You will surely get a better answer there.

Also, do read this article :smileyhappy:

0 Kudos
Reply
6,131 Views
sbuligan
Contributor IV

Hi, thanks for the reply, I actually read the article before posting the question. Even if the commands are present inside the NOR, couldn't they be cached? If you can't or let's say you don't want to ever delete the command LUT, if the NOR chip supports read while write I imagine you could do the following scenario: erase parts of the flash you are currently not XIPing from... but I'll guess I'll find out with experience :smileysilly:

0 Kudos
Reply
6,131 Views
jixiaohu
Contributor I
Is it possible to read and write on another norflash? Here's the situation: portA put the program, xip mode; Another norflash(portB) puts the data, but it doesn't work.
Is it because flexspi shares a bus??
0 Kudos
Reply
6,131 Views
2winkle
Contributor III

Hi jixiaohu‌,

Make sure the SPI NOR flashes are connected in 'parallel mode'.

0 Kudos
Reply
6,131 Views
igorpadykov
NXP Employee
NXP Employee

yes, read and write on another norflash is possible.

 

Best regards
igor

0 Kudos
Reply
6,132 Views
igorpadykov
NXP Employee
NXP Employee

Hi Bruce

this may depend on used flash part and one can consult with its vendor, as

if the processor is running in XIP mode using the SPI interface, one can’t simply modify
(i.e., erase/write) that SPI flash device. That’s because it may require taking the SPI peripheral
out of XIP mode and putting it into SPI mode, which could crash the system.

More considerations can be found for example on

http://www.electronicdesign.com/embedded-revolution/xip-linux-new-spin-embedded-architecture 

SPI Flash - SEGGER - Support Wiki 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply