Upload fails: "espcomm_upload_mem failed"

Continuing the discussion from Upload Error: exit status 2:

im facing the same issue
it verifies it but cant upload

Upload started
Programming with: Serial
Flashing with command:C:/Users/A/.arduino-create/esp8266/esptool/2.5.0-3-20ed2b9/esptool.exe -vv -cd nodemcu -cb 115200 -cp COM6 -ca 0x00000 -cf C:/Users/AB/AppData/Local/Temp/arduino-create-agent150342646/DLD__dec05a.bin
esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to nodemcu
setting baudrate from 115200 to 115200
setting port from COM1 to COM6
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
espcomm_upload_mem
setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
wrote 0, requested 1
error: failed sending 0xC0
espcomm_send_command: sending command header
wrote 0, requested 8
error: failed sending 8 bytes
espcomm_send_command: sending command payload
wrote 0, requested 36
error: failed sending 36 bytes
wrote 0, requested 1
error: failed sending 0xC0
read 0, requested 1
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
Executing command: exit status 2

Hi,can you help fix this?

Upload started

Programming with: Serial

Flashing with command:C:/Users/pc/.arduino-create/esp8266/esptool/2.5.0-3-20ed2b9/esptool.exe -vv -cd ck -cb 115200 -cp COM4 -ca 0x00000 -cf C:/Users/pc/AppData/Local/Temp/arduino-create-agent3373876092/SMART_AQUAPONIC_oct11a.bin

esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel ck@atelier-klippel.de

setting board to ck

setting baudrate from 115200 to 115200

setting port from COM1 to COM4

setting address from 0x00000000 to 0x00000000

espcomm_upload_file

espcomm_upload_mem

setting serial port timeouts to 1000 ms

opening bootloader

resetting board

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

resetting board

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

resetting board

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

trying to connect

flush start

setting serial port timeouts to 1 ms

setting serial port timeouts to 1000 ms

flush complete

espcomm_send_command: sending command header

espcomm_send_command: sending command payload

read 0, requested 1

warning: espcomm_sync failed

error: espcomm_open failed

error: espcomm_upload_mem failed

Executing command: exit status 2

i am getting this error pls help
esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel ck@atelier-klippel.de

    setting board to ck
    
    setting baudrate from 115200 to 115200
    
    setting port from COM1 to COM21
    
    setting address from 0x00000000 to 0x00000000
    
    espcomm_upload_file
    
    espcomm_upload_mem
    
    setting serial port timeouts to 1000 ms
    
    opening bootloader
    
    resetting board
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    resetting board
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    resetting board
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    trying to connect
    
    flush start
    
    setting serial port timeouts to 1 ms
    
    setting serial port timeouts to 1000 ms
    
    flush complete
    
    espcomm_send_command: sending command header
    
    espcomm_send_command: sending command payload
    
    read 0, requested 1
    
    warning: espcomm_sync failed
    
    error: espcomm_open failed
    
    error: espcomm_upload_mem failed

here is what I found
Initially, the code would get stuck at uploading start ,To resolve this, I disconnected the board and hold the flash button on the ESP8266 while connecting it to the USB port. This action forced the ESP8266 into flash mode

Subsequently, an "Error status 2" message appeared during the upload. I resolved this by pressing the flash button as soon as the upload start appears on terminal and holding until the "writing flash" message displayed on the terminal.

Additionally, I encountered again the problem where the ESP8266 got stuck at the uploading start, even when in flash mode. I identified that removing all connections from the board before uploading the code, specifically disconnecting the output of the IR sensor in my project from pin D8, allowed for a successful upload.

Check your upload speed in case none of the above worked. I was going crazy with pressing the boot button / EN button - unplugging USB, etc. as described above - I started troubleshooting by just trying to turn on the Serial Monitor. That started steering me in the right direction. The serial monitor would fail the same way trying to upload would.

In the end - changed the upload speed in the TOOLS menu of IDE to 115200 (was at 921600). Voila! Off to the races.

Hope that helps anyone!

1 Like

Thanks for sharing your solution @kawi1000! I have also found that reducing the upload speed can sometimes solve mysterious upload failures for the ESP32 and ESP8266 boards.

You mentioned accomplishing this via the Tools > Upload Speed menu in Arduino IDE. Since this topic is in the #software:iot-cloud forum category for Arduino Cloud users, I'll share instructions for doing the same via the Arduino Cloud web interface:

A. Open Sketch in Arduino Cloud Editor

If you are working with a non-IoT sketch, then you will have already been using Arduino Cloud Editor exclusively and you can simply open it as you usually do.

If you are working with an Arduino Cloud Thing sketch, then you might be used to using the Thing sketch editor to develop and upload your sketch. It is not possible to configure the upload speed when using the Thing sketch editor so you must open the Thing sketch in Arduino Cloud Editor (aka "full editor"):

  1. If you are not already, log in to your Arduino account:
    https://login.arduino.cc/login
  2. Click the following link to open the list of your Arduino Cloud Things in the web browser:
    https://app.arduino.cc/things
  3. Click the name of the Thing.
    The "Setup" page for the Thing will open.
  4. Select the "Sketch" tab at the top of the page.
    The "Sketch" page for the Thing will open.
  5. Click the "</> Open full editor" button on the toolbar.
    The Thing sketch will open in Arduino Cloud Editor.

B. Configure Upload Speed

  1. Click on the board selector on the Arduino Cloud Editor toolbar.
    A menu will open.
  2. Select "Select Other Board & Port" from the menu.
    The "Select Other Board & Port" dialog will open.
  3. Select your board from the "BOARDS" menu.
    A "FLAVOURS" section will appear at the right side of the dialog.
  4. Select "115200" from the "Upload Speed" menu.
  5. Select the port of the board from the "PORTS" menu.
  6. Click the "OK" button.
    The "Select Other Board & Port" dialog will close.

Now try uploading the sketch hopefully this time the upload will be successful.

C. Optimize Upload Speed

If the sketch upload no longer failed after reducing the upload speed, you will have learned that the board is not capable of managing uploads at the default 921600 baud, but is capable of them at 115200 baud.

Especially with more complex sketches, the upload will take a significant amount of time at 115200 baud. It is likely that the board is capable of managing uploads at some speed higher than 115200 baud, so it is worth doing some experimentation to determine the maximum speed at which you can reliably upload to the board. You can do this by repeating the "Configure Upload Speed" procedure above, but selecting different speeds each time. Then attempting an upload to see if the new speed is appropriate.

Thank you very much for your reply !!
I will try it.

Hi, I have followed all suggestions above but not solved my problem. Nevertheless I followed following step and it worked

  1. pushed and hold Boot button
  2. Connected 5V power source through Vin and Gnd
  3. Released Boot button and waited around 5 sec
  4. While 5V power source connected plugged usb cable to the board and connected to PC
  5. then successfully uploaded new sketch to the board

But then I have noticed the board not getting power from USB cable but can be seen in Arduino IDE as connnected. So be careful to follow my steps

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