Arduino: Getting Error While Code Upload - NODEMCU ESP8266

Created on 18 May 2019  Â·  29Comments  Â·  Source: esp8266/Arduino

Hi,
While am trying to upload the code from Arduino IDE to NODEMCU ESP8266 board getting some error can anyone help me to clear this error.

Program

#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>

char ssid[] = "MUGESH";
const char* password = "87654321";

void setup() {
  Serial.begin(9600);         //Serial connection
  WiFi.begin(ssid, password);   //WiFi connection

  while (WiFi.status() != WL_CONNECTED) {  //Wait for the WiFI connection completion
    delay(500);
    Serial.println("Waiting for connection");
  }
  Serial.println("WIFI Connected with : " + WiFi.localIP());
}

void loop() {
  if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
    HTTPClient http;    //Declare object of class HTTPClient
    http.begin("https://jsonplaceholder.typicode.com/posts");      //Specify request destination
    http.addHeader("Content-Type", "text/plain");  //Specify content-type header
    int httpCode = http.GET();   //Send the request
    String payload = http.getString();                  //Get the response payload
    StaticJsonDocument<500> jsonDoc;
//    JsonObject& jsonObj = jsonBuffer.parseObject(payload);
    deserializeJson(jsonDoc, payload);
    serializeJsonPretty(jsonDoc, Serial);
    Serial.println(httpCode);   //Print HTTP return code
    Serial.println(payload);    //Print request response payload
    http.end();  //Close connection
  } else {
    Serial.println("Error in WiFi connection");
  }
  delay(30000);  //Send a request every 30 seconds
}

Error In Text

Sketch uses 287632 bytes (27%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27156 bytes (33%) of dynamic memory, leaving 54764 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.6
2.6
esptool.py v2.6
Serial port COM7
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 84:0d:8e:86:3c:a9
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 291792 bytes to 210262...

Writing at 0x00000000... (7 %)Traceback (most recent call last):
  File "C:\Users\IN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.1/tools/upload.py", line 25, in <module>
    esptool.main(fakeargs)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 2698, in main
    operation_func(esp, args)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 2158, in write_flash
    esp.flash_defl_block(block, seq, timeout=DEFAULT_TIMEOUT * ratio * 2)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 104, in inner
    return func(*args, **kwargs)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 632, in flash_defl_block
    self.ESP_FLASH_DEFL_DATA, struct.pack('<IIII', len(data), seq, 0, 0) + data, self.checksum(data), timeout=timeout)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 354, in check_command
    val, data = self.command(op, data, chk, timeout=timeout)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 322, in command
    self.write(pkt)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 285, in write
    self._port.write(buf)
  File "C:/Users/IN/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/pyserial\serial\serialwin32.py", line 323, in write
    raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout
the selected serial port serial.serialutil.SerialTimeoutException: Write timeout
 does not exist or your board is not connected

Error Image

image

Most helpful comment

I think I just solved this same issue. There is text on my board saying to use a 9600 Baud. So I changed the upload speed to 9600. When I change the upload speed back to 115200 the error goes away.

All 29 comments

The error message from the uploader tells you the problem:

the selected serial port does not exist or your board is not connected

Looks like a power or connectivity problem and the 8266 disconnects during upload. Try a different usb port and cable, then please use the forum www.esp8266.com if you want add'l assistance, as this is not related to the core.

@earlephilhower After changing the USB port and the cable also the same error persist, even i have flashed my Firmware too.

did you managed to fix it?
it happened to me too after Arduino libray update

@shrakanis Same here. This is the first time I've used Node MCU I bought last week and seems that there is no fix available yet after days of searching on the Web.

I have the same error.
but before write that I tested...
3 usb cables (all cables with data support, not only power)
3 usb ports with all cables
and then I bought a new nodemcu v3
I did same test but using arduino ide 1.8.8
I runned arduino ide and compile with my user and then with root.

but nothing has been running ok.

soft info

arduino ide version: 1.8.9
os: ubuntu 18.04.2 LTS (Bionic Beaver)
kernel: 4.18.0-20-generic
Sketch uses 257672 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 26572 bytes (32%) of dynamic memory, leaving 55348 bytes for local variables. Maximum is 81920 bytes.
Sketch uses 257672 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 26572 bytes (32%) of dynamic memory, leaving 55348 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.6
2.6
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: ca:ac:11:43:aa:10
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 261824 bytes to 191216...
Writing at 0x00000000... (8 %)Traceback (most recent call last):
  File "/root/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/upload.py", line 25, in 
    esptool.main(fakeargs)
  File "/root/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool/esptool.py", line 2698, in main
    operation_func(esp, args)
  File "/root/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool/esptool.py", line 2158, in write_flash
    esp.flash_defl_block(block, seq, timeout=DEFAULT_TIMEOUT * ratio * 2)
  File "/root/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool/esptool.py", line 104, in inner
    return func(*args, **kwargs)
  File "/root/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/esptool/esptool.py", line 632, in flash_defl_block
    self.ESP_FLASH_DEFL_DATA, struct.pack('

                    

Hi @shrakanis / @snow-drop
After downgrading the ESP8266 version from 2.5.2 to 2.5.1 my issue is resolved, check once the same for you people also.
https://github.com/esp8266/Arduino/issues/6110#issue-445707173

Yesterday did the same ;) thanx

@Mugesh-Rajaram Thank you very much! It worked for me too.

Thanks, that worked for me.

I think I just solved this same issue. There is text on my board saying to use a 9600 Baud. So I changed the upload speed to 9600. When I change the upload speed back to 115200 the error goes away.

still i'm getting the same error ...i changed the baud rate , esp8266 version to 5.2.1 in board manager....Please help me to solve this error..

Same errors here, version 2.5.2 of boards seems to be bugged, 2.5.1 is ok.
I have pb with ESP01 and nodemcu with 2.5.2.

The cause is esptool.py v2.6 i guess :
Bad display (no scrolls when upload is in progress)
Bad initialization : soft reset doesn't work on ESP just after download.

I think I just solved this same issue. There is text on my board saying to use a 9600 Baud. So I changed the upload speed to 9600. When I change the upload speed back to 115200 the error goes away.

This worked for me to fix serial communication issue with ESP8266 using Arduino IDE 1.8.9 on Ubuntu Release 18.04.1 LTS (Bionic Beaver) 32-bit.

Thank you guys!!It worked for me too...when i changed the baud rate......

On Wed, Jul 10, 2019 at 7:15 PM SunnyB notifications@github.com wrote:

I think I just solved this same issue. There is text on my board saying to
use a 9600 Baud. So I changed the upload speed to 9600. When I change the
upload speed back to 115200 the error goes away.

This worked for me to fix serial communication issue with ESP8266 using
Arduino IDE 1.8.9 on Ubuntu Release 18.04.1 LTS (Bionic Beaver) 32-bit.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/esp8266/Arduino/issues/6110?email_source=notifications&email_token=AMRJZLFC3AON5ZGXOPITUPLP6XRXVA5CNFSM4HN2DOLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQDDI#issuecomment-510067085,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMRJZLCX34HCZDMCFCBXGT3P6XRXVANCNFSM4HN2DOLA
.

--
Thanks & Regards,

Sathya Balakrishnan
ICT facilitator
[image: View Full Size Image][image: View Full Size Image]

Hi @shrakanis / @snow-drop
After downgrading the ESP8266 version from 2.5.2 to 2.5.1 my issue is resolved, check once the same for you people also.
#6110 (comment)

this suggestion worked. Thanks

After downgrading and changing the upload speed back to 115200 the issue resolved.try this one once!!!

use baud 115200 worked for me when flashing micropython to nodemcu v3 board. thanks @jwrussert

I had the same problem, all I had to do to fix it was to switch the port
Tools=>Port=>COM5

still i'm getting the same error ...i changed the baud rate , esp8266 version to 5.2.1 in board manager....Please help me to solve this error..

Try using another USB port. In my case this was the problem i changed the port and the problem got solved. And make sure the you selected the right port in the arduino IDE. Hope this will help someone.

Thanks a lot for your help,

Thank you so much.

On Fri, Mar 27, 2020 at 2:47 PM vimalswaroopj notifications@github.com
wrote:

Try using another USB port. In my case this was the problem i changed the
port and the problem got solved. Hope this will help someone.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/esp8266/Arduino/issues/6110#issuecomment-604897343,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJOQ5PG5UVEM3Q7DPCHMWXDRJRVMNANCNFSM4HN2DOLA
.

--
Thanks and Regards,

PITCHAI MUTHU.M | Sr.IoT Analyst

my esp8266 version is 6.2.3 and the error says the selected serial port serial.serialutil.serialtimeoutexception:write timeout doest not exist or your board is not connected. What to do ?
mp01

my esp8266 version is 6.2.3 and the error says the selected serial port serial.serialutil.serialtimeoutexception:write timeout doest not exist or your board is not connected. What to do ?
mp01

Try turning off your Bluetooth! The "Standard Serial over Bluetooth Link" may have the same COM port number as the ESP8266 and It may stop it from getting programmed right.

who are you

On Mon, Jul 20, 2020, 13:41 Mehdi Bolourian notifications@github.com
wrote:

my esp8266 version is 6.2.3 and the error says the selected serial port
serial.serialutil.serialtimeoutexception:write timeout doest not exist or
your board is not connected. What to do ?
[image: mp01]
https://user-images.githubusercontent.com/59787924/79077124-a2aca080-7d1c-11ea-836a-62b5d0d4df54.png

Try turning off your Bluetooth! The "Standard Serial over Bluetooth Link"
may have the same COM port number as the ESP8266 and It may stop it from
getting programmed right.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/esp8266/Arduino/issues/6110#issuecomment-660905216,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ALWT2GR7K4VV66H6PJTIRA3R4QC35ANCNFSM4HN2DOLA
.

how to downgrade versions can anybody help?

how to downgrade versions can anybody help?
Click Boards Manager
Tools=>Board: =>Boards Manager...
In the search bar type ESP8266
Choose esp8266 by ESP8266 community.
You will see the version you currently have.
On the bottom left corner you will have a drop down menu where you can pick the version you want to use.

I'm having the same problem, but the upload works fine when I connect another ESP8266. The "faulty" one are beeing recognized by Windows, blinks when I press the RST button, apparently normal, but the upload got stuck at "Connecting...", and then I receive the "Write timeout" error. Does anyone have any suggestions?

I'm having the same issue "the selected serial port _ does not exist or your board is not connected" regardless if I use an Arduino Nano, Uno, or FTDI. I've changed the baud rates as suggested above and even downgraded the the esp8266 firmware to 2.5.1 too , but nothing seems to work. Right now I have the ESP8266 connected to the FTDI ft232rl. I'm using IDE 1.8.13 (Windows).

I've been following schematics online for connections, but if someone could provide details on IDE config, etc. that would be super helpful at this point--I'll gladly switch back to the Nano or Uno if that's easier.

Thanks in advance.

EDIT: I've switched back to the Uno (more documentation it seems), switched out some jumper wires, and even replaced the esp8266 board. Nothing new.

Hi,
I'm having same issue. All suggestion already done. Downgrade to 2.5.1, change usb cable, change baud rate 9600 or 115200.
Could you share setting of working board manager?

Sketch uses 257696 bytes (51%) of program storage space. Maximum is 499696 bytes.
Global variables use 26572 bytes (32%) of dynamic memory, leaving 55348 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.6
2.6
esptool.py v2.6
Serial port COM4
Connecting...
Traceback (most recent call last):
File "C:UsersuserAppDataLocalArduino15packagesesp8266hardwareesp82662.5.1/tools/upload.py", line 25, in
esptool.main(fakeargs)
File "C:/Users/user/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptoolesptool.py", line 2653, in main
esp.connect(args.before)
File "C:/Users/user/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptoolesptool.py", line 460, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
File "C:/Users/user/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptoolesptool.py", line 440, in _connect_attempt
self.sync()
File "C:/Users/user/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptoolesptool.py", line 379, in sync
timeout=SYNC_TIMEOUT)
File "C:/Users/user/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptoolesptool.py", line 322, in command
self.write(pkt)
File "C:/Users/user/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptoolesptool.py", line 285, in write
self._port.write(buf)
File "C:/Users/user/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/pyserialserialserialwin32.py", line 323, in write
raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout
the selected serial port serial.serialutil.SerialTimeoutException: Write timeout
does not exist or your board is not connected

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SmartSouth picture SmartSouth  Â·  3Comments

tiestvangool picture tiestvangool  Â·  3Comments

gosewski picture gosewski  Â·  3Comments

Marcelphilippeandrade picture Marcelphilippeandrade  Â·  3Comments

Chagui- picture Chagui-  Â·  3Comments