AnsweredAssumed Answered

SPI using DMA with a Circular DMA buffer (K64f)

Question asked by unknowncoder on May 2, 2018
Latest reply on May 11, 2018 by unknowncoder

I am using the SPI in DMA mode. I have setup the DMA to use circular buffer by calling "EDMA_SetModulo()"

The circular buffer feature only need for the receiving data on the SPI.

The call process goes like this

  1. Setup DMA as usual 
  2. call this EDMA_SetModulo() with the destination set to kEDMA_Modulo512bytes. The destination of the DMA is the RAM, the source of the DMA is the SPI RX register.
  3. Finish setting up the SPI in DMA Mode 
  4. call DSPI_SlaveTransferEDMA() with the rxData pointer pointing to a 512byte buffer.


After the master has transfer a total of 512 byte the DMA callback runs as expected but after this point if the master start sending more data nothing happens. I think after every DMA transfer complete runs I need to call "DSPI_SlaveTransferEDMA()" method again. 

Which makes no sense if my DMA is in circular buffer mode.


Can someone let em know what I may be doing wrong.



I looks like the SPI_EDMA driver doesn't support setting up the DMA in circular buffer mode. I had edited the SPI_EDMA driver to correctly setup the ATTR register but it still doesn't work. 

When EDMA_DspiSlaveCallback() it disable the DMA, but if I remove this call, it still does not work. Can anyone offer me some insight?