Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Upload Problem for NodeMCU

ZJ0518

Newbie
Joined
Jun 24, 2019
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
27
Hi, I faced such issue while uploading my code from arduino IDE to my NODEMCU Lua V3 ESP8266 WIFI.

Error:
Code:
Executable segment sizes:
IROM   : 248372          - code in flash         (default or ICACHE_FLASH_ATTR)
IRAM   : 27960   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...)
DATA   : 1320  )         - initialized variables (global, static) in RAM/HEAP
RODATA : 2224  ) / 81920 - constants             (global, static) in RAM/HEAP
BSS    : 25552 )         - zeroed variables      (global, static) in RAM/HEAP
Sketch uses 279876 bytes (26%) of program storage space. Maximum is 1044464 bytes.
Global variables use 29096 bytes (35%) of dynamic memory, leaving 52824 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port COM4
Traceback (most recent call last):
  File "C:\Users\Zhang Jie\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2889, in main
    esp = chip_class(each_port, initial_baud, args.trace)
  File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 237, in __init__
    self._port = serial.serial_for_url(port)
  File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\__init__.py", line 88, in serial_for_url
    instance.open()
  File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\serialwin32.py", line 78, in open
    self._reconfigure_port()
  File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\serialwin32.py", line 222, in _reconfigure_port
    'Original message: {!r}'.format(ctypes.WinError()))
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.',
This is my code to interface the Ultrasonic Sensor and NodeMCU.

C:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "-2fX0ap9fZmfV1sZLpw06ab6WNvagomb";
char ssid[] = "BlazingSpeed-TIME2.4G";
char pass[] = "1bwf3988";

const int trigPin = D0;
const int echoPin = D1;

long duration;
int distance;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Blynk.begin(auth,ssid,pass);
  pinMode(trigPin,OUTPUT);
  pinMode(echoPin,INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(trigPin,LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin,HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin,LOW);
  duration = pulseIn(echoPin,HIGH);
  distance = duration*0.34/2;

  if (distance <= 10){
    Blynk.virtualWrite(V0,255);
  }
  else{
    Blynk.virtualWrite(V0,0);
  }
  if (distance <= 6){
    Blynk.virtualWrite(V1,255);
  }
  else{
    Blynk.virtualWrite(V1,0);
  }
  if (distance <= 3){
    Blynk.virtualWrite(V2,255);
  }
  else{
    Blynk.virtualWrite(V2,0);
  }
  Blynk.run();
}
 
Last edited by a moderator:

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,374
Helped
4,727
Reputation
9,469
Reaction score
4,496
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
122,642
The source code isn't the problem although you might need to change 'distance' to a float type to make the calculation work.
The error on the last two lines indicates a problem with the serial port on the computer you are using to program the device. Basically it can't access the port you have specified.

Incidentally, you should change your 'auth[]' code (get a new one from Blynk) now it has been published. You should keep it secret as now anyone using it can access your device!

Brian.
 

ZJ0518

Newbie
Joined
Jun 24, 2019
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
27
The source code isn't the problem although you might need to change 'distance' to a float type to make the calculation work.
The error on the last two lines indicates a problem with the serial port on the computer you are using to program the device. Basically it can't access the port you have specified.

Incidentally, you should change your 'auth[]' code (get a new one from Blynk) now it has been published. You should keep it secret as now anyone using it can access your device!

Brian.

Hi Brian,
Does that means that the USB cable I used or the NodeMCU module is faulty?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,374
Helped
4,727
Reputation
9,469
Reaction score
4,496
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
122,642
I don't use Windows but from the error report it would seem the problem is that the computer is unable to see the serial port so it suggests either a configuration error in the PC or the cable is faulty. It is unlikely to be a faulty NodeMCU but not impossible.

Check the NodeMCU has 5V between the 'Vin' pin and the 'GND' pin when the USB cable is plugged in. Also check the 3.3V is present between the '3V3' pin and 'GND'. If you check the USB port (in the Windows control panel I think) it should report seeing the UART, most likely reporting it as a CP2012.

Brian.
 
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top