I am sorry for posting this question for the nth time but I am still not able to find a solution for this error.

I am trying to upload the WiFiScan(Arduino IDE example program)program code to ESP8266 using Arduino Mega 2560. I followed the procedure given here. And I tried uploading it with "Generic ESP8266 Module" and "Adafruit HUZZAH ESP8266" selected as the Board. But I am still getting the following error.

trying to connect
  espcomm_send_command: sending command header
  espcomm_send_command: sending command payload
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed

Edited to add: enter image description here


ESP8266 - Arduino Mega2560

Tx - Tx1(Pin 18)

Rx - Rx1(Pin 19)

Gnd - Gnd

Vcc - 3.3V (Directly from Arduino's 3.3V pin)

CH_PD - 3.3V (Directly from Arduino's 3.3V pin)

GPIO0 - Push button K2 (refer photo)

RST - Push button K1

While pressing the K2 button(Flash button - GPIO0), I clicked the K1 button(Reset button - RST) and then released K2. According to the document, this should bring the ESP8266 to flash mode. Now when I upload the code, it throws the above error.

  • That tutorial doesn't have anything to do with an Arduino Mega and you didn't tell us how you wired it. We can only guess what is wrong.
    – gre_gor
    Commented Sep 12, 2017 at 15:47
  • Add a photo clearly showing your devices and wiring and you might get a better response.
    – Squats
    Commented Sep 12, 2017 at 22:52
  • As suggested, I've included the connection details in the question. @gre_gor, Squats Commented Sep 13, 2017 at 6:34
  • tx to tx and rx to rx ??? have you tried the obvious? tx to rx and rx to tx, seeing as that's how serial connections work Commented Feb 11, 2018 at 1:02

1 Answer 1


After googling for several hours, I was able to figure out the reason. Thanks to this link. Transferring data to ESP8266 with Arduino acting as USB to Serial converter did not work. Using a USB to TTL converter, and following this link you can easily transfer data to ESP8266.

  • My Arduino Mega worked as a USB to Serial converter just fine...
    – Fusseldieb
    Commented Sep 13, 2017 at 12:02
  • @Fusseldieb could you please tell me how you uploaded data using Arduino Mega? Commented Sep 13, 2017 at 12:04
  • I just plugged TX to TX, RX to RX, GND to GND and shorted RST to GND, causing the Arduino to loop continuously on reset. I also chosen "Tools" -> "Programmer" -> "Arduino as ISP". Then I uploaded the sketch just fine.
    – Fusseldieb
    Commented Sep 13, 2017 at 12:06
  • I just plugged TX to TX, RX to RX - no you didn't Commented Mar 12, 2018 at 22:40
  • Why do I see so many people today with the same Tx-Tx Rx-Rx problem. It's like there was something in the weather today. Think of it this way, when you have a conversation with someone, do you talk into their mouth and listen to their ears?
    – Delta_G
    Commented May 1, 2020 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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