2025-07-08 12:12 AM
Configure STM32G0 to sample 11 channels; When voltage is injected into only one channel each time, the sampling values of all channels are correct. When voltage is injected into 11 channels simultaneously, the sampling values of all channels are incorrect and random values are displayed. Could someone help me explain the reason for this problem and how I should configure it? Thank you.
Solved! Go to Solution.
2025-07-08 2:10 AM
> ... and how I should configure it?
You did not reveal much how did you configure the channels right now.
I would not exclude an issue with the code to pick up the ADC results, being it by interrupt/callback or DMA.
Inproper ADC configuration can cause such issues as well.
The input stage, consisting of S&H capacitor and effective input resistance, forms an RC element.
This RC element is consecutively switched to all input channels, charged for the configured time, and then converted.
You need to take care that your input circuitry can charge/discharge this element in the required time.
And besides the actual sampling time (in ADC clock cycles), most STM32 ADC have a configurable delay between consecutive samples.
Try increasing both.
2025-07-08 1:51 AM
Hello,
It could be due to the output impedance of your voltage source you are measuring.
2025-07-08 2:10 AM
> ... and how I should configure it?
You did not reveal much how did you configure the channels right now.
I would not exclude an issue with the code to pick up the ADC results, being it by interrupt/callback or DMA.
Inproper ADC configuration can cause such issues as well.
The input stage, consisting of S&H capacitor and effective input resistance, forms an RC element.
This RC element is consecutively switched to all input channels, charged for the configured time, and then converted.
You need to take care that your input circuitry can charge/discharge this element in the required time.
And besides the actual sampling time (in ADC clock cycles), most STM32 ADC have a configurable delay between consecutive samples.
Try increasing both.
2025-07-08 7:39 AM
Probably a bug in the code. There are example projects, I suggest following those. Use DMA to convert multiple channels.
2025-07-08 8:55 AM
Show code, upload your IOC file.