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.
void 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?