ESP32 using GPIO 2 as INPUT

I've been building a program based on the FireBeetle ESP32 IOT development board. Just when I thought I had everything working I fab'ed a board. I've used up almost every port with my application. I have a button assigned to GPIO 2 to read it when the button shorts to ground ( external pullup 10K resistor on it to 3.3V). I had it working fine for weeks but now it is behaving rather funky. I upload my program from Arduino IDE and it boots but GPIO 2 will not read the button when it goes low. I've read about GPIO and know that it is assigned to the onboard LED and know that it is a strapping pin but it seems to boot fine. It's just that I can't use it as an input after booted. Is it wrong of me to tie an external pullup to Pin 2? I've read about using gpio_pad_select_gpio() but can't seem to get that to work? Here's a snippet of my circuit:

Upload sketch without connecting anything at DPin-2. After that connect your Button at DPin-2 with an external pull-up.

I have tested in my 30-pin ESP32 Dev Board and have found DPin-2 working an an input line.

I expect your design will not be stable and sensitive to electrical noise. There are no decoupling capacitors shown, just one bulk capacitor. There should be one close to each IC.

and what value would your recommend, .1ufd ?

I assume that is 100nF which is what I use, sometimes 220nF but if I can i mix both on the board.

All the other buttons work OK, just GPIO2 is the problem?

It is just GPIO 2, all other (available) GPIO works. I have another Firebeetle board out of circuit that I will test GPIO 2 later today to make sure that its not a in-circuit issue.

I see that there are several Firebeetle variations, which do you have?

You could try reading the analog value of GPIO02 when you press the button, and use that value to switch.

Yes, that is a good idea, I will try that.

Since we have INPUT_PULLUP -- why use "R4" at all?

Because on my Firebeetle esp32, not all GPIO's have internal pullup.

Ostensibly, it is an "ESP32".
I wonder why it's different.

I wouldn't want you to hack your board to find out on my account.

on the Firebeetle esp32 only some pins can be assigned internal pullup.

It turns out that I just tested a standalone firebeetle with a pushbutton wired to GPIO 2 and an external 10K pullup resistor. It works fine. So it must be some other port or wiring on my board. Now the debugging process begins...

Good hunting.
(I guess INPUT_PULLUP is not compatible with its being the onboard LED, too? I was trying to rig up something simple and said to myself once that registered in my head, "That won't work right.")

That is something that crossed my mind as well. GPIO2 is a strapping pin as well, so if the builtin led is active HIGH (as it is on some ESP32 boards, unlike nearly all ESP8266 boards) that means there must be some kind extra circuitry involving a transistor or mosfet of some kind probably. That can be a cause.
edit (sorry for the phrasing, it does not really relate to the INPUT_PULLUP thing so much)

Normally speaking that would indicate a possible software issue. Have you tried specifically setting the pinMode of the pin to INPUT, just before you do the digitalRead() of it ?
Sometimes peripherals switch pinmodes of pins for reasons unknown. I have experienced this on ESP32 before (be it in the opposite way with a pin reverting from OUTPUT to INPUT for reasons unknown to me )

According to the schematic, GPIO2 has a 2.4K resistor and LED connected.
With a pull-up of 10K, and depending on the LED, the voltage on the pin will probably be somewhere between HIGH and LOW. So it could go either way at any time depending on temperature humidity and the phases of the moon.

For reliable operation you will need to use a different pin.

Or pull-off the LED