S32K3 DMA with SPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K3 DMA with SPI

Jump to solution
3,074 Views
sobo
Contributor III

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

Tags (3)
0 Kudos
Reply
1 Solution
3,035 Views
cuongnguyenphu
NXP Employee
NXP Employee

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:

cuongnguyenphu_0-1661841926688.png


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 :

cuongnguyenphu_2-1661842161604.png

For Receive data, when using Spi_ReadIB(1u, RxChBuf1), data will be store in Rx buffer by Dma then copy to RxChBuf1:

cuongnguyenphu_0-1661842818895.png

 

 

 

View solution in original post

0 Kudos
Reply
2 Replies
3,015 Views
sobo
Contributor III

Thank you for answer, it help me to better understand this part.

 

 

 

0 Kudos
Reply
3,036 Views
cuongnguyenphu
NXP Employee
NXP Employee

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:

cuongnguyenphu_0-1661841926688.png


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 :

cuongnguyenphu_2-1661842161604.png

For Receive data, when using Spi_ReadIB(1u, RxChBuf1), data will be store in Rx buffer by Dma then copy to RxChBuf1:

cuongnguyenphu_0-1661842818895.png

 

 

 

0 Kudos
Reply