cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring low voltages with STM8L051F3

stthormj9
Associate II
Posted on February 24, 2015 at 17:23

I have an input signal of 0.2V that I want to digitize; questions:

  1. Does the STM8L051F3 have a vref bandgap inside?  Can I use that instead of VDD?
  2. What is the least expensive chip that supports an external vref?
  3. Can someone explain how the vref bandgap is used?
Looking at the docs, it says that you can measure internal vref on an ADC channel... but wouldn't that just give you a 4096 count result (vref=vref)?

#bandgap-stm8-vref #adc-stm8
1 REPLY 1
Martin Davey
Associate III
Posted on April 27, 2015 at 12:08

Hi,

From memory.... The bandgap on the STM8 I think is outputting 1. So assuming your VDD is 3.3, 1.25V is 87% of VDD. In ADC counts this is 15 Obviously this value will then move up and down depending on supply voltage. On the STM32 there is a calibration register for the bandgap, so: adc_result = adc_meas * cal_bandgap_reg / bandgap_meas; However I am not sure it's on the STM8. So I assume a constant based on a 3.3V rail:

#define BANDGAP_REF 1550 
uint16_t adc_res; 
uint32_t tmp32; 
/* Multiply the ADC measurement by the bandgap reference. */ 
tmp32 = adc_meas * BANDGAP_REF; 
/* Divide the result by the measured bandgap value. */ 
adc_res = tmp32 / adc_bandgap;

Cheers, Martin.