Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot program ESP8266

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 :(

like image 742
Alex Pilkevych Avatar asked Jul 12 '15 19:07

Alex Pilkevych


People also ask

Why is my ESP8266 not working?

Close the ESPlorer IDE connection. Remove power from your ESP8266. Having your ESP with GPIO 0 connected to VCC. Apply power to your ESP8266 and re-establish the connection with ESPlorer IDE.

Can't connect to ESP8266?

The ESP8266 only operates on the 2.4GHz band and it is not compatible with the 5.8GHz band. You must ensure that the router you are trying to connect to has the 2.4GHz band enabled and that you are trying to connect to it. Depending on the router, you may needs to set the router AP band to 2.4GHz.


2 Answers

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 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.

like image 195
mikevanis Avatar answered Oct 05 '22 21:10

mikevanis


When you connect it up to your serial port, set the baud to 74880, and apply power you should see the initial debug info dumped out to the serial.

You should see something like this:

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

 load 0x40100000, len 29936, room 16 
 tail 0
 chksum 0xee
 load 0x3ffe8000, len 2304, room 8 
 tail 8
 chksum 0x51
 load 0x3ffe8900, len 8, room 0 
 tail 8
 chksum 0x9e
 csum 0x9e

If you are holding GPIO down on boot (to enter flash mode) you should see this

ets Jan  8 2013,rst cause:2, boot mode:(1,6)

Notice the change from (3,6) to (1,6)

If you not see anything displayed then double check your TX <> RX and GND connections.

like image 25
Lorne Bonnell Avatar answered Oct 05 '22 22:10

Lorne Bonnell