cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0 ADC Sampling

Jerry11
Associate

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Ozone
Principal

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

View solution in original post

4 REPLIES 4
mƎALLEm
ST Employee

Hello, 

It could be due to the output impedance of your voltage source you are measuring.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Ozone
Principal

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

TDK
Super User

Probably a bug in the code. There are example projects, I suggest following those. Use DMA to convert multiple channels.

 

If you feel a post has answered your question, please click "Accept as Solution".
Karl Yamashita
Principal

Show code, upload your IOC file. 

I was told that if a devices starts to smoke, put the smoke back in. I guess I never got all the smoke because the device never worked afterwards.
Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.