hi
For the M4 core of i.MX8M Mini, using the ECSPI peripheral with SDMA to read data at a rate of 32 Mbps (the datasheet says the maximum ECSPI rate is 52 Mbps), the example used is "SDK_2.5.0/boards/evkmimx8mm/cmsis_driver_examples/ecspi/sdma_loopback_transfer". However, this example reinitializes both SPI and DMA for each data read, wasting a lot of time. Which functions and statements do not need to be reinitialized in the ECSPI_MasterTransferSDMA function? Also, I have increased the clock frequency, but the issue remains the same.now my code below:
void main(void)
{
...
}
attach source code
Hello @sofia_0571
Hope you are doing very well.
You can try instead of bypassing the setup using a flag inside the function, keep ECSPI_MasterTransferSDMA purely for your high-speed loop by stripping out the heavy lifting. Create a "Fast Trigger" function that assumes preparation is already complete.
Something like:
status_t ECSPI_MasterTransferSDMA_FastTrigger(ECSPI_Type *base, ecspi_sdma_handle_t *handle, uint32_t size)
{
handle->state = kECSPI_Busy;
xferConfig.dataSize = size;
xferConfig2.dataSize = size;
SDMA_SubmitTransfer(handle->txSdmaHandle, &xferConfig);
SDMA_SubmitTransfer(handle->rxSdmaHandle, &xferConfig2);
handle->rxInProgress = true;
SDMA_StartTransfer(handle->rxSdmaHandle);
ECSPI_EnableDMA(base, kECSPI_RxDmaEnable, true);
handle->txInProgress = true;
SDMA_StartTransfer(handle->txSdmaHandle);
ECSPI_EnableDMA(base, kECSPI_TxDmaEnable, true);
return kStatus_Success;
}
Best regards,
Salas.