You are here

SPI Master with a dedicated DMA drq line | Cypress Semiconductor

SPI Master with a dedicated DMA drq line

Summary: 2 Replies, Latest post by willemite on 18 Sep 2014 04:21 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
user_22393527's picture
65 posts

Hi All,

I shamelessly modified the stock SPI master 2.40 component in the catalog to support large DMA transfers more easily. The only reference I could find to send data via SPI and DMA was to use the interrupt line and then an indexed DMA to clear the interupt flag (CE56273). Probably there are other solutions but I did not come across them in my short search.

This method seemed complicated as I have a 4kB frame buffer I want to repeatedly send to a display without worrying too much. Thus, I added two lines of verilog to the Base Spi component:

output  wire tx_drq  //in the module descriptor for module B_SPI_Master_v2_40_DMA just to indicate an extra output

as well as:

    assign tx_drq = dpMOSI_fifo_empty; 

All this does is bring out the FIFO empty signal to make it accessible to a level sensitive dma component. There is an extra pin brought out for the base and the master component. All the rest is left the same. Attached you can find the workspace with the custom components.

It is happily transfering 4096 bytes across to my display now (which is so annoyingly one byte larger than one TD can handle!). This project is for a psoc5.

Any input is appreciated.

BMAH's picture
Cypress Employee
189 posts


I just had a look at your project. One small point is you need not use &spiTx while giving address in CyDmaTdSetAddress. You can use spiTx as it is also a pointer. The TD is configured to send only 10 bytes and is disabled after 10 bytes transfer. This would disable the channel also. Do you mean to say that this TD transfers 4096 bytes? Are these bytes random or spiTx buffer itself transfeerd multiple times?


PSoC Wonders

user_22393527's picture
65 posts

 You are correct. This was my test workspace, so only 10 bytes are sent. In my actual framebuffer application there are two chains, one of 4095 and the next of 1 byte.

It is set to disable. Once it is needed again the channel is enabled once more { CyDmaChEnable(DmaSpiTx_Chan, 1);}

You are correct about the &spiTx thing, missed that one, thanks.

Log in to post new comments.