Timestamping DMA done event - QTMR triggered by DMA done

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Timestamping DMA done event - QTMR triggered by DMA done

362 Views
alonbl
Contributor III

Hello,

I would like to sample the exact time of a DMA done event so I can record it in the DMA callback in RT-117x.

I thought of using QTMR to be triggered by the DMA done and start counting in kQTMR_SecSrcTrigPriCnt mode.

There was a similar question in [1] and no response, I hope someone may help.

 

Q1: What is the best method to capture and timestamp DMA done event in hardware?

 

Q2: Is it possible to use the QTMR to achieve this goal? or the following does not do what I would like to think it does:

XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputDmaDone0, kXBARA1_OutputQtimer1Timer0);

 

Q3: What is the mapping between the kXBARA1_InputDmaDone0 and the actual DMA channels? There are only 8 channels in the kXBARA1_InputDmaDoneX while there are more channels in DMA.

 

So far I could not get the timer to run as I am unsure what is the mapping of the DMA channel and the XBARA.

 

Thanks,

 

[1] https://community.nxp.com/t5/i-MX-RT/Route-DMA-Done-signal-through-XBAR1/m-p/1395724

 

Tags (3)
0 Kudos
2 Replies

299 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @alonbl,

Q1: I believe the best method to capture this time would be by routing the done signal outside of the MCU and measuring the time this way. This is because, by nature, both the DMA and the XBAR are meant to function independently of the MCU core. Using the MCU's interruptions/callbacks to measure this might therefore result in lower performance as well as inaccurate measures.

Q2: Yes, a timer could provide some measure of interval between DMA done flag assertions, but the method you are using is not adequate. There should be no need to use XBAR when using a counter. Simply using the DMA callbacks to set and stop the timer is a much more efficient.

Q3: There indeed are more channels in the DMA than just 8, but the DMA_DONEx XBAR inputs do not correspond to each of the DMA channels, but rather they correspond to the four DMA_CH_MUX_REQxx outputs of XBARA and the four outputs DMA_CH_MUX_REQxx of XBARB. This is why there's only 8 DMA XBAR inputs (one for each DMA XBAR output).

BR,
Edwin.

0 Kudos

294 Views
alonbl
Contributor III

Hello @EdwinHz ,

 

Thank you so much for assisting me.

 

I would like to avoid measuring the time in the DMA callback as I do not know (deterministic and final) how much time passed since the DMA done even and the time the callback is called.

This is why I am looking for a solution which is MCU independent.

 

I will explain the use case... I have a device which feeds the DMA with bytes (aka receive), the structure of TCDs is determine by the software, the DMA is asynchronous by nature the device is not aware of the TCD allocation. At the DMA callback I need to know exactly when the DMA interrupted the CPU to timestamp the buffer referred by the last TCD. As the device itself is not aware of the DMA nor the TCD structure it cannot assist in this timing.

 

I thought of having the DMA done hardware timestamped somehow, I am using the GPT to timestamp other sources using capture signal, however, I could not find how to integrate the DMA done into the GPT.

 

The only clue I found is the TMR ability to capture DMA done, so I started to look into this solution. I thought that once the DMA done will be issued it will trigger the TMR which will start counting. Isn't this the case? Why do you say it will not be accurate?

 

Maybe the TMR is not the right mechanism to timestamp the DMA without the MCU synchronous code, is there other mechanism to capture DMA done except of TMR?

 

Thanks,

 

0 Kudos