S32K3XX - DMA transfer block

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

S32K3XX - DMA transfer block

跳至解决方案
3,384 次查看
DiaDev
Contributor III

Hi,

I'm working with the S32K344 MCU and need to implement block-based data transfers via DMA from peripherals like SPI. My goal is to queue multiple blocks of data for continuous streaming without data loss, starting from the very first data block.

Requirements:

  • Wait until 20 data samples are collected

  • Trigger DMA transfer using the Tx watermark condition

Questions:

In my application, I want to wait until 20 data samples are available, and only then trigger a DMA transfer under the Tx watermark condition.

Could you please advise on:

  • How to configure this properly in S32DS?

  • Any recommended settings in DMA TCD, SPI FIFO, or interrupt configuration?

  • Whether there are any examples or best practices for queuing multiple DMA transfers for seamless streaming?

Thanks in advance for your help!

标记 (1)
0 项奖励
回复
1 解答
3,348 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @DiaDev,

This was already discussed in this thread:

https://community.nxp.com/t5/S32K/S32K3-DMA-Block-Based-Queuing-for-Continuous-Peripheral-Data/m-p/2...

The LPSPI modules have just 4x32 bit RX FIFOs.

danielmartynek_0-1749451966427.png

 

The DMA can be triggered by the LPSPI module when there are 4 words received.

The RTD SPI drivers do not use the FIFO though.

Anyway, there are these RTD examples for your reference:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-SPI-Transmit-amp-Receive-Using-Inte...

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-Continuous-SPI-Transmit-amp-Receive...

 

BR, Daniel

 

 

在原帖中查看解决方案

0 项奖励
回复
5 回复数
3,349 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @DiaDev,

This was already discussed in this thread:

https://community.nxp.com/t5/S32K/S32K3-DMA-Block-Based-Queuing-for-Continuous-Peripheral-Data/m-p/2...

The LPSPI modules have just 4x32 bit RX FIFOs.

danielmartynek_0-1749451966427.png

 

The DMA can be triggered by the LPSPI module when there are 4 words received.

The RTD SPI drivers do not use the FIFO though.

Anyway, there are these RTD examples for your reference:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-SPI-Transmit-amp-Receive-Using-Inte...

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-Continuous-SPI-Transmit-amp-Receive...

 

BR, Daniel

 

 

0 项奖励
回复
3,264 次查看
DiaDev
Contributor III
Hi @danielmartynek,
I'm working on the S32K344 platform using the LPSPI module in slave mode with DMA support. My use case is as follows:

The LPSPI slave is expected to receive 40 bytes of data per transfer.

This transfer occurs 5 times in succession, resulting in a total of 200 bytes.

I want the DMA RX interrupt (ISR) to be triggered only after all 5 transfers are complete, i.e., after the full 200 bytes have been received.

In the DMA Configuration, I have enabled:

Global Configuration
Transfer Configuration

My questions:

How can I configure the DMA (using RTD) to accumulate these 5 transfers and trigger an interrupt only after receiving the total 200 bytes?

If this is not possible, would I need to handle each 40-byte transfer individually in the DMA RX ISR and use a counter in software to detect when 5 transfers have completed? If so, how can this be implemented?

Any guidance would be greatly appreciated.

Thanks in advance!
标记 (2)
0 项奖励
回复
3,258 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @DiaDev,

This is not possible. The DMA does not have any buffer.

Although the LPSPI does have a buffer, it is just 4x32bit, and the RTD MCAL/IP SPI drivers do not use it.

You don't need to configure the DMA if you use RTD.

The SPI drivers configures the DMA - Refer to the examples I linked here.

 

BR, Daniel 

0 项奖励
回复
3,245 次查看
DiaDev
Contributor III
Then can you share me link?
0 项奖励
回复
3,221 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @DiaDev,

There are two examples linked in this thread already by me.