AnsweredAssumed Answered

Change SPI example code to DMA

Question asked by fivelines on Mar 12, 2015
Latest reply on Aug 27, 2015 by gprasad

How do I change the example code to use non-blocking DMA mode for SPI?  I can change the EnableDmaMode to true.  How do I set up the DMA?  Also, is there a flag to indicate when the DMA is done the transfer?

 

    adi_spi_Open(0, spiMemory, ADI_SPI_DMA_MEMORY_SIZE *2, &spiHandle);

    adi_spi_SetMaster(spiHandle, true);

    adi_spi_SetHwSlaveSelect(spiHandle, false);

    adi_spi_SetTransmitUnderflow(spiHandle, true);

    adi_spi_SetClock(spiHandle, 4ul - 1ul);

    adi_spi_SetClockPhase(spiHandle, false);

    adi_spi_SetSlaveSelect(spiHandle, ADI_SPI_SSEL_ENABLE1);

    adi_spi_SetWordSize(spiHandle, ADI_SPI_TRANSFER_8BIT);

    adi_spi_SetTxWatermark(spiHandle, ADI_SPI_WATERMARK_50, ADI_SPI_WATERMARK_DISABLE, ADI_SPI_WATERMARK_DISABLE);

    adi_spi_SetRxWatermark(spiHandle, ADI_SPI_WATERMARK_50, ADI_SPI_WATERMARK_DISABLE, ADI_SPI_WATERMARK_DISABLE);

    adi_spi_RegisterCallback(spiHandle, NULL, NULL);

    adi_spi_EnableDmaMode(spiHandle, false);

Outcomes