ESP8266-01 can't upload a sketch

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:

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

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

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

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.

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 ?

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 ?

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.

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.

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 ?

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.

Did you connected the reset pin of Mega to gnd?

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.

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 ?

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.

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

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.

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

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