# ESP8266-01 can't upload a sketch

**URL:** <https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515>\
**Category:** IDE 1.x\
**Created:** [May 22, 2022, 1:43pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515 "2022-05-22T13:43:26Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![septimas](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/septimas/32/785757_2.png) [@septimas](https://forum.arduino.cc/u/septimas)\
**Post date:** [May 22, 2022, 1:43pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/1 "2022-05-22T13:43:26Z")

</div>

Hello,

I have been attempting to upload a sketch to a new ESP8266-01 I bought recently. I am trying to upload the sketch via an Arduino Mega 2560.

Connections from ESP-01 to Arduino:  
3.3V ----------------------------------------- 3.3V  
CH\_PD/EN -------------------------------- 3.3V  
RST ----------------------------------------- None  
TX ------------------------------------------- TX  
RX -----------Voltage divider --------- RX  
GND --------------------------------------- GND  
GPIO2 ------------------------------------- None  
GPIO0 ------------------------------------- GND

Voltage divider is 1K and 2.2K resistors.

I keep receiving the following errors:

```cpp
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

```

Any help is greatly appreciated!

Thanks,  
Ciaran

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [May 22, 2022, 1:58pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/2 "2022-05-22T13:58:29Z")

</div>

Mega TX -\> ESP RX via voltage divider and MEGA RX -\> ESP TX is a more sensible choice.

---

<div class="post-metadata">

**Author:** ![septimas](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/septimas/32/785757_2.png) [@septimas](https://forum.arduino.cc/u/septimas)\
**Post date:** [May 22, 2022, 2:57pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/3 "2022-05-22T14:57:05Z")

</div>

Thanks, I have just tried this. I hasn't changed the outcome. I was wondering about the board settings in tools, I'm unsure what they should be so haven't toughed them

---

<div class="post-metadata">

**Author:** ![Deva\_Rishi](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/deva_rishi/32/227254_2.png) [@Deva\_Rishi](https://forum.arduino.cc/u/Deva_Rishi)\
**Post date:** [May 22, 2022, 3:07pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/4 "2022-05-22T15:07:29Z")

</div>

> [@septimas](#):
>
> I am trying to upload the sketch via an Arduino Mega 2560.

Assuming that you have nothing running on the mega that uses Serial, you seem to have all connections correct except that where you write GPIO 1, you must mean GPIO 0 (GPIO 1 = TX)  
just verify that you are actually grounding the correct pin.

> [@septimas](#):
>
> I was wondering about the board settings in tools

generic ESP8266, probably 1MB flash (unless the PCB is blue) and all default settings for the rest. (ok you can change the builtin LED to 1)  
Which core are you using ?

> [@sterretje](#):
>
> Mega TX -\> ESP RX via voltage divider and MEGA RX -\> ESP TX is a more sensible choice.

What can work is do a Serial passthrough on the Mega at 115200bps, and then connect the ESP Rx-Tx on the secondary UART. Otherwise just keep trying Tx-TX & RX - voltage divider - Rx  
How have you done the voltage divider exactly ?

---

<div class="post-metadata">

**Author:** ![septimas](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/septimas/32/785757_2.png) [@septimas](https://forum.arduino.cc/u/septimas)\
**Post date:** [May 22, 2022, 3:17pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/5 "2022-05-22T15:17:18Z")

</div>

I uploaded an empty sketch to the Arduino before beginning and have now altered the post to say GPIO 0.

I'm unsure which core, is there a way to check?

The voltage divider is 1K to 2.2K. So Arduino Rx connected to the 1K resistor, 1K resistor connected to 2.2K and ESP Rx, 2.2K connected to ground.

---

<div class="post-metadata">

**Author:** ![Deva\_Rishi](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/deva_rishi/32/227254_2.png) [@Deva\_Rishi](https://forum.arduino.cc/u/Deva_Rishi)\
**Post date:** [May 22, 2022, 3:25pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/6 "2022-05-22T15:25:20Z")

</div>

> [@septimas](#):
>
> I'm unsure which core, is there a way to check?

You can check in the board manager, and it should also be clear in the compilation message, most likely 3.0.2 as it is the most recent one.

> [@septimas](#):
>
> The voltage divider is 1K to 2.2K. So Arduino Rx connected to the 1K resistor, 1K resistor connected to 2.2K and ESP Rx, 2.2K connected to ground.

Should be good.

Is there still firmware on the ESP (they come with at-commands firmware) if you open the Serial monitor set it to 115200bps and line-ending to 'both LF & CR' and type AT does it respond ?

---

<div class="post-metadata">

**Author:** ![septimas](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/septimas/32/785757_2.png) [@septimas](https://forum.arduino.cc/u/septimas)\
**Post date:** [May 22, 2022, 3:41pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/7 "2022-05-22T15:41:15Z")

</div>

I'm currently using 2.3.0.

If I open the serial monitor and type anything in, including the AT commands, I get no responses.

---

<div class="post-metadata">

**Author:** ![noobmastha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/noobmastha/32/738653_2.png) [@noobmastha](https://forum.arduino.cc/u/noobmastha)\
**Post date:** [May 22, 2022, 4:39pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/8 "2022-05-22T16:39:53Z")

</div>

Did you connected the reset pin of Mega to gnd?

---

<div class="post-metadata">

**Author:** ![septimas](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/septimas/32/785757_2.png) [@septimas](https://forum.arduino.cc/u/septimas)\
**Post date:** [May 22, 2022, 4:49pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/9 "2022-05-22T16:49:13Z")

</div>

Yes, but could you please explain the purpose of this? Thanks

---

<div class="post-metadata">

**Author:** ![Deva\_Rishi](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/deva_rishi/32/227254_2.png) [@Deva\_Rishi](https://forum.arduino.cc/u/Deva_Rishi)\
**Post date:** [May 22, 2022, 6:24pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/10 "2022-05-22T18:24:16Z")

</div>

> [@septimas](#):
>
> Yes, but could you please explain the purpose of this? Thanks

That will constantly reset the Mega which you are not using. It is that or a blank sketch.

> [@septimas](#):
>
> If I open the serial monitor and type anything in, including the AT commands, I get no responses.

That may mean that the ESP isn't functioning at all, that could be due to lack of power of course.  
Please check all connections, and check the voltage between the ESPs Vcc & GNd . It should be 3.3v of course.  
Can you post a link or a pic of your Mega ?

> [@septimas](#):
>
> I'm currently using 2.3.0.

I think the ESP tool is the same, but that is even older than what i am using. i'm on 2.4.2, apparently 2.7.4 is good, and at the moment 3.0.2 is the latest, but that may have some issues.

---

<div class="post-metadata">

**Author:** ![noobmastha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/noobmastha/32/738653_2.png) [@noobmastha](https://forum.arduino.cc/u/noobmastha)\
**Post date:** [May 22, 2022, 10:30pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/11 "2022-05-22T22:30:57Z")

</div>

in this mode you are using only programator chip and bypassing megas mic. You selected esp8266 in a board manager? I`ve done it long time ago with uno, and without resistor attenuator for rx. Also try reversing rx and tx, don`t know how it is on mega..

---

<div class="post-metadata">

**Author:** ![Deva\_Rishi](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/deva_rishi/32/227254_2.png) [@Deva\_Rishi](https://forum.arduino.cc/u/Deva_Rishi)\
**Post date:** [May 23, 2022, 7:10am UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/12 "2022-05-23T07:10:04Z")

</div>

> [@septimas](#):
>
> If I open the serial monitor and type anything in, including the AT commands, I get no responses.

Sorry i forgot to tell you to remove the GPIO 0 to GND connection to put it into normal boot mode to see if AT commands work.  
Other thing to check is (also without the GPIO 0 to GND connection) to set the Serial Monitor to 74880 and reset the ESP and it should then output SDK data.

---

<div class="post-metadata">

**Author:** ![joortiz22](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/joortiz22/32/800277_2.png) [@joortiz22](https://forum.arduino.cc/u/joortiz22)\
**Post date:** [June 24, 2022, 4:56pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/13 "2022-06-24T16:56:29Z")

</div>

FINALLY found solution to the same problem!

There are 2 options:

1. Find a better driver
2. Upload without arduino IDE

Luckily there are youtube videos for each and the driver I downloaded to flash without arduino IDE actually let me flash with the arduino IDE

Step 1: Try Downloading, installing and using driver [By Clicking Here And Using With Arduino IDE](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers). Files are under Downloads tab. I use windows so download CP210x Windows Drivers v6.7.6 (9/3/2020), i don't know about mac.

If that doesn't work go to step 2 & 3

Step 2: Flash code from arduino IDE without using arduino IDE by following youtube video [How to Flash NodeMCU 8266 without Arduino IDE with .bin file - YouTube](https://youtu.be/CtaxdTFcaGo) (driver installed in step 1)

Step 3: Format board to upload code wirelessly via OTA programming and never deal with it again by searching youtube for "ESP8266 Over The Air (OTA) Programming Without Reset Using Arduino IDE (Mac OSX and Windows)" and follow video.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [December 21, 2022, 4:56pm UTC](https://forum.arduino.cc/t/esp8266-01-cant-upload-a-sketch/994515/14 "2022-12-21T16:56:47Z")

</div>

Closed on December 21, 2022, 4:56pm UTC

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