TWRK65f120m DSPI with DMA issue

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

TWRK65f120m DSPI with DMA issue

跳至解决方案
1,800 次查看
ameerhamza
Contributor III

I am working on baremetal application on TWRK65 developing low level driver for dspi, my main goal is to extract maximum throughput out of SPI so i am using edma. Currently I am facing a problem which is causing greater loss in throughput. The design of SPI_PUSHR register is such that lower 16 bits hold data while upper 16 bits hold command flags. The problem is that I can not pass data alone to DMA source channel for TX transmission, i have to always iterate through byte by byte data and set required flags and copy in to another local buffer bearing data and flags variable. This whole data copying operation is hitting greatly in dspi throughput. Without this copy operation i get 13 Mbps c for 20 MHz clock which is very good, but for proper spi transaction i have to copy all the flags and data which limits my throughput to around 3 Mbps for same clock. Is there any alternative way to avoid copy operation and pass data directly to dma buffers ?

标签 (1)
1 解答
1,651 次查看
ameerhamza
Contributor III

I figured out myself. To In order to avoid the loop, i am now doing first memory to memory transfer for all the incoming data through dma with 4 bytes offset, Then using the actual dma transfer. So loop is eliminated by Memory to Memory transfer of data and i am now getting great throughput.

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,652 次查看
ameerhamza
Contributor III

I figured out myself. To In order to avoid the loop, i am now doing first memory to memory transfer for all the incoming data through dma with 4 bytes offset, Then using the actual dma transfer. So loop is eliminated by Memory to Memory transfer of data and i am now getting great throughput.

0 项奖励
回复
1,433 次查看
fshah30
Contributor II

Hi,

Would please share your code link. I am working with external ADC and want to speedup the DSPI speed I hope your code will help me to get more ADC samples in efficient way. 

Thank you

0 项奖励
回复
1,651 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

If byte by byte collect SPI transfer data using DMA way, which is not an effective way.

DMA will reduce the core workload with bulk data transfer.

It need to check the core work load, the core combine a SPI byte with 16-bit SPI command to 32-bit data format will be faster than DMA.

After the SPI data (32-bit format) done, using DMA to start SPI transfer.

In another word, I want customer try to use core to do transfer SPI data format (8-bit) conversion (to 32-bit).

Wish it helps.


Have a great day,
Mike

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