5
\$\begingroup\$

There seems to be a badgap voltage reference built-in in the STM32F1 microcontrollers (on ADCx_IN17).

Coming from AVRs it seems to me very strange that it's not possible to use this reference as the ADC VREF, at least I think it's impossible. Am I right ? Why is it there than ?

\$\endgroup\$
7
  • \$\begingroup\$ What's your problem exactly? Why do you think that it's impossible to use it? your question is not clear. \$\endgroup\$
    – Roh
    Commented Jul 19, 2014 at 10:36
  • \$\begingroup\$ Have you read the ADC section in the reference manual? \$\endgroup\$ Commented Jul 19, 2014 at 11:04
  • 2
    \$\begingroup\$ I have read the reference manual. It doesn't say anything about the internal reference except it's mapped to ADCx_IN17. I haven't found any other reference to it in the manual. Even the registers don't show any way of using it as the ADC VREF. So I'm led to believe it's not possible to use the internal reference as ADC VREF. Am I right ? Why did they include the internal reference than ? \$\endgroup\$
    – Mike
    Commented Jul 19, 2014 at 11:14
  • \$\begingroup\$ Please put a link to the reference manual that you said and please tell us the date of your reference manual. mine is October 2011. \$\endgroup\$
    – Roh
    Commented Jul 19, 2014 at 11:22
  • \$\begingroup\$ Mine is from June 2014, its RM0008, it's the latest as far as i know. - link: st.com/web/en/resource/technical/document/reference_manual/… Page 218 and page 234, Just show that there is an internal bandgap which I can measure, but no where does it states that I can connect this reference to be "VREF". \$\endgroup\$
    – Mike
    Commented Jul 19, 2014 at 11:55

3 Answers 3

5
\$\begingroup\$

It is possible to use the internal reference, albeit indirectly. You measure it using the Vdd, and then measure the external voltage you are interested in, using the same Vdd as ADC reference. You can then calculate what the supply must be, knowing Vref and the counts it gave. Then you know more accurately what the ADC is using, and can calculate the external channel voltage you want. The assumption here is that Vdd does not move much between the two readings. If this is a concern, measure Vref before and after measuring the channel with your data on, and use an average. For battery operated systems, this gives you the battery voltage as well, which is probably of interest. This is not as accurate as an external precision reference, but is cheaper, uses less power and does not tie up extra pins...

\$\endgroup\$
4
\$\begingroup\$

I also find it annoying that I cannot use the internal reference for VREF+. It is extra annoying on smaller pin packages that DO NOT have an external VREF+ input pin. You have to use the MCU's VDD input voltage as your reference. VDD is generally not a very precision voltage so do not expect the best accuracy without a CAL routine. I have also done battery operated systems where VDD comes straight from the battery so that makes using it a real pain.

Microchip PIC's do allow you to use the internal reference for the ADC and some even allow you to divide it by 2 or 4, so it certainly can be done. Hopefully ST will add this feature soon.

\$\endgroup\$
1
  • \$\begingroup\$ Correct. So generally try to use a 1% regulator with your STM, and don't load it with a high current PWM, that way you get the best precision. When directly powered by a battery, the indirect measurements needed will never have a high accuracy. It sucks. Measuring an external reference instead won't improve this much. \$\endgroup\$
    – user103185
    Commented Oct 7, 2022 at 9:00
2
\$\begingroup\$

from figure 22, page 216

enter image description here

Shows that it isn't connected.

My educated guess here is that while they may have a band-gap they don't have a precision regulated power supply. They are very different things, with the power supply requiring a precision reference (like a band-gap). You have to supply a low impedance, low noise, high PSRR block that burns power. Also band-gaps are lower voltage devices, this power supply is close to the rails. It's safer to put the pins on the outside. And it would probably be lower noise on chip.

What you do, is you provide a stable clean external power on those pins and you use the internal Vref to calibrate your ADC for manufacturing tolerances.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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