This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SAR DMA sampling

I am trying to sample 2 analog channels with the SAR and push this data with the DMA to the FFT module on a 5535.  There are good examples of the touch screen and battery measurement using the SAR but I need to capture 2 analog streams at a known frequency and perform a FFT on both.  I have time to process after I capture 0.5 seconds of data so I was planning on captureing one channel and going directly to the FFT memory area and then sticking the second channel data in memory to move over after processing the first channel's FFT.  My question is how can I configure the DMA and SAR to capture two Analog inputs at 25Khz each while switching between AIN2 and AIN3?

I have already configured the SAR to sample the two inputs and capture the data into an array and that is what has brought me to this problem.  I grounded AIN2 and pulled AIN3 high then sampled them at 64Khz for 20 samples in a for loop.  The SAR is configured for a single measurement and I wait on the ADC busy before switching channels and starting the next sample, however the 64Khz is the SAR processing and doesn't include the channel switch and for loop processing time so I don't really have 32Khz sampled data of each channel.  Will the DMA allow me to perform the switch and maintain timing?

  • Hello David,

    What I understand from your application is you are trying to use GPAINS and trying to sample  the 2 channel  at different times. The SAR data output is then transferred to a buffer through DMA , and fed to FFT for further processing. 

    Yes from my understanding ,  you can enable DMA for transferring the SAR data. Since the  SAR frequency set is quite low 25Khz,  whereas the DMA has much faster processing speed (uses System clock) , there should not be issue in meeting the timing, and also SAR takes 32 SAR A/D clock periods for its conversion.

    Also When using the DMA for SAR data transfer,  You could use DMA transfer complete interrupt , once the interrupt occurs you could switch the channels and perform the necessary sampling operations.

    Hope this helps.

    Regards

     Vasanth