2019-06-07 4:09 AM
I am currenctly working on STM32L052K6T6.
I would like to know if there is an appropriate way to measure precisely the voltage used by the adc.
I read through the documentation that this voltage was on adc_channel17 but i have no idea of to get it.
I also read there was a calibration Variable called VREFINT_CAL but again i did'nt see the process to use it properly.
I know this voltage is for me aroun 1.8V. But i need to know it untill 1.80000 at least to calculate accurate values of my sensor. Here is attached to this all the data i found untill now that could be useful. And the MCU is powered by a battery with a voltage of 3.7V<V<4.2V.
2019-06-07 4:47 AM
Generally, after performing everything needed to start a conversion (including ADC calibration), you
> MCU is powered by a battery with a voltage of 3.7V<V<4.2V
This violates the operating conditions (maximum VDD and VDDA is 3.6V), and at the upper range, even the absolute maximums (which is 4.0V). Don't be surprised if your mcu fails.
JW
2019-06-07 5:21 AM
Thank you for your answer.
I did what you adviced me and i had:
This gave me VDDA = 1.75720...
This is close to 1.8V but i don't think it is the correct voltage.
Indeed, i tried to configure the adc on channel 1 and put a voltage generator at 1.8004V ( Value measured with an oscilloscope) on the ADC. And the ADC (configured on 16 bits) gave me 65520 close to the maximum. So it means that the voltage that the ADC is using must be close to 1.8V, even a bit higher i think and not 1.75720V.
Btw the MCU is not powered with 3.7V there is a voltage adaptation after battery, i got confused on my writting.
2019-06-07 7:42 AM
If you haven't done so yet, I recommend you read Section 14.9 in the STM32L0x2 Reference Manual to understand the difference between VDDA and VREFINT.
It might also be useful to read the STM32L052 Data Sheet on ADC accuracy. While 256 oversamples will reduce noise, the accuracy is still approximately 12 bits.
Cheers, Hal