S32K312 LPSPI + DMA AsyncTransmitFast

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K312 LPSPI + DMA AsyncTransmitFast

3,176 次查看
txp_camel
Contributor I

My SPI synchronization and SPI+DMA asynchronous functions have been verified and debugged.
Now it is necessary to reduce the read and write time of SPI by issuing read and write instructions multiple times in one task and reading data in the next task.
This will use the Lpspi_ip_Asynchronous TransmitFast interface. But when I was configuring the Lpspi_ic_Asynchronous TransmitFast function, I found that calling this interface would cause the entire SPI to be in a blocked state. May I ask if there are any official demos or other related manuals that can be referenced.

0 项奖励
回复
8 回复数

3,099 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

as far as I know no demo exists for this. The driver's UM shows steps and example how to use this API in chapter 6.2.5.7 Lpspi_Ip_AsyncTransmitFast(), similar info is given in the comment above Lpspi_Ip_AsyncTransmitFast() in Lpspi_Ip.h

BR, Petr

0 项奖励
回复

3,077 次查看
txp_camel
Contributor I

Hi,

Thank you for your reply.

I have two more questions now:

The first question is:

txp_camel_0-1723020970471.png

As indicated in the recommended configuration, I configured ScatterGathers configuration for three Tx channels and two Rx channels, and set SpiPhyUnit/SpiMaxDmaFastTransfer to 2. However, S32DS keeps reporting errors and prompts the following message.

txp_camel_1-1723021176124.png

I had to configure the ScatterGathers configuration for the Tx channel to four in order for S32DS to not report any errors.

 

The second question is:
Now when I am debugging the Lpspi_ic_Asynchronous TransmitFast() interface, the Dma and Spi interrupts of Tx can be triggered normally, but the Dma and Spi interrupts of Rx cannot be triggered. After calling the Lpspi_Ip_TxDmaFinishTransfer() interface from the Tx IRQ of the SPI, the Rx interrupt cannot be triggered, and then the SPI will remain in the Busy state.
I compared the Tx and Rx channels of Spi+Dma and found that their configuration structures are roughly consistent.
Below is detailed configuration information.
txp_camel_2-1723021559518.pngtxp_camel_3-1723021571624.pngtxp_camel_4-1723021604841.pngtxp_camel_5-1723021626978.pngtxp_camel_6-1723021638394.pngtxp_camel_7-1723021646925.pngtxp_camel_8-1723021660682.pngtxp_camel_9-1723021686034.png

 

All transmission length configurations are set to 8

txp_camel_10-1723021728383.png

 

The global configuration is the same

txp_camel_11-1723021756291.png

 

 

 

 

 

 

 

 

 

 

0 项奖励
回复

3,073 次查看
txp_camel
Contributor I

The following is the configuration when I call the Lpspi_ic_Asynchronous TransmitFast() interface

txp_camel_0-1723022127143.png

 

0 项奖励
回复

3,045 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

not sure for first one, it looks like some error message related to MCAL driver, no jobs are set in IP level setting.
For a second one, try to have Rx DMA ISR priority level higher than Tx DMA ISR.

BR, Petr

0 项奖励
回复

3,019 次查看
txp_camel
Contributor I

Hi,
Thank you for your reply.
I tried to set the priority of DMA Rx to the highest among all ISR. However, DMA Rx ISR still cannot be triggered.

txp_camel_1-1723170252774.png

But when I don't call the Lpspi_ip_Asynchronous TransmitFast() interface and instead call the Lpspi_ip_Asynchronous Transmit() interface, the DMA Rx ISR can be triggered normally

txp_camel_2-1723170270532.png

The following is the program stack when the Lpspi_ic_Asynchronous Transmit() interface is called normally

txp_camel_3-1723170372998.png

DMA0_CH0 is the ISR of DMA Tx channel

DMA0_CH1 is the ISR of DMA Rx channel

And the ISR processing function corresponding to SPI is also called normally

0 项奖励
回复

2,988 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

let me check with RTD team.

BR, Petr

0 项奖励
回复

2,789 次查看
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Here is the answer from RTD team:

 

I have a S32K344 SPI fast transfer demo with RTD 4.0.0 (MCAL layer). Please check the attachment.

According to your description(in SPI IP layer driver), the actual required number of DMA scatter/gather elements should be:

  • 4 TX, 2*(TCR + TDR)
  • 2 RX, for 2 RX transfer
  • SpiMaxDmaFastTransfer=2;

Note that the above calculation method is not applicable to the MCAL layer driver.

Best regards,

Peter

0 项奖励
回复

2,806 次查看
txp_camel
Contributor I

Hi,

Has there been any progress on this inspection?

Look forward to your reply.

BR

0 项奖励
回复