-->
Page 1 of 2

NodeMCU: Failed uploading: uploading error: exit status 2

PostPosted: Sat Mar 04, 2023 1:33 am
by sntshk
Hi there,

First of all, I have no background in electronics. Before buying NodeMCU, I have done some very basic sensor interfacing using Raspberry Pi.

My purpose of buying NodeMCU is for home automation. I have an ESP8266 NodeMCU CP2102 Board. Here are some more information about my setup:

1. I am using Ubuntu.
2. I have already made USB connection to the controller.
3. I have downloaded Arduino IDE by following this tutorial: https://www.youtube.com/watch?v=MFencFdpV5g

This is the code I am using:

Code: Select allvoid setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(1000);
  Serial.print('a');
}

void loop() {
  // put your main code here, to run repeatedly:

}


And this is the error I am getting when trying to upload the sketch:

Code: Select all. Variables and constants in RAM (global, static), used 28104 / 80192 bytes (35%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ DATA     1496     initialized variables
╠══ RODATA   920      constants       
╚══ BSS      25688    zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 59667 / 65536 bytes (91%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ ICACHE   32768    reserved space for flash instruction cache
╚══ IRAM     26899    code in IRAM   
. Code in flash (default, ICACHE_FLASH_ATTR), used 232100 / 1048576 bytes (22%)
║   SEGMENT  BYTES    DESCRIPTION
╚══ IROM     232100   code in flash   
esptool.py v3.0
Serial port /dev/ttyUSB0
Failed uploading: uploading error: exit status 2


Can you guys guide me to troubleshoot this?

Re: NodeMCU: Failed uploading: uploading error: exit status

PostPosted: Mon Mar 06, 2023 6:29 am
by btidey
The exit status of 2 is just the standard error status of esptool.py that does the connection and uploading.

The fact that there are no other messages from esptool.py would indicate that it did not get going which would suggest a problem with it using the usb serial port and probably associated with the usb driver. This needs to support the CH340 usb serial on the NodeMCU. Most linux installs should support this but some may require you to install one.

Check out https://learn.sparkfun.com/tutorials/ho ... vers/linux

Re: NodeMCU: Failed uploading: uploading error: exit status

PostPosted: Wed May 03, 2023 8:19 pm
by spinabove
No other messages from esptool.py show it did not start up, which points to a problem with the usb serial port, most likely caused by the usb driver. This must work with the NodeMCU's CH340 usb serial. Most distributions of Linux should automatically have this, but you may need to install it in some.

Re: NodeMCU: Failed uploading: uploading error: exit status

PostPosted: Sun Jun 11, 2023 11:56 pm
by paxtonleiny
There are no other notifications from esptool.py indicating that it failed to launch, which suggests a USB serial port issue that was most likely brought on by the USB driver. The CH340 USB serial port on the NodeMCU must support this. This should come pre-installed in the majority of Linux variants, though you might need to install it in some.