cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8T6 ADC1 + DMA reading gets corrupted when starting ADC2 conversion.

DBern.7
Associate II

Hi,

I'm almost new to the STM32 and have the following question:

I'm triggering multichannel ADC1 conversions using timer 1 and storing the readings in a buffer using the DMA. It works fine until I configure ADC2 (which doesn't support DMA) to be triggered by timer 2. The sole addition of HAL_ADC_Start(&hadc2); or HAL_ADC_Start_IT(&hadc2); at the beginning of the code causes corrupted readings from ADC1+DMA. What am I doing wrong? Is it possible to trigger other ADCs while using DMA with another channel?

Thanks in advance

4 REPLIES 4
TDK
Guru

Yes it's possible. Could be overloading DMA, what is your sample rate? What does "corrupted" mean exactly?

If you feel a post has answered your question, please click "Accept as Solution".
DBern.7
Associate II

Hi, TDK

Thank you for the answer, The readings go from:

0693W00000JObm6QAD.png 

to 0693W00000JObkeQAD.pngonly by adding HAL_ADC_Start(&hadc2);

the sample is triggered in the second event of a capture compare running at 20Khz, so I suppose the sample rate is 10Khz

Thanks in advance

Hi, TDK

Thank you for the answer, The readings go from:

0693W00000JObqmQAD.pngto

 0693W00000JObrLQAT.pngonly by adding HAL_ADC_Start(&hadc2);

the sample is triggered in the second event of a capture compare running at 20Khz, so I suppose the sample rate is 10Khz

Thanks in advance

DBern.7
Associate II

Changing DMA to Half Word and, consequently, the buffer data type to 16 bits did the trick. Still don't know why Thanks!