1
\$\begingroup\$

I am trying to design a PCB with ESP32 and a Lora module I want to use serial1 for Lora RX/TX communications. I saw a board which is using GPI35 to Lora RX and GPIO25 to Lora TX. But in same time generally I am appearing that note also:

Note: ADC2 pins cannot be used when Wi-Fi is used. So, if you’re using Wi-Fi and you’re having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1 GPIO instead. That should solve your problem.

well if I check GPIO25 is adc1 or adc2 there two different pinout.

pinout1 wrover it says 25 is adc1

enter image description here

pinout2 Wroom and it says 25 is adc2

enter image description here

So I am not sure GPIO25 is ADC1 or ADC2? who can tell the true story of GPIO25? More importantly, if I use GPIO25 as tx, will it be a problem when wifi is on, referring to the above note?

and this is my ESP32

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ what do the datasheets say? \$\endgroup\$
    – jsotola
    Mar 19, 2022 at 20:14
  • 1
    \$\begingroup\$ The ADCs play no role whatsoever here. They are one of many peripherals to which pins can be routed. When you're using the pin for another function, like I2C, SPI, UART or GPIO, you can ignore any and all aspects or limitations of the ADCs. \$\endgroup\$
    – TypeIA
    Mar 19, 2022 at 20:32
  • \$\begingroup\$ Thnks @TypeIA, i will try at monday. It seems that I am exaggerating this "NOTE" too much. The videos I always watch on youtube scared me about "which pins are safe to use at esp32" \$\endgroup\$
    – mehmet
    Mar 20, 2022 at 3:02
  • \$\begingroup\$ The note is simply not correct. It should be "ADC2 cannot be used when Wi-Fi is used", but you are not using ADC2 if you just need GPIO25 to be a logic IO. \$\endgroup\$
    – Sim Son
    Mar 20, 2022 at 19:46

2 Answers 2

3
\$\begingroup\$

Those two boards are different: one is built using the ESP32-WROVER module, the other one using the ESP32-WROOM module.

The datasheets are:

In both cases, however, GPIO25 is connected to channel 8 of ADC2. So the first pinout chart is likely wrong.

While ADC2 cannot be used concurrently with Wi-Fi, the pins can still be used for other purposes such as digital input or output. And that's likely all you need for your case.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Correct: use of the ADC is not required to use IO25 as a discrete input or output. The question seems to assume, wrongly, that the ADCs are the mediators of the IO pins. The ADCs aren't involved in any way for discrete I/O. \$\endgroup\$
    – TypeIA
    Mar 19, 2022 at 20:28
  • \$\begingroup\$ @Codo well may be you are right, pinout can be wrong. but you can check link referred from esp orjinal docs. \$\endgroup\$
    – mehmet
    Mar 20, 2022 at 3:00
  • \$\begingroup\$ @mehmet: The ESP32 data sheets and the ESP32 reference manual list the analog function of pin 25 as ADC2_CH8. Only the pinout chart deviates. Which one would you rather believe? \$\endgroup\$
    – Codo
    Mar 20, 2022 at 7:41
  • \$\begingroup\$ It's the same ESP32 in the Wroom and Wrover modules, so both modules have the exact same features on their pins (beside maybe SPI where the Wrover has an external RAM). \$\endgroup\$
    – Sim Son
    Mar 20, 2022 at 19:43
1
\$\begingroup\$

The ADC circuitry is only connected to pin 32 to 39 for ADC1 unit (which you can use while WIFI is enabled), so it's 8 channels and 8 input pins you can use for reading analog values.

For ADC2 unit, it's only available on pin (0, 2, 4, 12, 13, 14, 15, 25, 26, 27) for a 10 channels. However, ADC2 is used internally for the WIFI and RTC features, so it's very painful to use them in your software.

All those pins are also available on the GPIO matrix, so you can use them for other purpose, but only those pins can be used for ADC conversion, and on their dedicated channel.

Another remark here: pin 34 to 39 are input only, so you can't use them as output (they don't have any output driver), and they are cross-connected by an internal capacitor (see here). So it's safe to use a UART's RX, but try to avoid 2 RX on pin 36 and 37 or pin 38 and 39 for example.

That's also the reason why you can't use interrupts on pin 36, 37, 38, 39 when using the WIFI, since the internal capacitor are charging when WIFI's state machine uses the ADC, enough to trigger the interrupts (see here).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.