Hello,
For our project we would like to use DMA with SPI, I read the example :
C:\NXP\SW32K3_RTD_4.4_2.0.1\eclipse\plugins\Spi_TS_T40D34M20I1R0\examples\EBT\Spi_Transfer_S32K344
In the description the slave is used with DMA.
In configuration I see the configuration (MCL) the DMA logic channel for RX and TX.
But I don't understand how the DMA works here as we used Spi_WriteIB and Spi_ReadIB to copy and read buffer for slave.
When DMA is "triggered" and from which buffer to/from which it transfer data ?
In main.c functions
/* Copy transmitted data to internal buffer */
Spi_WriteIB(1u, TxChBuf1);
/* This sequence of slave: transferring 10 frame 16 bits using Dma */
Spi_AsyncTransmit(SpiConf_SpiSequence_SpiSequence_Slave);
/* Read received buffer with data length configured in configuration tool */
Spi_ReadIB(1u, RxChBuf1);
Sophie
Solved! Go to Solution.
Hi @sobo , sorry for late response
In this example, Channel 1 as Slave using FlexIO with DMA method:
Spi_WriteIB(1u, TxChBuf1) will be used to copy transmit data from TxChBuf1 to Internal buffer:
Then, when Spi_AsyncTransmit(SpiConf_SpiSequence_SpiSequence_Slave) is called, it will called until Flexio_Spi_Ip_AsyncTransmit(), and in this function, 2 Ip will be called to setup Dma parameter and value, then set command :
For Receive data, when using Spi_ReadIB(1u, RxChBuf1), data will be store in Rx buffer by Dma then copy to RxChBuf1:
Thank you for answer, it help me to better understand this part.
Hi @sobo , sorry for late response
In this example, Channel 1 as Slave using FlexIO with DMA method:
Spi_WriteIB(1u, TxChBuf1) will be used to copy transmit data from TxChBuf1 to Internal buffer:
Then, when Spi_AsyncTransmit(SpiConf_SpiSequence_SpiSequence_Slave) is called, it will called until Flexio_Spi_Ip_AsyncTransmit(), and in this function, 2 Ip will be called to setup Dma parameter and value, then set command :
For Receive data, when using Spi_ReadIB(1u, RxChBuf1), data will be store in Rx buffer by Dma then copy to RxChBuf1: