How to run M7 code from both TCM and DDR?

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

How to run M7 code from both TCM and DDR?

381 次查看
jpsk
Contributor II

Hi,

I have a simple program running on the M7 (i.MX8 Nano) which triggers a GPIO interrupt to unblock the SPI read when a "data ready" signal is received from the ADC  ~every 43us. 

When I run this code in TCM, timing looks great and everything works beautifully. 

Note: "ADC CS" is a separate GPIO pin that complements the native SPI Chip Select to select one of multiple SPI slaves in the SPI bus.

jpsk_0-1660757165769.png

When I run the code from DDR, the ISR was not serviced timely and the entire routine to retrieve the SPI data takes about 10 times longer!  Is there a way to speed up the code running from the DDR?  

jpsk_1-1660757457420.png

 

How to setup the code to run from both TCM and DDR?

Due to the size of the TCM (128K each for Instructions and Data), running our entire program on the TCM is not a viable solution, I read that it is possible to run the most time critical routines (ISR, real time tasks) from the TCM and the rest from the DDR.  Is there an example somewhere that I can refer to see how this is done?

Any pointers on how to address the execution speed limitation is greatly appreciated. Thanks!

 

 

 

0 项奖励
1 回复

363 次查看
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @jpsk,

[Q] Is there a way to speed up the code running from the DDR?

[A]

The biggest factor is cache! You must enable the M4 cache when running from DDR.

That will help you speed up the code running.

 

Best Regards,
Dhruvit.

0 项奖励