3

This (maybe stupid) question is bothering me for a long time...

If the pin 0 has to be connected to the ground for uploading a sketch into ESP8266, and after the uploading the chip automatically starts the uploaded sketch (without waiting for reboot with pin 0 to be disconnected), then won't it destroy the chip if I do digitalWrite(0, HIGH) in my sketch? Correct me if I'm wrong, but it should short 3.3V directly to the ground through this pin... Is this problem secured somehow? Or maybe this pin can be safely used for reading only?

Edit:

I have seen it connected to ground directly on every schematic about ESP8266, but maybe I should just use a pull-down resistor? Or maybe the chip already has a resistor before this pin to solve this problem?

3 Answers 3

6

You can absolutely use GPIO0 as an output. The ESP will read the state of GPIO0 once at boot (And never again thereafter) to determine what boot mode to enter. During this time it is an input, so, whatever you hook GPIO0 up to must not hold this pin low (Unless you want to enter bootloader mode, of course), at least until the chip boots. As long as you satisfy this condition, you can use the pin for anything else. On my board for example, I use it to drive a simple status LED, and have never seen any issue from it.

2

What do you consider pin 0? As I look at the schematics it could either be GND, VCC, RX or TX pin. Or do you mean GPIO0?

GPIO0 when connected to GND and in combination with RST to GND will put ESP into programing mode. Good practice is to have separate programing board, something like This here. Go down to "Writing a program to the ESP8266" section and check out the schematic. Voltage regulator can be omitted if you are already powering it with 3.3v.

1
  • When I write digitalWrite(0, HIGH) I mean GPIO0. I know how to flash ESP8266 and I'm using a circuit in which I just press Upload and it just uploads (no manual reset needed). I've got a switch by which I toggle when the GPIO0 is connected to GND or not (and I switch it off only if I have to restart the program without uploading the new version). I'm just wandering if I could use this pin as an output pin because I'm out of pins. And I'm using ESP-12 with its standard breakout board that you can just plug into a breadboard.
    – P.W.
    Commented Apr 25, 2016 at 14:57
1

It may be stated that GPIO0 is safe to use as an output, but I challenge anyone to show he has actually done it. When configuring GPIO0 as an output I get only oscillations (about 70kHz), loaded or open, when driving this pin LOW. Even GPIO15 works without issues when used as an output. Several new ESP8266-12F modules were tested.

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.