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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
1,418件の閲覧回数
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,405件の閲覧回数
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,406件の閲覧回数
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,265件の閲覧回数
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,251件の閲覧回数
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,229件の閲覧回数
DiaDev
Contributor III
In Config S32DS, using RTD
0 件の賞賛
返信
1,185件の閲覧回数
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.