Saumit Paul
Saumit Paul

Reputation: 79

How to fix "SerialTimeoutException: Write timeout" error with NodeMCU and arduino ide

I was trying to build a simple IoT product using a nodemcu, an LED, and the blynk app. This is the most basic thing you can do with a nodemcu. However, when I was uploading the example from the Blynk library, I was getting this error.

It seems to be a port error but I still can't comprehend any of it.

The error messages are as follows:

Arduino: 1.8.9 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Sketch uses 279792 bytes (26%) of program storage space. Maximum is 1044464 bytes.
Global variables use 28848 bytes (35%) of dynamic memory, leaving 53072 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.6
2.6
esptool.py v2.6
Serial port COM3
Connecting...
Traceback (most recent call last):
  File "C:\Users\saumi\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.1/tools/upload.py", line 25, in <module>
    esptool.main(fakeargs)
  File "C:/Users/saumi/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 2653, in main
    esp.connect(args.before)
  File "C:/Users/saumi/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 460, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
  File "C:/Users/saumi/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 440, in _connect_attempt
    self.sync()
  File "C:/Users/saumi/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 379, in sync
    timeout=SYNC_TIMEOUT)
  File "C:/Users/saumi/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 322, in command
    self.write(pkt)
  File "C:/Users/saumi/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/saumi/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

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

Upvotes: 7

Views: 47662

Answers (9)

Mautoz
Mautoz

Reputation: 79

I've tried a different USB port and then windows reinstalled CH340 driver automatically, now everything works.

Upvotes: 1

Yvan Zhu
Yvan Zhu

Reputation: 1

I solve this by adding --trace.
don't know why

Upvotes: 0

Edem
Edem

Reputation: 1

For me, it's my computer's Bluetooth that was using the same port. Once disabled everything worked fine.

Upvotes: 0

9dubs
9dubs

Reputation: 67

Okay so first time around using ESP8266, I did the initial setup and got this error. Lucky enough, changing the port did the job for me.

I had three ports on my pc, COM3, COM5 and COM6. COM3 did throw a fatal connection timeout error. I then switched to COM5 which threw this particular error of unable to write. So I unplugged the USB, plugged it to the other physical port on my pc and switched to COM6 on my IDE. That seemed to have fixed the issue.

also in case you're wondering the IDE version I'm using is 1.8.8 and the drivers are the latest ones.

Upvotes: 0

Wesley de Sousa
Wesley de Sousa

Reputation: 11

For me worked... to disable the current port with this problem and enable again. I went in "device manager", seached for my port that were "USB-SERIAL CH340 (COM3)" and disable it. then, I enable again and try to do upload.

Upvotes: 1

Boommeister
Boommeister

Reputation: 2127

I had a SerialTimeoutException: Write timeout exception, too. I had the wrong port selected. The solution after watching this video https://www.youtube.com/watch?v=jCghjrUWPu4 was to check in the arduino IDE which ports are shown when I plug in the MCU USB cable to my laptop, then unplug it and check which port was gone after unplugging it. This was the right port.

Upvotes: 0

Jedak22
Jedak22

Reputation: 31

The boards will program the first time, but after that you get a range of errors. Reading up on the ESP8266 I found that GPIO0 pin is used for a range of things and to re-program the chip you need to get into program mode. To do this remove power, then ground GPIO0 pin, then power up the board again, remove the gnd from GPIO0 pin and the IDE will download again. So you need to get the MCU into flash mode.

Better still, remove power from the board. Press and hold the flash button, power up the nodeMCU and then it will download again from the IDE.

Upvotes: 3

Venkat Papana
Venkat Papana

Reputation: 4937

Changing the USB cable worked for me!!!

Upvotes: 7

Sina Mirshafiei
Sina Mirshafiei

Reputation: 312

Change your Upload speed from 115200 to 9600! I did this, and it worked fine

Upvotes: 3

Related Questions