This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: Using DMA with SPI in master mode

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi,

Normally with SPI when we want to receive data we simply send "empty bytes" and for each sent "dummy byte" we receive a byte.

My question is : Using DMA, can we program DMA to "send dummy bytes" in order to receive "meaningful bytes" without the CPU being involved?

More precisely : I want to "talk" to a chip (that obviously support SPI). This chip is the slave and has the usual SPI interface (miso,mosi, cs, sck).

However, the slave chip (the C2000 being the master) has an extra PIN which is the INT pin, which can be used to signal to master (C2000 device) that the slave  is ready to send bytes.

So my question is : can we configure DMA to send "dummy bytes" when a PIN/GPIO (here, this GPIO/PIN would be connected to the INT PIN of the slave chip) goes from HIGH to LOW, so that DMA can receive the bytes the slave wants to send. And all this, without generating interrupts nor having the need to have CPU code.

P.S. I'm using driverlib.

Thanks!!

  • Hi Yannick,

    You can configure one of your DMA's trigger sources to be one of the five external interrupt sources (XINT1-XINT5). These external interrupt signals can be connected to most of the general-purpose input/output (GPIO) pins on the device. So you can connect your INT pin from the slave device to the gpio of your choosing then map that gpio to your XINT signal. 

    Hope this helps!

    Best Regards,

    Marlyn

  • Marilyn, fantastic answer!

    Could I ask you which driverlib functions to look at in order to achieve this?

    Sorry, I'm still a bit lost in all this!

  • Hi Yannick,

    To set the trigger source of the DMA you can use the DMA_configMode() Driverlib function. I am not sure how far along you are in your development but good reference examples would be the dma example: dma_ex1_gsram_transfer (C:\ti\c2000\C2000Ware_version\driverlib\f2837xd\examples\cpu1\dma\dma_ex1_gsram_transfer) as well as the spi_loopback_dma example (C:\ti\c2000\C2000Ware_version\device_support\f2837xd\examples\cpu1\spi_loopback_dma). The second example I referenced is not in driverlib format but it will help you understand how to setup the SPI with the DMA.

    For setting up and configuring the XINT I would suggest looking at the interrupt_ex1_external example (C:\ti\c2000\C2000Ware_version\driverlib\f2837xd\examples\cpu1\interrupt\interrupt_ex1_external). This example will have all of the driverlib functions you need for this part of your code.

    Best Regards,

    Marlyn