Question: Blue led is blinking after powering up the module, the red one stays on, I can even connect to it via wifi. But I cannot program it. I tried Arduino IDE, different firmware flashers (Like NodeMCU, XTCOM). I'm using Arduino Mega.

Here's my initial setup:

```
VCC - 3.3 V on Arduino
RST - nothing
CH_PD - 3.3 V on Arduino
TX - RX on Arduino (TX is transmitting data to RX, so I don't need a voltage divider, right?)
RX - voltage divider (R1 = 10K, R2 = 20K) - TX on Arduino
GPIO0 - GND on Arduino
GPIO2 - nothing
GND - GND on Arduino

```

Then I tried uploading a sketch from the Arduino IDE and got the following error:

```
warning: espcomm_sync failed 
error: espcomm_open failed

```

After trying different IDEs, programmers, serial port I tried firmware flashers to at least see if I can communicate with it. NodeMCU for example just
showed "Waiting MAC" with GPIO0 to ground and without.

I also tried connecting TX to TX and RX to RX but got the same results. Tried connecting RX through a voltage divider as well. 

With this setup the blue led was constantly on. I remembered reading somewhere that that could happen due to insufficient power supply, 
so I also tried connecting both pins without the voltage dividers (the blue led is still blinking after the power up so hopefully I didn't burn them).
I also tried connecting GPIO0 to 3.3V and not connecting it to anything at all, connecting RST to 3.3V, connecting GPIO2 to ground as well.
On Mega there are 4 sets of TX and RX pins, so I tried them all out TX/RX0,1,2 and 3.

Still no idea what's going on :(

Answer: 
The cause can be one of two things:

1. Insufficient power. Try to power the ESP8266 from an external 3.3V power supply such as a lab supply. Two fully charged AA batteries should do the trick too. Make sure your serial adapter's GND pin is also connected to the ESP's GND pin in order to provide a common ground.
2. ESP8266 is not in programming mode. Make sure GPIO0 is attached to GND and turn the ESP off and on again. It will then boot into programming mode. Once programmed, you can take it off GND.

**EDIT:**

Since this post, I've actually encountered a third, more notorious reason. Some ESP8266 modules (especially the ESP-12 packages) actually come with alternative non-core firmware on them. In this case, you have to update the firmware on the ESP. [Here](https://www.allaboutcircuits.com/projects/update-the-firmware-in-your-esp8266-wi-fi-module/) is a great tutorial on how to do this. I highly recommend you use the ESP Flash Download tool which is Windows-only unfortunately, but is less error prone than doing it in a serial terminal. But before you embark on this journey, make sure the cause isn't #1 or #2.
I had the same problem at first but resolved later.  

I have provided link at the end of the answer. Just follow it.  

**Things to remember when working with ESP8266-01:**  

1. You must need a good 3.3VDC power source for ESP8266 to get it work. Do not
provide 3.3V from Arduino instead use *LM1117-3.3* voltage regulator
to provide ESP power. It is also crucial that *LM1117-3.3* voltage regulator must have input voltage higher than 7V or 9V. Do not feed Arduino's 5V to this regulator.
2. R1 should be 1K and R2 should be 2K. For more information, please refer the schematic I have provided in following article for ESP8266-01.
3. Pin configuration for flashing/programming ESP8266-01, refer following article.

Just follow my article's section "Deploy -> ESP8266-01 Sketch":
<https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-hydroflyer-f83190>