1

I was trying to upload code to my esp8266 from the Arduino IDE and it gives me this error:

 esptool.py v2.8 Serial port COM6 Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last): File "C:\Users\arcae_000\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3/tools/upload.py", line 65, in <module> esptool.main(cmdline) File "C:/Users/arcae_000/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 2890, in main esp.connect(args.before) File "C:/Users/arcae_000/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 483, in connect raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error)) esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header 

I have the esp8266 board extension installed on the Arduino IDE and set to 'Generic ESP8266 Module'. I have tried changing the upload speed but it still fails. This is the code I used:

#include <ESP8266WiFi.h> const char* ssid = "SSID";//type your ssid const char* password = "PASSWORD";//type your password int ledPin = 2; // GPIO2 of ESP8266 WiFiServer server(80); void setup() { Serial.begin(115200); delay(10); pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); // Connect to WiFi network Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); // Start the server server.begin(); Serial.println("Server started"); // Print the IP address Serial.print("Use this URL to connect: "); Serial.print("http://"); Serial.print(WiFi.localIP()); Serial.println("/"); } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data Serial.println("new client"); while(!client.available()){ delay(1); } // Read the first line of the request String request = client.readStringUntil('\r'); Serial.println(request); client.flush(); // Match the request int value = LOW; if (request.indexOf("/LED=ON") != -1) { digitalWrite(ledPin, HIGH); value = HIGH; } if (request.indexOf("/LED=OFF") != -1){ digitalWrite(ledPin, LOW); value = LOW; } // Set ledPin according to the request //digitalWrite(ledPin, value); // Return the response client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); // do not forget this one client.println("<!DOCTYPE HTML>"); client.println("<html>"); client.print("Led pin is now: "); if(value == HIGH) { client.print("On"); } else { client.print("Off"); } client.println("<br><br>"); client.println("Click <a href=\"/LED=ON\">here</a> turn the LED on pin 2 ON<br>"); client.println("Click <a href=\"/LED=OFF\">here</a> turn the LED on pin 2 OFF<br>"); client.println("</html>"); delay(1); Serial.println("Client disonnected"); Serial.println(""); } 

(I have changed the SSID and Password values) I have searched every website I could find but I still couldn't fix it. The esp8266 is in flash mode. Also, I know that the esp8266 is not broken. I would appreciate any help.

1
  • is the esp8266 in flashing mode? (io 0 LOW at startup) Commented Dec 24, 2019 at 8:34

2 Answers 2

1

Can you post your upload settings?

Things that might be wrong:

  • You maybe have a NODEMCU module, try to switch to that board in upload settings.

  • Did you confirm that a new COM-port shows up when you plugin your ESP?

  • Do you have the correct COM-port selected?

These are my ESP8266 settings, here

In case you actually have a NODEMCU, if nothing is working from above, try updating the firmware using all these instructions : https://github.com/nodemcu/nodemcu-firmware

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I fixed it by updating the firmware
0

I also facing same error, I found this solution and its work for me. The most common reason for the board not being displayed on a port are a failing USB connection. The board needs to be connected to your computer with a data USB cable. Make sure the USB cable is not damaged. Test your cable with a different device or try using a different cable.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.