Can I use the same QSPI Flash for running app code and for storing some data simultaneously?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Can I use the same QSPI Flash for running app code and for storing some data simultaneously?

跳至解决方案
2,056 次查看
burhanhagi
Contributor IV

burhanh_0-1691006447122.png

I am using the above 2 different QSPI Flashs in my PCB. I use the first QSPI flash as only storing & running my app code(over FLEXSPI1 interface). I use the second QSPI Flash as only for storing some data I need at runtime(over FLEXSPI2 interface).

 

What I want to do is that is there any way to use one single QSPI Flash(such as only FLEXSPI1 interface) for keeping & running  app code and also for storing data at runtime. I want to resize the whole single QSPI flash into two sections. In first section, I will load and keep my running app code. In another section, I will use it as database.  As a result, I will remove 1 out of 2 QSPI Flashs in above screenshot 

Is there any example code/link explaining well related with above job? For example, in order for it to be simple, I want to try it with iled_blinky_project with some modification included.

So, I will store my led blinky app project together with serial terminal console send/receive function to the first QSPI FLASH (FLEXSPI1 interface) in my PCB over IDE JTAG debugger.

I will not use the second QSPI Flash. I will get some data over UART console and save it to the same QSPI FLash and send it to the console back during the led is blinking. What I mean is that One section is program code and another section is for using database at the same time while app code is running.

标签 (1)
0 项奖励
回复
1 解答
1,955 次查看
mjbcswitzerland
Specialist V

Hi

Generally it is best to avoid running XiP in the same QSPI flash that is used as a data base since data base operations will effectively stop the code when flashing operations are performed and this can cause system issues due to delays, none-responsiveness to interrupts and such.

There are some QSPI flash (or Hyper) that support writing and reading but they can be expensive and potentially difficult to get. Some companies using them originally (for example Embedded Artists) had to move their products to more conventional ones and that means that also their customers had to redesign their products for them to be able to work.

If your code is not too large it is best to run it in RAM (this can be 10x faster than XiP and also much more deterministic) and then there is no restriction to using the QSPI for holding the FW image and for use as data base.

The uTasker project does this by default (and supports AES256 encryption for IP and clone protection without any running overhead).
See https://www.utasker.com/iMX/developers.html for guides and videos.

Regards

Mark

P.S. For available stock of Kinetis and i.MX RT1062 see here: https://www.utasker.com/Shop/semi.html

在原帖中查看解决方案

4 回复数
1,956 次查看
mjbcswitzerland
Specialist V

Hi

Generally it is best to avoid running XiP in the same QSPI flash that is used as a data base since data base operations will effectively stop the code when flashing operations are performed and this can cause system issues due to delays, none-responsiveness to interrupts and such.

There are some QSPI flash (or Hyper) that support writing and reading but they can be expensive and potentially difficult to get. Some companies using them originally (for example Embedded Artists) had to move their products to more conventional ones and that means that also their customers had to redesign their products for them to be able to work.

If your code is not too large it is best to run it in RAM (this can be 10x faster than XiP and also much more deterministic) and then there is no restriction to using the QSPI for holding the FW image and for use as data base.

The uTasker project does this by default (and supports AES256 encryption for IP and clone protection without any running overhead).
See https://www.utasker.com/iMX/developers.html for guides and videos.

Regards

Mark

P.S. For available stock of Kinetis and i.MX RT1062 see here: https://www.utasker.com/Shop/semi.html

2,013 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @burhanhagi ,

As you know that flash doesn't support RWW(read while write). If you want to write flash while XIP, you must have the MCU run in other memory while writing. 

You can call ROM API to write(disable all interrupt), or you can move related code to RAM. You can refer to the fsl_romapi demo and flexspi_polling_transfer demo in SDK. In flexspi_polling_transfer demo, the link file is controlled by the script in linkscripts folder.

 

Regards,

Jing

1,997 次查看
burhanhagi
Contributor IV

Hi @jingpan , Our QSPI flash is W25Q128 from Winbond. This is not an XIP Flash, it is just an ordinary QSPI one. I may use XIP Flash from Adesto such as ATXP064.  As far as I searched, XIP flashes supports both read and write simultaneously(RWW). So in case I use ATXP064, Is your above post still valid for it? Or can I use it directly without calling ROM API or moving code to RAM?

0 项奖励
回复
1,977 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @burhanhagi ,

W25Q128 support XIP. We can support RWW on ATXP064. https://www.nxp.com.cn/docs/en/application-note/AN12564.pdf

But my answer is still valid. You'd better use ROMAPI or RAM base code to write flash.

 

Regards,

Jing

 

Regards,

Jing

0 项奖励
回复