ESP8266 nodemcu v3 can't upload program

hi
i’m currently trying to make a simple project using esp8266, however i simply can’t upload my program.

Program:

#include <Arduino.h>

#define LED 2

void setup() {
  Serial.begin(115200);
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  Serial.println("LED is on");
  delay(1000);
  digitalWrite(LED, LOW);
  Serial.println("LED is off");
  delay(1000);
}

platformio.ini:

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino
upload_protocol = esptool
upload_port = COM3
monitor_speed = 115200

when i try to upload i get this in terminal:

Processing esp12e (platform: espressif8266; board: esp12e; framework: arduino)
--------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (4.2.1) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 @ 3.30102.0 (3.1.2) 
 - tool-esptool @ 1.413.0 (4.13) 
 - tool-esptoolpy @ 1.30000.201119 (3.0.0) 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 1.200.0 (2.0) 
 - toolchain-xtensa @ 2.100300.220621 (10.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio\build\esp12e\firmware.elf
Checking size .pio\build\esp12e\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  34.4% (used 28184 bytes from 81920 bytes)
Flash: [===       ]  25.5% (used 266167 bytes from 1044464 bytes)
Configuring upload protocol...
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port...
Using manually specified: COM3
Uploading .pio\build\esp12e\firmware.bin
esptool.py v3.0
Serial port COM3
Traceback (most recent call last):
  File "C:\Users\Seriegal\.platformio\packages\tool-esptoolpy\esptool.py", line 3969, in <module>
    _main()
  File "C:\Users\Seriegal\.platformio\packages\tool-esptoolpy\esptool.py", line 3962, in _main
    main()
  File "C:\Users\Seriegal\.platformio\packages\tool-esptoolpy\esptool.py", line 3551, in main
    esp = chip_class(each_port, initial_baud, args.trace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Seriegal\.platformio\packages\tool-esptoolpy\esptool.py", line 271, in __init__
    self._port = serial.serial_for_url(port)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Seriegal\.platformio\penv\Lib\site-packages\serial\__init__.py", line 90, in serial_for_url
    instance.open()
  File "C:\Users\Seriegal\.platformio\penv\Lib\site-packages\serial\serialwin32.py", line 64, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)
*** [upload] Error 1

at this point i have no idea what to do about this

Access denied usually means that another program still has that COM port open; Close any other serial monitors or serial plotters in the e.g. Arduino IDE.

Sometimes, Antivirus can interfere, too.

I don’t have arduino installed, all others serial monitors are closed. I also tried uploading with antivirus off, but same results.

Is the Arduino IDE able to upload?

Another possibility is that you have a wrong driver for the USB-to-UART converter that is on your ESP8266 board installed. Is it a CH340 or a CP2102 or a FTDI232 or some other chip?

I have ch340 installed and it is detected:
image

I also tested conection with bray terminal, however I only get some results using baudrate 74888. AT command didn’t worked but it spiled this text:

ets Jan 8 2013, rst cause:2, boot mode:[3,7]

load 0x4010f000, len 3460, room 16
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4
tail 4
chksum 0xc9
csum 0xc9
v00040b50
~ld

On Arduino IDE i get same error

A fatal esptool.py error occurred: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)

I managed to fix it. It was a driver issue. Latest version of ch340 driver don’t work to well with win11. Rolling back this driver fixes both arduino ide and platformio.