TWRK65f120m DSPI with DMA issue

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

TWRK65f120m DSPI with DMA issue

Jump to solution
1,801 Views
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 ?

Labels (1)
1 Solution
1,652 Views
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.

View solution in original post

0 Kudos
Reply
3 Replies
1,653 Views
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 Kudos
Reply
1,434 Views
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 Kudos
Reply
1,652 Views
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!
-----------------------------------------------------------------------------------------------------------------------