[S32K3] DMA: Block-Based Queuing for Continuous Peripheral Data

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

[S32K3] DMA: Block-Based Queuing for Continuous Peripheral Data

跳至解决方案
1,539 次查看
DiaDev
Contributor III

Hi NXP Community,

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

Requirements:

(Wait until 20 Data are collected)--->Transfer to DMA (Tx watermark condition)

Peripheral sends continuous data (e.g.,LPUART , LPSPI).
DMA should queue and transfer blocks of fixed size (e.g., N bytes).
Support for multi-buffering or buffer rotation so that new data is not lost while the current buffer is being processed.
Questions:

In my application, I want to wait until 20 data samples are collected, and then trigger a DMA transfer under a Tx watermark condition. What’s the recommended approach using eDMA and RTD drivers on the S32K344 to achieve this kind of block-based triggering?
Can I use linked TCDs or scatter-gather with eDMA on S32K3XX for this purpose?
Any SDK-supported method to pre-load buffer queue and enable DMA without missing the first data?
Any tips, examples, or guidance on DMA queuing and buffer management using RTD would be greatly appreciated!

Thanks!

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

Hi @DiaDev,

The DMA controller does not have an internal buffer and cannot accumulate or wait for data on its own.
Instead, it transfers data immediately when it receives a signal from the corresponding peripheral.

Example: LPSPI Module
The LPSPI module includes a 4 x 32-bit RX FIFO.
If LPSPI_FCR[RXWATER] = 4, the LPSPI module will trigger a DMA request once 4 words have been received.
This means the peripheral controls when the DMA is signaled, not the DMA itself.
Each peripheral has its own way of interacting with DMA. The behavior and triggering conditions can vary significantly between modules.

In most cases, peripheral RTD drivers configure the DMA channels.
For example, in the LPSPI RTD driver, the FIFO is not used by the driver.
Instead, the DMA transfers data word by word as it is received, without waiting for the FIFO to fill.
This behavior can differ from one driver to another, so it's important to consult the specific driver implementation for details.

 

Regards,

Daniel

 

 

 

在原帖中查看解决方案

0 项奖励
回复
5 回复数
1,527 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @DiaDev,

The DMA controller does not have an internal buffer and cannot accumulate or wait for data on its own.
Instead, it transfers data immediately when it receives a signal from the corresponding peripheral.

Example: LPSPI Module
The LPSPI module includes a 4 x 32-bit RX FIFO.
If LPSPI_FCR[RXWATER] = 4, the LPSPI module will trigger a DMA request once 4 words have been received.
This means the peripheral controls when the DMA is signaled, not the DMA itself.
Each peripheral has its own way of interacting with DMA. The behavior and triggering conditions can vary significantly between modules.

In most cases, peripheral RTD drivers configure the DMA channels.
For example, in the LPSPI RTD driver, the FIFO is not used by the driver.
Instead, the DMA transfers data word by word as it is received, without waiting for the FIFO to fill.
This behavior can differ from one driver to another, so it's important to consult the specific driver implementation for details.

 

Regards,

Daniel

 

 

 

0 项奖励
回复
1,386 次查看
DiaDev
Contributor III
Hi,
I'm collecting data into arr[50] and want to transfer 20 items to DMA after they're collected (Tx watermark condition).

How should I configure the minor loop and major loop for this?

Minor loop byte size?

Major loop iteration count?

How to ensure DMA triggers only after 20 items are ready?

Thanks!
0 项奖励
回复
1,372 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @DiaDev,

I don't understand how do you collect the 20 items in arr[50]?

Do you use RTD drivers or your own SPI implementation?

0 项奖励
回复
1,350 次查看
DiaDev
Contributor III
In Config S32DS, using RTD
0 项奖励
回复
1,306 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @DiaDev,

If you use RTD, the APIs take an RX buffer as an argument and populate the buffer with RX data either using interrupts or DMA already. 

Please be more specific.