Conflict between ADC2 and Wifi

FoxHole
Posts: 1
Joined: Fri Oct 12, 2018 11:12 pm

Conflict between ADC2 and Wifi

Postby FoxHole » Fri Oct 12, 2018 11:48 pm

Hi all,

After a few hours of research, I was finally able to isolate my strange problem.
In the code below, if I uncomment the lines concerning wifi, the analog input A10 (GPIO4) always reports 4095.

Code: Select all

#include <Arduino.h>
#include <WiFi.h>

void setup() {
	Serial.begin(115200); 
	pinMode(A10, INPUT_PULLDOWN);

	/* Lines to uncomment to create the problem.
	WiFi.mode(WIFI_STA); 
	WiFi.disconnect();*/
}
void loop() {
	int analog = analogRead(A10);
	Serial.println(analog, DEC);
}
I finally found here(https://github.com/espressif/arduino-esp32/issues) and here (https://desire.giesecke.tk/index.php/20 ... is-in-use/) that adc2 channel could not be used while wifi was in use. I didn't have the time to check yet but I hope adc1 will work correctly (thanks for your advices on that matter)

That said, I don't really understand 2 points :
  • You will see in my code that I want to disconnect the wifi => Why does the conflict still exist (Note : Actually after that, I want to use esp_now protocol, which may create the conflict anyway, I don't know)
  • As the ESP product range has been mainly designed to be used with Wifi, Why Espressif does not communicate more on that issue and/or write it in big somewhere. ?
One problem remains for me : if only adc1 remains, that gives me "only" 6 Analog inputs available. I may need 2 more. Is there a fix planned for this problem ? Or may be a turn around ?

And is there a guide somewhere telling precisely which GPIO, ADC ... you can use in which configuration (if possible, I would like to avoid this waste of time in the future) ?

Thanks in advance for all your help and advices.

Antoine

User avatar
ESP_krzychb
Posts: 394
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: Conflict between ADC2 and Wifi

Postby ESP_krzychb » Sat Oct 13, 2018 2:08 am

FoxHole wrote:And is there a guide somewhere telling precisely which GPIO, ADC ... you can use in which configuration (if possible, I would like to avoid this waste of time in the future) ?
Hi Antoine,
This is documented in Analog to Digital Converter section of the ESP32 Programming Guide. If you are interested in use of other (not ADC related) GPIOs then also check GPIO & RTC GPIO section of the same guide. To discuss Arduino code please post directly in ESP32 Arduino section of this forum.

Who is online

Users browsing this forum: No registered users and 133 guests