SPI (master) doesn't transmit DMA data

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Good afternoon all!

   

I'm new to these forums, so hopefully this is the right place to ask for some guidance from the pSoC experts 🙂

   

I'm attempting to use the DMA engine to transfer data from the digital filter block to an external DAC using the SPI (configured as master mode).  I've connected the DFB's DMA_Req_B output to the DMA drq input and verified that the DMA does transfer the desired data correctly if I target an SRAM memory location.

   

If I attempt to direct data to the SPI FIFO however, the interface remains quiet and the status bits reflect the FIFO is empty at all times (just as though the data isn't making it to the FIFO at all).  The following code snippet shows my configuration:

   
     // Filtered values -> DAC (via SPI)   
   
     DMA_DAC_Chan = DMA_DAC_DmaInitialize(2, 1, HI16(CYDEV_PERIPH_BASE), HI16(CYDEV_PERIPH_BASE));   
   
     DMA_DAC_TD = CyDmaTdAllocate();   
   
     CyDmaTdSetConfiguration(DMA_DAC_TD, 2, DMA_DAC_TD, DMA_DAC__TD_TERMOUT_EN);   
   
     CyDmaTdSetAddress(DMA_DAC_TD, LO16((uint32)OUTPUT_FILTER_HOLDBM_PTR), LO16((uint32)SPI_TXDATA_PTR));   
   
     CyDmaChSetInitialTd(DMA_DAC_Chan, DMA_DAC_TD);   
   
     CyDmaChEnable(DMA_DAC_Chan, 1);   
   
        
   

The DMA's nrq output toggles after every instant I'd *expect* a transfer to have occurred, but still no SPI data appears.  I've tried many permutations of SPI buffer address, pointer etc, but haven't found a combination that works.  DMA writing to a global variable in SRAM is OK, though.

   

The SPI interface seems to be correctly configured - manually dropping a word into the buffer via:

   

SPI_WriteTxData(value);

   

works OK.

   

Does anyone have any idea what I'm missing?  It's driving me crackers!

   

Cheers 🙂

0 Likes
2 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Take a look at -

   

www.cypress.com/file/48886      CE56273 – SPI With DMA in PSoC® 3 / PSoC 5

   

http://www.cypress.com/documentation/application-notes/an52705-psoc-3-and-psoc-5lp-getting-started-d...                                             AN52705     Getting Started with DMA

   

http://www.cypress.com/documentation/application-notes/an84810-psoc-3-and-psoc-5lp-advanced-dma-topi...                          AN84810     PSoC® 3 and PSoC 5LP Advanced DMA Topics

   

http://www.cypress.com/documentation/application-notes/an61102-psoc-3-and-psoc-5lp-adc-data-bufferin...                AN61102 PSoC® 3 and PSoC 5LP - ADC Data Buffering Using DMA

   

http://video.cypress.com/video-library/search/dma/     Videos on DMA

   

https://www.youtube.com/results?search_query=dma+psoc Videos on DMA (some overlap)

   

 

   

Regards, Dana.

0 Likes

Hello,

   

Please let us know what is width of databytes for the SPI?

   

Thanks,

   

Hima

0 Likes