Why ADC isn't correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-19 4:51 PM
I'm trying to use ADC in stm32g030j6m6 to measure DC voltage.
but, whenever I try to make experiences. I found out that under 3V, The accuracy of adc isn't great. It has a 10% error.
​
I attached source code that I used in my experience and the table that I get from a experience.
please answer me, which part I have to change or fix to get a accurate ADC values
- Labels:
-
ADC
-
STM32G0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-19 10:22 PM
> but, whenever I try to make experiences. I found out that under 3V, The accuracy of adc isn't great. It has a 10% error.
How did you evaluate this ?
With inappropriate hardware, you can easily introduce such large errors.
Or with too short sample times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-19 11:07 PM
I used DC source power to measure the ADC, and The Large errors only occurs when the voltage is under around 2V.
The source code was written referring to the example provided in stm32CubeIDE.
so I used the sampling times exactly same compare to example code.
If you can see the source code that I attached, maybe I think you can find which line is wrong.
could you do it for me?
​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-20 1:23 AM
Hello,
From what I can see, you are using the F0 HAL library for a G0 MCU.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-20 1:34 AM
I don't do Cube/Hal.
However, Mike_ST's objection of using the wrong package is probably valid.
Other things in the source that stood out:
A sample time of 5 cycles (ADC_SAMPLETIME_1CYCLE_5) is very short. Do you understand the working principle of a SAR-ADC ?
Better try with a 3-digits sample time.
The G030 is basically a M0/M0+ core, I would avoid floating point if not absolutely necessary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-20 3:36 AM
It's even worse - not 5 but 1,5 cycles. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-20 3:53 AM
Well, ok. Didn't know it does actually go so low.
Cycle-by-cycle control (motor, converter) at 1Msps or more use to ask for that.
