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:
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.
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.
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.
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.