What would happen to a gpio pin set as high output if the pin already see a voltage higher than the MCU's voltage? Lets say 3.3V vs 3.4V
I will probably solve this with a diode and using one extra gpio pin, but I got curious. How will the internal circuitry of the gpio react to a small over-voltage?
For the long story: I have two signals controlling the same point for a power enable pin. One gpio from a battery powered esp32 at 3V to 3.6V range. The other is from a voltage divider from USB 5V, and this will also have a voltage range, since every usb port is not the same. The resistance is almost 100k, so the current is probably too low for anything to happen anyway, or is it? The MCU also want to measure the usb voltage to boot in to other code if the device is powered from usb instead of the battery, so a diode for that pin does not work. I am short on space, so it would be neat if these two things could be connected on one gpio pin.
On-button turns the circuit on, and the MCU can decide on its own when to turn off. With USB connected, the circuit is always on
Link to Falstad circuit.