5
\$\begingroup\$

I'm using STM32 F7 46 (reference manual) and I'm a bit confused about ADC and reference voltage (VREF).

If I connect 2.5V to the VREF and 3.3 to AVDD, then what is the range of ADC measurement?

  1. Is ADC range from 0V to 2.5V?

  2. Or is 2.5V used to calibrate ADC reference (AVDD) and then range will be from 0V to 3.3V (=calibrated AVDD)?

I know that on AVR, (1) is correct, but I'm confused about STM32.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Nothing changes. For all of the ADCs on the planet, the measurement is from Vref- to Vref+. For your MCU, Vref- is GND and Vref+ is VREF. For some of the ADC chips, +Vref is shorted to VDD internally but is not in your case. \$\endgroup\$ Commented May 16, 2017 at 11:14

2 Answers 2

4
\$\begingroup\$

If your reference voltage is 2.5V, and you supply 2.5V to an input then your ADC (assuming 16-bit resolution and single-ended measurement against GND) should return exactly 65535, so the range is limited by the reference voltage.

There is at least one "trick". For example you can measure Vdd (eg. to figure out the battery voltage the MCU is running from) - you configure the ADC to use AVDD as the reference and measure internal bandgap reference against it.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ "you configure the ADC to use AVDD as the reference" so I can switch between VREF and AVDD as a reference for the ADC? I know how to do this on AVR, but couldn't find this option in STM32? Do you know how to do this? \$\endgroup\$
    – zupazt3
    Commented May 16, 2017 at 11:45
  • 1
    \$\begingroup\$ Moving from an AVR to a Cortex-M7 can be a shocker. You could select the voltage reference in AVR between internal, external and AVcc. On almost every ARM it should also be possible. I've looked at the linked reference manual, but I can't even find how to select an input channel. In STM32L011 the regiter is called ADC_CHSELR, but I can't find anything like that in the reference manual. If this is a very new part then it can take some time before the manual and datasheet "stabilize". \$\endgroup\$
    – filo
    Commented May 16, 2017 at 14:12
  • 1
    \$\begingroup\$ Well I use HAL to write programs, so channel is selected with "adcChannel.Channel = ADC_CHANNEL_11;", but I also don't see this in registry description. But I would not be so sure that you can select reference value, as I also don't see such field in HAL... \$\endgroup\$
    – zupazt3
    Commented May 16, 2017 at 16:41
1
\$\begingroup\$

I understood that the reference voltage is always VREF+ (the other one, if the pin is available, has to be tied to VSSA. The VREF+ can be then anything between 1.8V and VDDA. Depends on where you tie the VREF+ to. Configured with solder. :-) In some packages the VREF+ and VREF- do not come outside the chip at all. I guess they are internally tied to VDDA and VSSA.

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