-->
Page 2 of 2

Re: Dual use of ADC; TOUT pin and measure Vcc

PostPosted: Thu Sep 28, 2017 9:28 am
by eriksl
Also the quality of the ADC is very poor (because it needs to be used for WLAN as well). So better attach an external ADC (over I2C for example).

Re: Dual use of ADC; TOUT pin and measure Vcc

PostPosted: Wed Oct 04, 2017 10:30 pm
by flukee
schufti wrote:If you read the datasheet, you'll see that for measuring vcc the pin has to be floating (no external circuitry), so no use of changing mode 'on the fly'


The OP specifies the use of an external switchable component to float the pin. This change should be possible during runtime, at worst through a reset.

Re: Dual use of ADC; TOUT pin and measure Vcc

PostPosted: Fri Oct 06, 2017 5:19 am
by schufti
ok, so he could try to directly use sdk functions
system_adc_read
and
system_get_vdd33
and see how far this works / influences the further operation.

AFAIK this "preselection" ( ADC_MODE(ADC_VCC) ) determines if the esp_init_data[107]:vdd33_const is set to 255 (automatic Vdd measurement) or 33 (best guess value if A0 used external) for the binary.

Unfortunately the ESP8266 Non-OS SDK API Reference V2.1.1 has non clear notes regarding vdd33_const: In some note is only required to be 255 for reading Vdd or the "Vdd" replacement value instead for A0 use.
In other note it says if vdd33_const=255 A0 cannot work as ADC input.
So having 255 to initially measure Vdd and later call system_adc_read() to read A0 will probably not work.
Thats what most likely caused the later implementation of ADC_MODE(ADC_VCC), I think they had direct implementations of the sdk functions in the beginning.