S32K3 DMA with SPI

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
6,646件の閲覧回数
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

タグ(3)
0 件の賞賛
返信
1 解決策
6,607件の閲覧回数
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 件の賞賛
返信
4 返答(返信)
3,067件の閲覧回数
LeaP
NXP Employee
NXP Employee

Hi, @cuongnguyenphu,

I am also looking at how to configure both the Master and the Slave with DMA.
I cannot find anything on this online and in the user manuals.

The only thing that works for me is when the Slave is configured to do Async Transmit with DMA, and the Master is configured Sync Transmit without DMA

But I would like both to use DMA

Is it possible?

Thank you for your help,
BR
Léa

0 件の賞賛
返信
6,587件の閲覧回数
sobo
Contributor III

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

 

 

 

0 件の賞賛
返信
6,608件の閲覧回数
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 件の賞賛
返信
3,263件の閲覧回数
MVR
Contributor V

Hello @cuongnguyenphu,

How can I use these functions with SPI defined as master mode?

Thanks,

MVR

0 件の賞賛
返信