ESP-12 bootloader modes and GPIO state at startup

Since I encountered some initial difficulties in programming the ESP-12 version of the ESP8266 module using the Arduino IDE, let me here summarise some findings based on information from [1,2,3].

esp12-pinout

The ESP-12 module exposes 11 GPIOs. Three of them are especially relevant, as they determine the bootloader mode at startup or following reset.

                                  | GPIO 0 | GPIO 2 | GPIO 15
----------------------------------|--------|--------|---------
Flash Startup (Normal)            |   1    |   1    |   0
UART Download Mode (Programming)  |   0    |   1    |   0
SD-Card Boot                      |   0    |   0    |   1

Furthermore, CHPD should be pulled up and RESET should be pulled up or should be floating. If you connect RESET to ground, the module resets.

I have not yet figured out what the SD-Card boot means, so in my applications GPIO 2 should always be pulled up and GPIO 15 should always be pulled down. I am using 10k resistors, but smaller values (e.g. 3.3k) should also work.

To facilitate development, I connected two push button switches to the GPIO 0 and RESET pins, shorting them to ground when pressed. When the buttons are not pressed, they are both pulled up to 3.3V using a 10k resistor.

This allows me to do the following two-finger-action to restart in programming mode and allow the Arduino IDE to upload a new firmware:
– press reset button
– press programming button
– release reset button
– release programming button

References

[1] https://zoetrope.io/tech-blog/esp8266-bootloader-modes-and-gpio-state-startup
[2] http://www.instructables.com/id/Getting-Started-with-the-ESP8266-ESP-12/
[3] http://www.instructables.com/id/ESP8266-Using-GPIO0-GPIO2-as-inputs/

11 thoughts on “ESP-12 bootloader modes and GPIO state at startup

  1. Pingback: ESP-12 NodeMcu ESP8266 | 으잉 >_<

  2. Pingback: Consolidación de links para ESP8266 (y ESP32) | codesect

  3. Rodrigo Mendoza

    THANKYOU SO MUCH. I have to make a note that ch_pd, gpio15 & gpio 2 can be connected directly to gnd and source respectivelly. But the pull up and down on reset and gpio 0 are essential.

    Reply
    1. George

      Just tried that with ESP12F modules:
      EN can be connected to 3v3 directly.
      IO15 must be pulled via resistor or the module can’t be flashed (comes up in mode 7)
      IO2 can float.
      IO0 & RST must be pulled via resistor.

      Reply
      1. Nikola Dimitrijevic

        for me this is not working like you described.
        i made it work only when i connected (programming mode)
        GPIO0 -> GND
        GPIO15->GND
        GPIO2->3.3v

        Reply
  4. Pingback: Home Status Display – Qetesh's Workbench

  5. Pingback: WiFi Motion Detector – Qetesh's Workbench

  6. Pingback: Project HiveSUMMary | zeitwesentech blog

    1. Robert Post author

      I would not expect that. OTA flash would first involve an upload of the new firmware to (unused) EEPROM, then a reboot after which it the new firmware would have to be copied to the final location. Neither of those involves interaction over the serial interface.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *