Part Number: AM5728
Tool/software: TI-RTOS
Hi,
I am successful with SPI loopback test with the example code given in TI. Now I am trying the same loopback test with EDMA.
Have done the necessary changes. I put
#ifdef SPI_DMA_ENABLE
if (dmaMode == true)
{
/* Set the DMA related init config */
spi_cfg.edmaHandle = MCSPIApp_edmaInit();
spi_cfg.dmaMode = TRUE;
}
else
#endif
in SPI_initConfig code.
MCSPI_Params_init(&mcSpiParams);
mcSpiParams.transferTimeout = timeout;
mcSpiParams.transferMode = SPI_MODE_CALLBACK;
chn = testChNum;
cbSem[chn] = SPI_osalCreateBlockingLock(0, &cbSemParams);
mcSpiParams.transferCallbackFxn = cbFxn[chn];
spi[chn] = MCSPI_open(instance, chn, &mcSpiParams);
txBuf[0] = 0xAAU;
memset(rxBuf, 0, MCSPI_XFER_LEN);
transaction.status= SPI_TRANSFER_STARTED;
transaction.count = MCSPI_XFER_LEN;
transaction.txBuf = &txBuf[0];
transaction.rxBuf = &rxBuf[0];
#ifdef SPI_DMA_ENABLE
if (dmaMode)
{
CacheP_wb((void *)txBuf, (int32_t)MCSPI_XFER_LEN);
CacheP_wb((void *)rxBuf, (int32_t)MCSPI_XFER_LEN);
}
#endif
retVal = MCSPI_transfer((MCSPI_Handle)spi, &transaction);
#ifdef SPI_DMA_ENABLE
if (dmaMode == true)
{
CacheP_Inv((void *)rxBuf, (int32_t)MCSPI_XFER_LEN);
}
#endif
if(cbMode == true)
{
if (multChn == true)
{
sem = cbSem[testChNum];
}
else
{
sem = cbSem[0];
}
if (SPI_osalPendLock(sem, timeout) != SemaphoreP_OK)
{
goto Err;
}
}
retVal = VerifyData((uint8_t *)&txBuf[0], &rxBuf[0], MCSPI_XFER_LEN);
But I am not getting into the callback function and once i do the MCSPI_transfer it stops and never come out to the next statements.
What exact changes I need to make to make SPI loopback test work with DMA mode. If u already have the test app with DMA kindly share it.