ESP-01 ESP8266 - failed to enter flashmode

Hi guys :slight_smile:

Im on the road to explore the possibilities of ESP8266 wifimodule. But in order to do so, i need to learn how to upload code. Atm im trying to upload the Blink example, just to see if it works. Sadly not.

I am aware that i needs to enter flashmode, before im able to upload the code.

The error im getting is: "A fatal esptool.py error occurred: Failed to connect to ESP8266: Timed out waiting for packet header"

Which from i can read, is because it didnt nenter flashmode properly.

Beside the ESP8266, i have the ESP8266 USBprogrammer Picture of the programmer im using

So what have i done so faar?

  • Added the ESP8266 link as additional board manager

  • Installed the ESP8266 board module

  • Verified that i have the following settings:

  1. Select; Tools -> Board: -> (Select the board of your choice). 'Generic ESP8266 Module'
  2. Select; Tools -> Flash Mode: -> 'DIO'
  3. Select; Tools -> Flash Frequency: -> '40MHz'
  4. Select; Tools -> CPU Frequency: -> '80 MHz'
  5. Select; Tools -> Flash Size: -> '512K (64K SPIFFS)'
  6. Select; Tools -> Debug Port: -> 'Disabled'
  7. Select; Tools -> Debug Level: -> 'None'
  8. Select; Tools -> Reset Method: -> 'ck' "Please confirm its same as: "No dtr AKA CK"
  9. Select; Tools -> Upload Speed: -> '115200'
  • Verified that i select the proper COM.

Then i press upload sketch and i get the error mentioned earlier.

So how is my hardware setup?`

From what i can read on the internet, i cannot use the USB-drive right away. I need to make two modifications:

  • Link the vcc (3.3v) to the CP_EN
  • Switch between GND and GPIO 0.

I mirrored a youtubevideo:
Mirror yout-be

The switch is turned on while i insert the USB drive into the computer. Once plugged in, i turn switch off.

Nevertheless, keeps saying unsuccesfully upload sketch :frowning:

So how did i make the button?
Use breadboard and set a wire between GND and GIPO0, once USB is inserted, i remove wire to break connection (instead of welding).

See picture of setup:
Current setup

i tried to doublecheck the wiring, but cant find error there.

Hope someone can crack the code and explain me how to being able to upload code to the ESP8266.

Thank you all.

I use a ESP-01 Helper V3 to program ESP-01 modules
no wires, switches, etc - just compile, upload and either run in place or remove the ESP-01 to target system
I also have one of ESP8266 ESP-01 USB Programmer - you have to switch between program and run which is why I use the ESP-01 Helper V3

Youtube is not always the best source of information :confused:

I also suggest you remove that. Or at least replace it with a 10 k resistor.

have a read thru ESP8266_01_pins

Well if you actually have a programmer why don't you plug the ESP-01 straight into that. Usually it has GPIO 0 connected to GND already permanently which is fine.
I made a programmer which connects GPIO 0 to a switch with a 10K pullup and have done the same with RST.
Since i use an UNO as a USB to TTL i also have a voltage divider on the RX pin.

Keep in mind that also GPIO 1 (TX) and GPIO 2 should not be pulled 'LOW' at boot !!

change that to QIO (it is a quad after all)

and check for the crystal frequency to be set at 26MHz

Most likely the built in LED is on GPIO 1 so make sure that is reflected in your sketch.

Also and this is something i really need to say. We end up here with so many people with the same question, and helping them. Google ESP-01 upload etc. and go through the topics from this forum before starting a thread (guess it's to late now for this one)

Hi, thank you all for replying.

I did read other similair threads about same issue, however, trying those solutions didnt help me to upload code to the ESP8266.

I tried ur proposal with a brand new ESP8266 (they where cheap, so bought a few). Plugged it into the programmer, tried to upload code. Sadly getting same error "A fatal esptool.py error occurred: Failed to connect to ESP8266: Timed out waiting for packet header".

In respect of the code, i am using a basic code example for the ESP8266 for ligthing up LED.

@horace thank you for linking to that page, didnt see that before. Alot of good information on it.

@ZX80 OK, i removed it, tried with new ESP8266. Tried to upload code, same result :frowning: Havnt replaced it with 10k resistor.

Sadly, result remains the same, getting same errorcode when trying to upload new code. :-/

Atm im on holiday and have taken my kit and spareparts with me so enjoy holiday with the little project, so getting another helper-board is the solution that is faarest away atm xD.

are you using a ESP-01 programmer module now? if so which one?
take a photo with ESP-01 plugged in??
are you using ESP-01 or ESP-01S modules?

Hi Horace,

Sorry for the late reply.

I am using the ESP-01 programmer module now. I have sent a picture of the programmer below.

I am using the ESP-01 Module.

I notice that once i insert the USB programmer with the ESP-01 plugged in, it turns on the blue LED for a few seconds and then turn offline again. (Good sign i guess).

I have both tried to:

  1. have the ESP-01 inserted directly into the programmer and then tried to upload the sketch.
  2. Have tried using wires to act like a button thats being pressed while inserting the USB.
    Like "Switch between GND and GPIO 0"

Meaning, its connected while inserting usb, after a few seconds when i see that ARdunio recognize that the device is connected, i unplug the cable, like the switch is off.

Still same result.


your programmer looks like this one Easy-ESP-01-Tasmota-Programming
it explains that you have to solder some leads to pins to be able to program the ESP-01

With esp01s (I think this is what you have), CH_EN pin is pulled up by the board.


https://www.e-tinkers.com/2020/04/a-better-way-to-use-esp-01-as-wifi-shield/
https://forum.arduino.cc/t/esp-01s-beginner/903667

Ok. Well just a few things to check.

  • did you bring something else that could be used as a programmer ?
  • Does the port disappear in the IDE when you unplug the programmer ? (should do of course)
  • What core are you using ? (just in case, shouldn't matter much though)

Oh, eh... There are ESP-01 units that actually do not work with the 'generic ESP8266' setting in the IDE, but only with 'generic ESP8285' as a board. These look exactly the same, but have a different type of flash. Can you get a high res pic of the flash chip and post it so i can compare ? i am also on holidays, but i did bring a couple. Of course, please check if you manage to upload with that setting, although in my memory, uploading actually worked in that situation, but just the program never ran properly.

For completions sake, the connections.

3.3v -> VCC
3.3v -> CH_PD
3.3v -> 10K -> RST -> Sw -> GND
3.3v -> 10K -> GPIO 0 -> Sw -> GND
TX -> TX
RX -> RX (voltage divider if 5v logic level programmer is used)
GND -> GND

Hold down both switches and release RST first and try to upload.

This is all i know.

  • did you bring something else that could be used as a programmer ? **Brought Arduino UNO :slight_smile: **
  • Does the port disappear in the IDE when you unplug the programmer ? (should do of course) "Yes, and also says unplugged in the right buttom of screen"
  • What core are you using ? (just in case, shouldn't matter much though) What do you mean with core? i sadly dont understand.

Tried for fun changing to "Generic ESP8285". Sadly same result.

For completions sake, this is my current setup:

Shared link of video, from when i connect and disconnect wire for GND:
Video showing connect / disconnect.

As for completions sake, i would like to doublecheck that i understand you correct before wiring the switches as you describe. Can you confirm that the following is correct? this example is for "3.3v -> 10K -> RST -> Sw -> GND" ?
Wiresetup example 2

If you can confirm that, ill try make the following switches:

  • 3.3v -> 10K -> RST -> Sw -> GND
  • 3.3v -> 10K -> GPIO 0 -> Sw -> GND

Chip information:
ESP8266EX
202129
HB00PBH994
Chip information

Im on holiday in Thailand, tried to order " NODEMCU ESP8266" Dunno if it will arrive, so hope we can get around this without xD.

OK, well only connect between the programmer & the ESP the wires

  • GND
  • VCC
  • TX
  • RX

(so basically disconnect the others)

Now connect on the breadboard,

  • CH_PD (EN) to Vcc (3.3v)
  • RST to 10K and that to Vcc
  • RST to Switch A and that to GND
  • GPIO 0 to 10K and that to Vcc
  • GPIO 0 to Switch B and that to GND

Now i am assuming you have momentary switches, so hold down both switches and release Switch A first.
Then try to upload. a simple sketch (basically blink, but set the ledpin to GPIO 1 (or 2 but 1 is the most common)

That look like a normal ESP8266, but i will get back to you on that. Internet is not in my electronics workspace here.

When you installed the support for ESP8266 boards, you first added the URL to the additional boards in Preferences, and then you went into the boards manager to install them. In the boards manager, the newest version of the core is the default (3.1.1 of the top of my head) but you can also install (not at the same time !!) older versions of the 'core' files & libraries to create binary files that you can upload to the ESP.

well an UNO is what i normally use, but the 5v logic levels are a bit much for the ESP, so on the RX line you should use a voltage divider. I use 3x 1K resistor.
This is my reminder from my first successful upload.

Well that means that at least the USB part of the programmer is working.

Haha im starting to get tired of this ESP8266 module. None semes to work. I must have made some mistake, that is messing the setup up. however, when i trace my steps. i Cant seem to find it.

Anyways, made the new wiresetup:
Wiresetup 3

Unplugged first Switch A, then switch B. (see video below)
Video showing connect USB and switch

Still same result.
"A fatal esptool.py error occurred: Failed to connect to ESP8266: Timed out waiting for packet header"

Hope the NodeMCU is alot easier, if it arrives xD im running out of options with the current ESP8266.

Thanks alot though for trying to troubleshoot this module :smiley:

Okay, i have good news! I also had an ESP-12 module laying around. I found this video: Youtube video

Followed every steps. And Bingo, im able to upload code to the wifi module!!Hurray.

The main difference, is here, its first the GPI0 thats being activated, then first the reset once program is being uploaded.

Thanks alot though for the patience and help!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.