Uploading a sketch to an ESP8266 board fails with:

error: failed reading byte
warning: espcomm_send_command: can't receive slip payload data
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed


espcomm cmd: receiving 2 bytes of data
warning: espcomm cmd: no final C0
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed

This is on OS X with a PL2303HXD USB-to-Serial cable, using the latest official Prolific signed OS X El Capitan-compatible drivers.


This is a known issue with the included esptool, and for the Arduino IDE there are quite a few blog posts to be found on this problem. But most are outdated, and are not applicable when using PlatformIO with some other IDE. So, February 2016:

Install esptool.py

  • git clone https://github.com/themadinventor/esptool/ (or download the ZIP file)
  • cd esptool
  • sudo python setup.py install

When using Arduino IDE

  • Open ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.0.0/platform.txt.
  • Find the line tools.esptool.upload.pattern and disable that by prefixing with a hash. Check that your version only mentions -ca 0x00000, not -ca 0x10000 as well (like in most outdated blog posts):

    # tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}.bin"
  • Add the following, referring to the esptool.py you installed above and also using different command line parameters:

    # Fix for espcomm_send_command: cant receive slip payload data
    tools.esptool.upload.pattern="/path/to/new/esptool.py" --port "{serial.port}" --baud {upload.speed} write_flash 0x00000 "{build.path}/{build.project_name}.bin"
  • Restart the IDE.

(One might be tempted to just change tools.esptool.path and tools.esptool.cmd instead, but beware that the command line parameters need changing as well.)

When using PlatformIO

You will find the same platform.txt file somewhere in ~/.platformio/packages/framework-arduinoespressif/platform.txt, but that file is not used for the upload. Instead:

  • In platformio.ini add:

    # ...or whatever your port is named
    upload_port = /dev/cu.usbserial
    extra_script = /path/to/platformio_extra_script.py
  • Create a new file /path/to/platformio_extra_script.py:

    # Custom settings, as referred to as "extra_script" in platformio.ini
    # See http://docs.platformio.org/en/latest/projectconf.html#extra-script
    # See https://github.com/platformio/platformio/issues/426
    from SCons.Script import DefaultEnvironment
    env = DefaultEnvironment()
    # Must be full path, or use
    # https://docs.python.org/2/library/os.path.html#os.path.expanduser
            "--port", "$UPLOAD_PORT",
            "--baud", "$UPLOAD_SPEED",
            "write_flash", "0x00000",
  • hey, it throws an error: java.io.IOException: Cannot run program /mypath/esptool.py error=2, No such file or directory – user1051505 Nov 22 '16 at 17:26
  • To avoid errors when programming boards that don't support QIO (e.g. NodeMCU from Amica), you also need -fm dio in the command line. So adjust that tools.esptool.upload.pattern line by adding -fm {build.flash_mode} right after write_flash (and before the 0x00000 address). – Andrey Tarantsov Dec 30 '17 at 11:11
  • Did not work for me. Can I somehow find out if my controller is broken? Have 5 and all the other 4 work without this tweak. – lony Mar 17 '18 at 7:39

protected by Community Jan 17 '17 at 6:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.