-->
Page 1 of 2

Dual use of ADC; TOUT pin and measure Vcc

PostPosted: Wed Jul 26, 2017 3:26 pm
by flukee
Hi all.
ESP8266 library reference says:
Note that by default ADC is configured to read from TOUT pin using analogRead(A0), and ESP.getVCC() is not available.

and
Add the following line to the top of your sketch to use getVcc: ADC_MODE(ADC_VCC);


I want to know if anyone has been able to switch between TOUT pin and VCC modes of operation, in the one sketch. It seems like you choose one or the other, but can't have both.

In my application I have a MUX supplying the TOUT pin, which can be 'disconnected' to satisfy the requirement for leaving the TOUT pin free when taking Vcc measurements.

But it seems as though the ADC mode becomes 'locked in' at compile-time. Has anyone had success, or got a hack to use ADC to read VCC, and the TOUT pin? Ideas I have:
- an example hack that I think is unsuitable is to OTA a different firmware, read the VCC, then OTA initial firmware - sounds ridiculous
- can I use the firmware to modify the Flash binary to change the ADC mode, then reset? (a slightly better idea but still sounds dodgy)

Anyone done this?
Thanks

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

PostPosted: Sun Aug 13, 2017 11:27 am
by rudy
I would like to do the same thing. Anyone have more information?

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

PostPosted: Sun Aug 13, 2017 12:59 pm
by schufti
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'

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

PostPosted: Sun Aug 13, 2017 1:24 pm
by rudy
The English used on the data sheet is very poor and the amount of information is meager.