2292785_en-US

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

2292785_en-US

2292785_en-US

Periodic ADC sampling + DMA with MIMXRT533

I am using the MIMXRT533 in an application where I need to sample a signal periodically with the ADC and move that data into a buffer. I need this all to be done deterministically and without CPU intervention. Once the buffer is full I intend to trigger an interrupt to stop the ADC sampling, process the data, and prepare for the next acquisition. My current approach is as follows:

  1. SCTimer generates a 50 kHz signal on SCT0_OUT4.
  2. SCT0_OUT4 triggers the ADC to complete a conversion 
  3. The ADC FIFO0 watermark is set to 1 and the DMA request is enabled, so once a conversion is complete the DMA is triggered
  4. I need 3400 samples, so the DMA is configured with 4 linked descriptors to cover this full amount since we have a max XFERCOUNT of 1024 per descriptor
  5. The DMA is configured to accept hardware triggering and peripheral requests are turned off since the ADC does not support peripheral DMA request as per the datasheet.
  6. A DMA callback is defined which should stop the SCTimer and reset everything once the DMA reaches the end of the final linked descriptor.

Unfortunately, this does not work as expected. I get two ADC samples at each linked descriptor boundary, and zeros everywhere else. Is this because the ADC does not have a traditional DMA request line to pace the transfer? Is there any way to achieve what I am trying to do with the MIMXRT533? I assume there has to be a way to perform periodic sampling without CPU intervention, but I'm a bit stumped as to how to proceed. Any direction would be appreciated. I couldn't find anything similar to what I'm trying to do in the SDK examples. All the ADC examples there were single software triggered samples, no periodic hardware triggering.

Re: Periodic ADC sampling + DMA with MIMXRT533

Take a look at this post:
https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/RT685-CTimer0-callBack-delayed/m-p/2259801#M3583...
I've do it on a rt685.
Regards.

Re: Periodic ADC sampling + DMA with MIMXRT533

Hi @katte82,

It makes sense that the same issue happens with a similar setup on the RT685, since these two devices use the same modules than the RT533.

@npmarshall, could you try adjusting the priorities as mentioned by the linked post? Does this also provide a workaround for your issue?

BR,
Edwin.

Re: Periodic ADC sampling + DMA with MIMXRT533

I actually found a different solution for my application. Since I'm already generating a 50 kHz PWM to trigger the ADC with SCTimer SCT0_OUT4, I added an event to the SCTimer which creates a DMA request at the same time that SCT0_OUT4 goes low. By setting the INPUTMUX to send the SCT DMA request to the DMA trigger input instead of the ADC DMA request, I was able to get the buffer to fill properly with pacing set by the SCTimer instead of the ADC. The other relevant DMA settings are setting HWTRIGEN=1, TRIGTYPE=1 (Level triggering), TRIGPOL=1 (Active high). This way the SCTimer handles both triggering the ADC and telling the DMA to move data out of the FIFO after the ADC has had enough time to complete a sample conversion.

Tags (1)
No ratings
Version history
Last update:
‎01-16-2026 02:24 AM
Updated by: