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.

RTOS/TM4C1294NCPDT: SPI DMA Ping Pong Mode

Part Number: TM4C1294NCPDT

Tool/software: TI-RTOS

Hi,

I am configuring my uDMA for SPI Tx and Rx.

if I use Rx alone in Ping Pong mode, Everything working fine. But if I configure my Tx also in Ping Pong mode at the same time(Both Tx and Rx having Different Ping Pong Buffers), In Tx, Both Ping and Pong buffers are taking part at the same time.

In Ping Pong mode, either one buffer gets filled and gives DMA stop mode, But no buffer getting filled or getting into DMA to Stop mode if I use SPI Tx in Ping Pong mode.

In data sheet, they have given Ping pong for receiving. Can I able to use Ping pong for transmitting at the same time? My SPI DMA is acting as Master in the Entire programming. 

  • I know of no inherent reason why you cannot use uDMA in Ping-Pong mode for both the TX and RX data.
  • Hi,

    I have configured SPI Tx and Rx for Ping pong mode and its working fine.

    My question is,
    1. Can I use Circular buffer in Basic mode to send data continuously?
    2. Without reconfiguring the buffer in DMA ISR? can I transfer data continuously through SPI TX ?



    Regards,
    Manohar.
  • 1. Use Ping-Pong mode for continuous transfers. Basic mode stops after the count expires and does not reset the buffer address.
    2. Yes, using Ping-Pong mode.
  • Hi,

    I am transferring a 2048 bytes of data to my DMA SPI Rx, which is configured in ping pong mode with each buffer size to be 512bytes.
    How to make a continuous transfer? because after the completion of pong buffer, the channel is disabling.

    Because of this, only 1024 bytes of data is send at a time. After that I have to enable the channel to continue receiving.


    Question:
    1. Is there is any way I can receive data continuously without the channel is disabling after pong buffer?
    2.Maximum of 1024 bytes are received in ping pong buffer with a size of 512 each? why?


    Regards,
    Manohar
  • Hi,

    Below is the code:

    void ISRhandler()
    {
    //check primary Rx channel
    ulMode = uDMAChannelModeGet(UDMA_CHANNEL_SSI0RX | UDMA_PRI_SELECT);
    if(ulMode == UDMA_MODE_STOP) {

    memcpy(ui8ReceivedBuf, ui8DMAPrimary_Buffer, SSI_RXBUF_SIZE);
    uDMAChannelTransferSet(UDMA_CHANNEL_SSI0RX | UDMA_PRI_SELECT,
    UDMA_MODE_PINGPONG, (void *)(SSI0_BASE + SSI_O_DR),
    ui8DMAPrimary_Buffer, SSI_RXBUF_SIZE);
    }


    //check Alternate Rx channel
    ulMode = uDMAChannelModeGet(UDMA_CHANNEL_SSI0RX | UDMA_ALT_SELECT);
    if(ulMode == UDMA_MODE_STOP) {

    memcpy(ui8ReceivedBuf, ui8DMASecondary_Buffer, SSI_RXBUF_SIZE);
    uDMAChannelTransferSet(UDMA_CHANNEL_SSI0RX | UDMA_ALT_SELECT,
    UDMA_MODE_PINGPONG, (void *)(SSI0_BASE + SSI_O_DR),
    ui8DMASecondary_Buffer, SSI_RXBUF_SIZE);


    }
    event_post();
    }

    buffer size is 64 bytes each ping and pong, the mode is working fine and if I send data below 128 bytes as of ping and pong buffer the event is posted for 2 times. if I send above 128 bytes the event post is still 2 times only and the channel is getting disabled after pong buffer? why?

    I can re- enable the channel again in ISR, but the transfer is not continuous.



    Regards,
    Manohar
  • The Ping-Pong mode does require the CPU to process the data and reconfigure the Channel Control Word once the transfers to or from one buffer has completed. Since the DMA has now switched to the second buffer, the transfers continue without stopping.