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.

TMS320F28388D: Send and Receive Data from 4 SPI Modules Continuously by Using 2 DMA Channels

Part Number: TMS320F28388D


Hi all!

I want to set one DMA channel to send data from 4 SPI modules and receive data from 4 SPI modules with another DMA channel.

To send, I set burst size 4, burst destination step size as (SPIB_BASE-SPIA_BASE), transfer size 1 and transfer destination step size -(3*(SPIB_BASE-SPIA_BASE)).

destination address is (uint16_t *)(SPIA_BASE + SPI_O_TXBUF)

And the similar settings for receiving with same logic.

Then I trigger TX DMA with DMA_TRIGGER_SPIATX event and DMA_TRIGGER_SPIDRX for RX_DMA. And all SPI fifo levels are set to 1.

When I run my code, it works but RX_DMA reads old data from some SPI's and it doesnt work properly.

Can I use 1 DMA to send data from all 4 SPI's and another DMA to receive?

If yes. How should I set the DMA's and SPI's.

Many thanks in advance.

  • Hi,

    Let me know if I got your question right. You have an array of data you want to transfer using 4 different SPIs. Example: array = {1,2,3,4,5,6,..}. You want the DMA to transfer 1 to SPIATX, 2 to SPIBTX, 3 to SPICTX, 4 to SPIDTX, 5 to SPICTX and so on. Same on the RX side as well. Is my understanding correct?

    One issue I see here is, the trigger for the DMA is the SPIATX and this triggers writes to all the 3 SPIs. But are the other 3 SPIs ready for a TX when SPIA is ready?

    Are you configuring the SPI in loopback mode for testing? If not, are all these SPIs configured as master?

    If you have access to the SPI pins, it would be good to probe the lines and see if the data transfer happens in the correct order.

    Regards,

    Veena

  • Hi Veena!

    Thaks a lot. I solved it by adjusting burst step sizes according to difference between SPI Base addresses.