If anyone has used an ESP8266 you may have come accross this error before:

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

I’ve come to realize the problem here is of two things:

The ESP is not in upload mode.

There is not enough power to the ESP.

Usually you upload code to the ESP and will try to upload again, but it is no longer in flash mode. Unfortunately you will need to power cycle it again, and ensure GPIO0 is connected to GND. The other solution to take note of is to provide external power to the ESP, and not just from your FTDI device.

In short do the following and this problem should go away:

  • Connect GPIO0 to GND.
  • Connect USB-FTDI.
  • Provide additional power to the ESP8266.