2017-02-13 03:31 AM
Hi,
I am trying to use the ADC on STM32L151, the external pin VREF+ is 'not connected' in my design, instead I would like to use the VREFINT (internal reference voltage). The datasheet states: 'VREFINT is internally connected to the ADC_IN17 input channel. It enables accurate monitoring of the VDD value (when no external voltage, VREF+, is available for ADC).'
My questions:
1) Is it possible to use the VREFINT on packages that do have VREF+ pin?
2) If so- what should I configure in my code to enable this?
Thanks
#stm32 #stm32l151 #vrefint #vref #internal-reference-voltage #adc2017-02-13 01:19 PM
You misunderstand the purpose of VREFINT. It is *not* a reference to the ADC, against which the ADC compares the input. It's simply a (more or less) precise and stable 1.2V voltage source, which can be measured by the ADC on channel 17, so that you an calibrate a potentially less precise external reference connected to VREF+ (which at packages where it's not available is internally connected to VDDA).
It means, that you *must not* leave VREF+ unconnected, as there's no internal voltage source to it. Even if VREFINT can be output onto certain GPIO pins, it's unsuitable to be looped back to VREF+, as it's 1.2V and VREF+ cannot be that low. Read the datasheet for constraints on VREF+ voltage with regard to VDDA and desired conversion speed.
In case of omission, it's easy to connect VREF+ to VDDA, as they are located on neighbouring pins (on BGA packages, it's on neighbouring balls, but the fix may not be that easy than with other packages).
Similarly, you *must* connect VREF- to VSSA.
JW