According to NXP document attached AN13633 it seams not possible to use DMA when ECSPI controller is used in slave mode.
This limitation has the following effects on driver:
1. In slave mode, DMA can’t be used. Instead, only PIO mode can be used. It is based on the following
considerations:
a. To use DMA mode, the burst size must be 4 byte aligned.
b. The ECSPI driver must support unaligned transfer size.
2. The burst size must be set to transfer size in PIO mode. But maximum burst size is 2^12 = 512 bytes. So
ECSPI driver can transfer maximum 512 bytes in a PIO transfer.
Note: From testing, it seems no such transfer length restriction must be added in DMA mode. So only PIO
mode has this restriction.
Anyway in the footer note it says there is no such transfer restriction, so I am wondering if DMA can be used as well with a data transfer 4 bytes aligned.
We have complete control on the slave master sending packets, so we can be compliant with the restriction to use a 4 bytes aligned transfer.
Will it be enough to have DMA transfer with ECSPI in slave mode ?
Our idea is to trigger a SMART DMA script for each SPI received packet so that a dedicated memory buffer will be filled with packed content according to an index added to the packet header to calculate the buffer offset where to copy packet data.
Thanks
Andrea
Solved! Go to Solution.
Hi @atessadri
We have not done such testing, but i think you are right, If you can fully control the transfer on the SPI master side and ensure that all data blocks are 4-byte aligned, then using DMA for ECSPI slave data reception is theoretically feasible, but the ECSPI driver may need to be appropriately modified to support DMA transfer in slave mode.
B.R
Hi @atessadri
We have not done such testing, but i think you are right, If you can fully control the transfer on the SPI master side and ensure that all data blocks are 4-byte aligned, then using DMA for ECSPI slave data reception is theoretically feasible, but the ECSPI driver may need to be appropriately modified to support DMA transfer in slave mode.
B.R