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.

CCS/TM4C123GH6PM: SSI DMA Transfer in Ping Pong Mode manipulating output data in array

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hi all,

how can I can I manipulate the array for the output data when transferring in DMA Ping-Pong Mode. My problem is when I change the incoming data, I can´t see that the array is changing in output data.

I´m using a TM4C123GH6PM mikrocontroller with an audio-codec. The Mikrocontroller is receiving data (SSIRX) from the audio-codec and then data have to be manipulated with an algorithm. After that data should be transmitted to the output (SSITX).

My code is working, but I cannot change the data. Has anybody tips for me?

Thanks in forward for your answers.

many greetings

Sadullah

  • Hello Sadullah,

    How long does it take for the algorithm to manipulate data? My initial thought is that perhaps the algorithm can't process the data faster than the DMA Ping Pong interrupts come in. What sort of timing tests have you done for this application and algorithm? Can you describe the algorithm so we can have some understanding of how basic/complex it may be?

    Are you only using the DMA Ping-Pong for RX of data, for TX of data, or for both?

    Also if you can provide source code that would be helpful.
  • Hi Ralph,

    I don´t have done any timing tests. The algorithm is a channel simulator for multipath fading. So it is a little bit complex.

    I´m using DMA Ping-Pong-Mode for both.

    // SSI interrupt handler. Called on completion of uDMA transfer
    void hwi_SSI0_ISR(void)
    {
        uint32_t ui32Status;
        uint32_t ui32Mode;
    
        ui32Status = SSIIntStatus(SSI0_BASE, true);
        SSIIntClear(SSI0_BASE, ui32Status);
    
        //IntDisable(INT_SSI0);
    
        ui32Mode = uDMAChannelModeGet(UDMA_CHANNEL_SSI0RX | UDMA_PRI_SELECT);
        if(ui32Mode == UDMA_MODE_STOP)
        {
            g_ui32SSIRxPingCount++;
            uDMAChannelTransferSet(UDMA_CHANNEL_SSI0RX | UDMA_PRI_SELECT, UDMA_MODE_PINGPONG,(void *)(SSI0_BASE + SSI_O_DR), inbuffera1, sizeof(inbuffera1));
        }
    
        ui32Mode = uDMAChannelModeGet(UDMA_CHANNEL_SSI0RX | UDMA_ALT_SELECT);
        if(ui32Mode == UDMA_MODE_STOP)
        {
        	//wssus(inbuffera2, outbuffera2);
            g_ui32SSIRxPongCount++;
            uDMAChannelTransferSet(UDMA_CHANNEL_SSI0RX | UDMA_ALT_SELECT, UDMA_MODE_PINGPONG, (void *)(SSI0_BASE + SSI_O_DR), inbuffera2, sizeof(inbuffera2));
        }
    
    	ui32Mode = uDMAChannelModeGet(UDMA_CHANNEL_SSI0TX | UDMA_PRI_SELECT);
    	if(ui32Mode == UDMA_MODE_STOP)
    	{
    		g_ui32SSITxPingCount++;
    		uDMAChannelTransferSet(UDMA_CHANNEL_SSI0TX | UDMA_PRI_SELECT, UDMA_MODE_PINGPONG, outbuffera1, (void *)(SSI0_BASE + SSI_O_DR), sizeof(outbuffera1));
    	}
    
    	ui32Mode = uDMAChannelModeGet(UDMA_CHANNEL_SSI0TX | UDMA_ALT_SELECT);
    	if(ui32Mode == UDMA_MODE_STOP)
    	{
    		g_ui32SSITxPongCount++;
    		uDMAChannelTransferSet(UDMA_CHANNEL_SSI0TX | UDMA_ALT_SELECT, UDMA_MODE_PINGPONG, outbuffera2, (void *)(SSI0_BASE + SSI_O_DR), sizeof(outbuffera2));
    	}
    
    }

    many greetings

    Sadullah

  • Hello Sadullah,

    Since it sounds like you can RX and TX in Ping Pong mode with the same SSI channel successfully then the issue at hand really is only how to manipulate RX'd data to then properly TX the manipulated data, correct?

    Based on what you describing if you are using Ping Pong Mode, I think you would need to received a set of data to process first and foremost, and then you can begin a routine to RX, Process, TX.

    A flow something along the lines of:

    One time step:
    DMA RX Data into Input Buffer #1

    Once full, DMA switches RX data to Input Buffer #2

    MCU processes Input Buffer #1 data with algorithm and creates Output Buffer #1
    - This must be done before DMA fills Input Buffer #2

    Repeatedly:
    When DMA fills current Input Buffer then:
    - Switch to RX data to new Input Buffer
    - Begin to TX current Output Buffer
    - Process current Input Buffer data to fill new Output Buffer

    The idea of Ping Pong mode is to do continuous transfers, but to be able to process any data when you are both using cont. transfer for RX/TX then you'd need to have some data that has been processed and ready to be sent out before you can TX, and that takes time.

    I think with the above method, you should in theory - if the algorithm can run before the DMA buffers fill from RX every time - be able to manipulate what you received and then continuously stream RX/TX data with the Ping Pong mode feature.

    Does that make sense and sound feasible to you?