AnsweredAssumed Answered

9 pins of ADC with DMA2 and timer TIM2 for sampling 200kHz

Question asked by Nabila Gina Nastiti on Jun 8, 2018
Latest reply on Jun 14, 2018 by Nabila Gina Nastiti

Hello everyone,


I have 9 pins of ADC that each of them will received signal from function generator 20 kHz. I want to use ADC to store the data inside an array by using DMA2. ADC1 has 3 pins, ADC2 has 3 pins, ADC3 has 3 pins. Because the sampling for all 9 pins supposed to be done at the same time (as they are received input at the same time), therefore i use triple mode regular simultaneous. The idea is to read all 9 pins, convert them, store them in DMA2 bufer (size : 3*1000) when conversion finish, and start read from ADC1 again and repeat this. It is because i want to store all the signals at the same time from different pins.  The process stop when buffer is full.

I use TIM2 for sampling and make external trigger conversion ADC1 as master TRGO, while ADC2 and ADC3 are set to CC2. I disable DMA Access Mode as each stream of DMA2 is connected to one ADC, where stream0 for ADC1, stream2 for ADC2 and stream1 for ADC3. I set the NVIC for all DMA2 streams with preemption priority stream0 as 0, stream2 as 1, and stream1 as 2.


Could anyone help me if it is do-able or did i miss something ? I understand that it requires a very fast conversion, but i cannot use fast interleaved because i need all three ADCs. The result so far is not as expected as the conversion stored in array is not sinusoidal.


Please inform me if this problem description is not clear


Thank you


Best regards,