I am getting "espcomm_sync failed" mistake when trying to upload my ESP. How to resolve this issue?¶

  • Introduction

  • Initial Checks

  • Advanced Checks

  • Reset Methods

  • Ck

  • Nodemcu

  • I'm Stuck

  • Determination

Introduction¶

This message indicates effect with uploading ESP module over a serial connection. At that place are couple of possible causes, that depend on the blazon of module, if you utilize split up USB to serial converter, what parameters are selected for upload, etc. As upshot there is no unmarried respond on the root cause. To find it out yous may need to complete couple of troubleshooting steps.

Note: If you are merely starting with ESP, to reduce potential issues with uploading, select ESP board with integrated USB to series converter. This will considerably reduce number of user depended factors or configuration settings that influence upload process.

Example boards with USB to serial converter build in, that will brand your initial project development easier, are shown below.

Example boards with integrated USB to serial converter

Case boards with integrated USB to serial converter

If you are using a Generic ESP8266 module, carve up USB to serial converter and connect them by yourself, please make sure you accept the following three things right: i. Module is provided with plenty power, 2. GPIO0, GPIO15 and CH_PD are connected using pull up / pull downwards resistors, 3. Module is put into boot loader mode.

For specific details please refer to section on Generic ESP8266 module. Example modules without USB to serial converter on board are shown below.

Example ESP8266 modules without USB to serial converter

Example ESP8266 modules without USB to serial converter

Initial Checks¶

In order to troubleshoot "espcomm_sync failed" error, delight continue step by step through the checklist beneath. This list is organized starting with most mutual and simple to more than complex issues.

  1. Offset with reading verbal bulletin displayed in debug window of Arduino IDE. In many cases it provides directly data where the issue is.

"espcomm\_open failed" error

"espcomm_open failed" error

For case bulletin above suggests that Arduino IDE is unable to open a serial port COM3. Cheque if you have selected port where your module is connected to.

Serial port selection

Serial port selection

  1. If a module is connected to the series port merely not responding as a valid ESP8266 device, the bulletin will read slightly different (see beneath). If you have other modules connected to your PC, make sure that you are uploading code to ESP8266 and not to e.g. Arduino UNO.

Serial port selection

Series port choice

  1. To have your PC talking to ESP, select exact ESP blazon in upload menu. If option is incorrect so the upload may fail.

Board selection

Board selection

Basing on selected board type, Arduino IDE volition apply specific "reset method" to enter the board into kick loading mode. Reset methods are lath specific. Some boards exercise not have the h/westward in place to support reset by Arduino IDE. If this is the case, you need to enter such board into boot loading mode manually.

  1. Upload may exist too declining due to besides high speed. If you have long or poor quality USB cable, try reducing pick under Upload Speed.

Serial speed selection

Serial speed selection

Advanced Checks¶

  1. If you are nonetheless facing issues, examination if module is indeed inbound the boot loading fashion. Y'all can exercise it by connecting secondary USB to series converter and checking the message displayed. Attach RX and GND pins of converter to TX and GND pin of ESP as shown on example below (get fzz source).

Secondary USB to serial converter hookup

Secondary USB to serial converter hookup

Then open a terminal at 74880 baud, and look what bulletin is reported when ESP is existence reset for programming. Correct message looks as follows:

ets Jan eight 2013,rst cause:2, boot way:(1,7)

If you meet similar bulletin but dissimilar values and then decode them using Boot Messages and Modes. The primal information is contained in offset digit / three right-most $.25 of the kick way message as shown beneath.

Decoding of boot mode

Decoding of boot style

For instance message boot manner (3,3) indicates that pins GPIO2 and GPIO0 are prepare Loftier and GPIO15 is prepare LOW. This is configuration for normal performance of module (to execute awarding from flash), not for kick loading (flash programming).

Annotation: Without having this step right you lot will non be able to upload your module over a series port.

  1. Yous accept confirmed that module is in boot loading way but upload still fails. If you are using external USB to series converter, then check if it operates correctly by looping it back. This is quite simple bank check. Just connect TX and RX of your converter together like on picture below. Then open Serial Monitor and blazon some characters. If everything is fine, then you should see what you type immediately printed back on the monitor. For an ESP with USB to series converter on lath, this check may involve breaking some PCB traces. I would non exercise information technology unless being drastic. Instead attempt steps beneath.

USB to serial converter loop back

USB to serial converter loop back

  1. Next step to attempt, if not washed already, is checking detailed debug messages. Go to File > Preferences, enable Show verbose output during: upload and effort uploading again. For successful upload this log should look similar to example shown below:

C:\Users\Krzysztof\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.8/esptool.exe -vv -cd ck -cb 115200 -cp COM3 -ca 0x00000 -cf C:\Users\KRZYSZ~1\AppData\Local\Temp\build7e44b372385012e74d64fb272d24b802.tmp/Blink.ino.bin esptool v0.iv.8 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de> setting lath to ck setting baudrate from 115200 to 115200 setting port from COM1 to COM3 setting address from 0x00000000 to 0x00000000 espcomm_upload_file espcomm_upload_mem setting series port timeouts to yard ms opening bootloader resetting board trying to connect flush start setting serial port timeouts to 1 ms setting serial port timeouts to thousand ms affluent complete espcomm_send_command: sending command header espcomm_send_command: sending command payload read 0, requested 1 trying to connect flush commencement setting serial port timeouts to one ms setting serial port timeouts to one thousand ms flush complete espcomm_send_command: sending command header espcomm_send_command: sending command payload espcomm_send_command: receiving two bytes of data espcomm_send_command: receiving two bytes of data espcomm_send_command: receiving ii bytes of data espcomm_send_command: receiving 2 bytes of data espcomm_send_command: receiving 2 bytes of data espcomm_send_command: receiving ii bytes of data espcomm_send_command: receiving two bytes of data espcomm_send_command: receiving ii bytes of information Uploading 226368 bytes from to flash at 0x00000000 erasing wink size: 037440 address: 000000 first_sector_index: 0 total_sector_count: 56 head_sector_count: xvi adjusted_sector_count: 40 erase_size: 028000 espcomm_send_command: sending control header espcomm_send_command: sending control payload setting serial port timeouts to 15000 ms setting series port timeouts to 1000 ms espcomm_send_command: receiving 2 bytes of data writing flash .............................................................................................................................................................................................................................. starting app without reboot espcomm_send_command: sending command header espcomm_send_command: sending command payload espcomm_send_command: receiving 2 bytes of data closing bootloader flush showtime setting serial port timeouts to 1 ms setting serial port timeouts to 1000 ms affluent complete

Upload log may exist longer depending on number of connection attempts made by esptool. Clarify it for any anomalies to configuration yous take selected in Arduino IDE, like different serial port, reset method, baud charge per unit, etc. Resolve all noted differences.

Reset Methods¶

If you got to this signal and still run across espcomm_sync failed , then at present you need to bring in the heavy guns.

Connect scope or logic analyzer to GPIO0, RST and RXD pins of the ESP to check what's happening.

Then compare your measurements with wave-forms collected for circuits beneath. They certificate ii standard methods of resetting ESP8266 for upload, that you can select in Arduino IDE - ck and nodemcu.

Ck¶

Excursion below has been prepared to collect wave-forms for ck reset method (get fzz source). It is simpler than for nodemcu reset and therefore ofttimes used to wire up generic ESP modules on a breadboard. Check it against your wiring when comparing your measurements against wave-forms below.

Sample circuit to check ck method

Sample circuit to check ck method

The following wave-forms below show voltage signals on GPIO0 and RST pins of the ESP board when uploading the firmware.

Shut up of ck reset method indicate sequence at the beginning of upload is shown below.

Reset Method: ck, close up at the beginning of upload

Reset Method: ck, shut up at the beginning of upload

Next motion picture shows consummate upload of Blink.ino example at 921600 baud. This is quite loftier speed, so the upload takes merely virtually 8s.

Reset Method: ck, complete upload

Reset Method: ck, complete upload

Please annotation that when esptool is not able to initialize upload at the get-go time, then it retries reset procedure. Instance of one such retry is shown on moving ridge-form below.

Reset Method: ck, complete upload

Reset Method: ck, consummate upload

Each retry is reported in upload log as follows:

                                resetting                board                trying                to                connect                flush                start                setting                serial                port                timeouts                to                1                ms                setting                serial                port                timeouts                to                1000                ms                flush                consummate                espcomm_send_command                :                sending                command                header                espcomm_send_command                :                sending                command                payload                read                0                ,                requested                1              

Presented circuit has one important limitation when it comes to work with Arduino IDE. After opening Series Monitor (Ctrl-Shift-M), both RTS and DTR lines are permanently pulled down. Every bit RTS line is connected to Residual input of ESP, the module is hold in reset country / not able to run. Therefore afterwards uploading module, you demand to disconnect both lines or use unlike series terminal program that is not pulling downward RTS and DTR lines. Otherwise the module volition get stuck waiting for releasing the Remainder betoken and you will see zero on the Serial Monitor.

As for dissimilar serial terminal program you tin check Arduino IDE add-on Serial Monitor for ESP8266 developed past user [@mytrain](https://github.com/mytrain) and discussed in #1360.

If you adopt external concluding program, then for Windows users nosotros can recommend free and handy Termite.

Nodemcu¶

Nodemcu reset method is named after NodeMCU board where it has been introduced for the first time. It overcomes limitations with handling of RTS and DTR lines discussed for ck reset method above.

Sample circuit to measure wave-form is shown beneath (get fzz source).

Sample circuit to check nodemcu reset method

Sample excursion to check nodemcu reset method

Shut up of voltage signals on GPIO0 and RST pins at the beginning of firmware upload is shown beneath.

Reset Method: nodemcu, close up at the beginning of upload

Reset Method: nodemcu, close up at the kickoff of upload

Please note that the reset sequence is about 10x shorter comparing to ck reset (about 25ms vs. 250ms).

Adjacent picture covers complete upload of Glimmer.ino example at 921600 baud. Except for difference of the reset signal sequence, the consummate upload looks similar to that of ck.

Reset Method: nodemcu, complete upload

Reset Method: nodemcu, complete upload

A sample wave-course below shows another upload of Glimmer.ino example at 921600 baud, simply with two reset retries.

Reset Method: nodemcu, reset retries

Reset Method: nodemcu, reset retries

If you are interested how nodemcu reset method is implemented, then bank check circuit beneath. As indicated information technology does not pull to basis RTS and DTR lines once you open up Serial Monitor in Arduino IDE.

Implementation of nodemcu reset

Implementation of nodemcu reset

It consists of two transistors and resistors that y'all can locate on NodeMCU board on right. On left yous tin can meet complete circuit and the truth table how RTS and DTR signals of the serial interface are translated to RST and GPIO0 on the ESP. For more details please refer to nodemcu repository on GitHub.

I'm Stuck¶

Hopefully at this point you lot were able to resolve espcomm_sync failed issue and at present enjoy quick and reliable uploads of your ESP modules.

If this is still not the example, then review once more all discussed steps in the checklist beneath.

Initial Checks

  • [ ] Is your module connected to serial port and visible in IDE?

  • [ ] Is continued device responding to IDE? What is exact message in debug window?

  • [ ] Have you selected correct ESP module blazon in Lath carte? What is the selection?

  • [ ] Accept you lot tried to reduce upload speed? What speeds have you tried?

Advanced Checks

  • [ ] What bulletin is reported by ESP at 74880 baud when entering boot loading way?

  • [ ] Have y'all checked your USB to serial converter by looping it back? What is the result?

  • [ ] Is your detailed upload log consistent with settings in IDE? What is the log?

Reset Method

  • [ ] What reset method do you use?

  • [ ] What is your connection diagram? Does it match diagram in this FAQ?

  • [ ] What is your moving ridge-form of board reset? Does it match wave-form in this FAQ?

  • [ ] What is your wave-form of complete upload? Does it match wave-form in this FAQ?

Software

  • [ ] Do you use the latest stable version of esp8266 / Arduino? What is it?

  • [ ] What is the name and version of your IDE and O/S?

If you lot are stuck at certain footstep, and then mail service this list on ESP8266 Customs Forum asking for support.

Conclusion¶

With variety of bachelor ESP8266 modules and boards, as well every bit possible connectedness methods, troubleshooting of upload issues may have several steps.

If you are a beginner, then utilise boards with integrated power supply and USB to serial converter. Check carefully bulletin in debug window and act accordingly. Select your verbal module type in IDE and try to adjust upload speed. Check if board is indeed inbound kick loading mode. Check operation of your USB to serial converter with loop dorsum. Analyze detailed upload log for inconsistencies with IDE settings.

Verify your connexion diagram and wave-form for consistency with selected reset method.

If you get stuck, then ask customs for support providing summary of all completed checks.

Test stand used during checking of ck reset method

Test stand up used during checking of ck reset method

Test stand used for checking of ck reset method is shown above.

No any ESP module has been harmed during training of this FAQ detail.

FAQ listing :dorsum: