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.

DMA SPI TX Interrupt executed before SPI is done transmitting packets

HI,

I'm having an issue where the DMA TX interrupt is firing before the SPI transmit is complete. Any ideas what could be causing this? I put in a check for SSI busy to solve the issue but should my issue even exist?

I enabled my DMA interrupt as follows:

ROM_SSIIntEnable(SSI0_BASE, SSI_DMATX);

The test interrupt handler is below:

void SSI0IntHandler(void)
{
	uint32_t ui32Status;

	ui32Status = ROM_SSIIntStatus(SSI0_BASE, 1);

	ROM_SSIIntClear(SSI0_BASE, ui32Status);

	if (ui32Status == SSI_DMATX)
	{
		UARTprintf("TX Ready\n");

		if (SSIBusy(SSI0_BASE) == false) {
			ROM_uDMAChannelTransferSet(UDMA_CHANNEL_SSI0TX | UDMA_PRI_SELECT,
														   UDMA_MODE_BASIC, g_ui8SSITxBuf,
														   (void *)(SSI0_BASE + SSI_O_DR),
														   sizeof(g_ui8SSITxBuf));
			ROM_uDMAChannelEnable(UDMA_CHANNEL_SSI0TX);
		}
	}
}

Thank you,

Daniel

  • Hi CaliDanMan,

    The DMA transfer interrupt generates the interrupt when the DMA transfer to the SSI FIFO is complete. So if you need a interrupt when the SSI is done transmiting you need a End of transmission interrupt

  • Thank you for the reply. With the following test code, i'm measuring 3us to setup DMA and start the next SPI transaction. I'm very happy with the results. 

    void SSI0IntHandler(void)
    {
    	uint32_t ui32Status;
    
    	ui32Status = ROM_SSIIntStatus(SSI0_BASE, 1);
    
    	ROM_SSIIntClear(SSI0_BASE, ui32Status);
    
    	if (ui32Status == SSI_TXEOT)
    	{
    		ROM_uDMAChannelTransferSet(UDMA_CHANNEL_SSI0TX | UDMA_PRI_SELECT,
    													   UDMA_MODE_BASIC, g_ui8SSITxBuf,
    													   (void *)(SSI0_BASE + SSI_O_DR),
    													   sizeof(g_ui8SSITxBuf));
    		ROM_uDMAChannelEnable(UDMA_CHANNEL_SSI0TX);
    	}
    }

  • Glad it's working now