0
\$\begingroup\$

I am using an STM32F303 with a 12bit ADC to read an output voltage using the ِADC itself.. as far as I know the Vref of the ADC is the same as the VDD of the device. Am I right?

However, when feeding the output of the VDD pin of the microcontroller to the ADC, it gives a value of 4043 instead of 4096. Is such an inaccuracy normal in my case?

Thank you all.

\$\endgroup\$
  • \$\begingroup\$ It's not clear what you mean by "to read an output voltage using the .." as that isn't a complete sentence, but it has a full stop (actually two). We can guess what you mean, but guesses could be wrong. Please can you improve those first two lines to make them clearer? Thanks. \$\endgroup\$ – SamGibson Aug 16 '18 at 22:25
  • \$\begingroup\$ It depends on the STM32F303. If the chip in question has 64 or less pins VREF+ = VDDA and VREF- = VSSA. In the larger packages you have separate VREF+/VREF- pins. \$\endgroup\$ – GB - AE7OO Feb 9 at 2:37
3
\$\begingroup\$

ADC errors that normally occur: -

  • Gain error typically 1% or thereabouts and this means that the digital value can be numerically 1% out so 4095 (not 4096) could be as low as 4054 or it could go the other way and saturate at 4095 with an input of 99% of VREF.
  • Zero error is also typically 1% and on some devices can accumulate with gain error meaning that at full-scale the reading could be +/-2% out. 98% of 4095 is 4013!
  • Integral non-linearity error - is something that probably isn't affecting things in this situation but it's worth reading about - what it means is that the perfect gain slope can bulge plus or minus in the middle ground by a few LSBs.
  • Dynamic non-linearity basically tells you how little or how much a single digital step could be in error but it's unlikely to be affecting you here.
  • Reference error is fairly obvious but, because you are using the input connected to the supply and the supply is set to be the reference there's nothing to worry much about here.

ADCs are not perfect.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

No, you're doing something wrong. Total unadjusted error should be within 5 or 6 counts and you are seeing 10x that.

Make sure you are respecting the test conditions, in particular in this case the internal calibration might be suspect, especially if you didn't do it. If you're multiplexing inputs a lot of other things can go wrong.

enter image description here

  1. ADC DC accuracy values are measured after internal calibration.
  2. ADC accuracy vs. negative Injection Current: Injecting negative current on any analog input pins must be avoided as this significantly reduces the accuracy of the conversion being performed on another analog input. It is recommended to add a Schottky diode (pin to ground) to analog pins which may potentially inject negative current. Any positive injection current within the limits specified for IINJ(PIN) and ΣIINJ(PIN) in Section 6.3.14 does not affect the ADC accuracy

More on the internal calibration in this presentation.

More on ADC accuracy in this document.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.