So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By David Smart
#90717 I'd like to use the TXD pin as an input. This input should [externally] have a switch contact to ground. The other pins are in use - honoring what's required for successfully boot, and I need just this one more input.

Since the TXD pin starts as a UART [output], I placed resistance between TXD and my external switch to ground. The theory being that the TXT pin can easily source 3.3 mA while transmitting the sign-on information. Then I switch it to an input pin when my application starts.

Code: Select allvoid setup(void) {
    pinMode(3, FUNCTION_3);   // TXD converted to IO
    pinMode(3, INPUT_PULLUP);  // tried INPUT, and commenting this line out

Initially, I had a 10K from TXD to +3.3, and 1K from TXD to my external switch to Ground.
I have since experimented with different configurations without the external pull-up, and with higher values replacing the 1K, but without success.

My observation:
  • If I power-up with the external switch open, then it boots fine and properly detects my switch close and open events.
  • If I power-up with the external switch closed, it will not boot.
  • If I increase the 1K to higher values, so that it boots, then it will not successfully pull-down when the switch closes.

The online information I've found does not suggest any startup-interlock-behavior based on the TXD pin, but then I guess most people use it as the serial port.

Has anyone a solution to this, or a reference to ESP information that will help me solve this?
User avatar
By David Smart
oliviasmithh900 wrote:Hardware Serial Pins of ESP-01 are connected to USB Pin from where we connect it to computer, so its not wise to use it for other purposes i.e. connecting a switch. Instead you should go for shift registers to increase your I/Os.

Thank you for responding, however this isn't so helpful as it does not focus on my need. To your point, those pins are used for programming (as are other pins to place the chip into boot mode), and if the USB interface is integrated with the ESP module, the RXD and TXD would be unavailable. But for my application, I remove it from the programming adapter and place it "in system" where the TXD pin is "ideally" an input pin.

So, I have found that if I let the pin float on boot, it emits the boot-text. Then if I change it to be an input pin, it works fine in my application. But this requires that my app does not provide any pull-down impedance at boot - which is not possible with my configuration. I cannot find in any reference where this should not be permitted. Perhaps somebody can find that detail and point me to it?