Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Hadlock
#28995
awall wrote:I wanted to share my experience with flashing new firmware on ESP-01 modules. I had similar issues for days including very inconsistent results from time to time.
My setup includes: PC with Windows 7 64 bit - USB-serial adapter with FTDI FT232RL.
I tried with many different instructions and flashing tools with no success at all, I had even bricked a module after a partial upload...

Finally I got rid of all my issues when I considered that my FTDI USB-serial adapter might not be working correctly. Then I tried with a different serial adapter, based on a different chipset, and now everything goes right and I can finally flash any firmware successfully and consistently. So for your benefit here is a summary of the connections and the procedure I followed:

1) Connect the USB-serial adapter to the ESP8266 module as follows (left is USB-adapter, right is ESP8266):
GND - GND
RX Data - UTXD
TX Data - URXD

2) Connect the other ESP8266 pins as follows:
GPI02 => 3.3v
GPI00 => GND
VCC => 3.3v power supply
GND => GND power supply
CH_PD => Leave it floating initially
RST => 3.3v (or floating)

3) Prepare the flasher tool. I'm using the ESP8266Flasher available here: https://github.com/nodemcu/nodemcu-flasher
Look in the proper Win32\Release or Win64\Release folder. If you don't know how to load the various parts of the firmware .bin files look at the Readme file in the flasher distribution:
https://github.com/nodemcu/nodemcu-flas ... /README.md

4) Press the Flash Button (F) in the Flasher tool and then promptly connect the [CH_PD] pin to 3.3v. It is very important that this pin is connected after the Flash button is pressed
so that the flasher tool can detect the Bootloader string.
The firmware will start uploading showing up in the progress bar. When it's finished you will see a green icon at the bottom left corner.

Just a last note. Many people report that when powering up the ESP8266 or resetting it they get some rubbish from the UTXD pin.
This isn't actually rubbish but it's the string coming from the Bootloader waiting for some new firmware to be loaded. The string is the following:
"ets Jan 8 2013,rst cause:1, boot mode:(1,7)" (with some CR/LF around).
It is transmitted at a 75000 baud rate, so it is detected as rubbish when communicating with the ESP8266 at the typical baud rates of 9600 or 115200.

Hope this helps others that have troubles flashing their firmware to the ESP8266 modules.


I just wanted to say THANK YOU. I read all over the internet and this is the ONLY tutorial that actually worked in two days of googling the subject. I've been working on flashing NodeMCU since at least three days ago and reading your instructions seems to be the only thing that works for me. I have a couple of raspberry pi and arduino based robots with various sensors so it's not like I'm unfamiliar with wiring and flashing things. It's just the ESP8266 is VERY picky about it's firmware and that CH_PD pin.

Anyways, this is what worked for me.

I am flashing direct from a raspberry pi A+ (3.3v serial logic level) to an ESP-12

This is what worked for me, building on top of your instructions. You'll have to make sure you have esptool and picocom installed, which probably requires pySerial.

Rpi GPIO 14 (pin 08) -> esp GPO RX
Rpi GPIO 15 (pin 10) -> esp GPO TX
Rpi GND (pin 06) -> esp GND

ESP:
VCC -> 3.3v power source
VCC -> GPIO 2
VCC -> GPO CH_PD (*)

GND -> GND power source
GND -> GPIO 0

To flash
Disconnect VCC -> 3.3v power source
Disconnect VCC -> GPO CH_PD (*)
Connect GND -> GPIO 0
VCC -> 3.3v power source

Run "sudo python esptool.py --port /dev/ttyAMA0 write_flash 0x00 nodemcu-master-7-modules-2015-09-06-22-54-05-integer.bin"

IMMEDIATELY (~0.5 seconds) Connect VCC -> GPO CH_PD (*)

Should flash
Disconnect VCC -> 3.3v power source
Disconnect GND -> GPIO 0
Connect VCC -> 3.3v power source

Run "sudo picocom /dev/ttyAMA0 --b 9600 --omap crcrlf --imap crcrlf "

I was NOT able to re-flash NodeMCU 0.9.6 over top of itself. I had to reflash the AI Thinker 0.9.5 SDK (stock) firmware. Reflashing the old AI Thinker 0.9.5 SDK firmware "revived" a bunch of previously "bricked" ESPs.
User avatar
By eriksl
#29032 This is so weird.

I never do anything else then connect CH_PD, GPIO0, GPIO2, RST to 3.3V using a pull-up resistor and GPIO15 (ESP-201) with a pull-down to GND. Then for programming mode, I pull RST to GND, I pull GPIO0 to GND and then almost immediately release RST. In other words, reset with GPIO0 low and then release GPIO0 immediately after the reset. This just works. I never do anything with CH_PD, GPIO2 other then pull them up.

If you need the "dance" described in the above post, I suspect your power supply is insufficient which makes the pull-ups not strong enough. Also do use resistors! Or be prepared for surprises or sudden death.
User avatar
By Stampede
#29084 Erik, Thank you for adding what works for you, I was fighting with my Esp-01 all last night trying to get anything to it.
Could you add more detail on your setup? What resistors do you use, 1k? Every website I've gone to listed a different way to properly connect the ESP8266, it's pretty frustrating.

So to clarify what worked for you is it right to say the following?:

For Programming Mode:
FTDI = ESP8266
3.3V = VCC, CH_PD & GPIO2 (via resistor)
TX = RX
RX = TX
GND = GND, GPIO0, RST(via resistor? or are you using a switch to release it suddenly)

Since the ESP-01 does not have GPIO15 I think that causes some confusion on the tutorials.

For Active mode:
FTDI = ESP8266
3.3V = VCC, GPIO0 & CH_PD & GPIO2 & RST (via resistor)
TX = RX
RX = TX
GND = GND


Worst case scenario I'll do the magic programming dance, thanks guys.
User avatar
By eriksl
#29098 I am using 10k resistors. When I pull GPIO0 and RESET to ground (using an i2c port expander), the 10k is "almost" completely pulled to ground. GPIO2 I leave alone.

If you're using a "hardware" switch, you may be suffering from bouncing contacts.

The ESP-01 does not have the GPIO15 pin exposed, it's internally connected to ground, you don't need to worry.