ESP8266 Port Monitor Error

I am experiencing a problem and I am not sure what has happened. I am using a Lolin(Wemos) D1 R2 Mini board with ESP8266. I have used these boards (6 different ones) for several weeks while building a project. I had very successful results up until today. I needed to modify/verify some code and now they are not connecting to the serial port COM6. I had them connected about 4-5 days ago without issue and today I have issues. I can connect NODEMCU boards without issue. I have rebooted the computer multiple times, uninstalled the Arduino IDE and reinstalled a full release. I tried a Arduino Nightly release edition (5/2/23) all give the same issue. I know the USB port and cable are good. I have also switched physical ports on computer. I am not using USB Hub. I know the code is not the problem for it has been in use for several weeks without issue.
Error message upon trying to upload:

"esptool.py v3.0 Serial port COM6

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)"

Using the serial monitor, the IDE will scan for a few seconds then come back with the error message:
"Port monitor error command 'open' failed. Invalid serial port. Could not connect to COM6 serial port."

Please help...thanks in advance

1 Like

try plugging the device into a different USB port

it may be picking up the wrong driver sometimes I have to uninstall the COM ports to make a device work

  1. open Device manager and expand Ports COM & LPT)

  2. click View > Show Hidden Devices – you get list such as
    image

  3. right click on each COM port - click Uninstal Device – click Uninstall

  4. when complete plug in your device and hopefully the COM port should appear

Hi, sorry for threadjacking but I'm facing the same issue as OP too. Have tried your method but still same error ._.

as you unplug/plugin the USB does the COM port disappear/appear
what arduino are you using?
what is the error report?

Yeap, it's appears correctly as CH340. I am using a nodemcu esp8266. Exact same error as OP.

have you entered http://arduino.esp8266.com/stable/package_esp8266com_index.json into the β€œAdditional Boards Manager URLs” field, see how-to-install-esp8266-board-arduino-ide
and then used the Board manager to instal the ESP8266 Community

Yeap have done all of the above previously during first installation. Similar to OP, I actually had no issues with my board previously. Was working for the last few weeks and only faced an issue today while trying to upload an updated code.

can you still load Blink example and other programs etc
post the code which is giving problems?

I can't connect to my board entirely (I'm assuming so as I can't connect to serial monitor) will try uploading blink, have not tried that. Thanks!

Unfortunately unable to upload any programs ... Same error as what OP posted once again.

unplug/plugin the USB does the COM port disappear/appear

Yes, and plays the little windows 11 sound also. :slight_smile:

what arduino are you using?
Lolin(Wemos) D1 R2 Mini board with ESP8266. I have used these boards (6 different ones)
appears correctly as CH340
Yes

and then used the Board manager to instal the ESP8266 Community

Platform esp8266:esp8266@3.1.2 uninstalled : 7:20 5/3/23
Platform esp8266:esp8266@3.1.2 installed : 7:25 5/3/23
Yes. Same issue is occuring.

uninstall the COM ports to make a device work
I tried to use CH341SER.EXE to uninstall and reinstall, same issue occurring.

My full error message....
. Variables and constants in RAM (global, static), used 31880 / 80192 bytes (39%)
β•‘ SEGMENT BYTES DESCRIPTION
╠══ DATA 1512 initialized variables
╠══ RODATA 4152 constants
β•šβ•β• BSS 26216 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 60543 / 65536 bytes (92%)
β•‘ SEGMENT BYTES DESCRIPTION
╠══ ICACHE 32768 reserved space for flash instruction cache
β•šβ•β• IRAM 27775 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 339940 / 1048576 bytes (32%)
β•‘ SEGMENT BYTES DESCRIPTION
β•šβ•β• IROM 339940 code in flash

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)esptool.py v3.0
Serial port COM3

I have no other devices connected to this USB. There are no other programs running using serial ports. I have performed several reboots.

I have also tried different cables, different boards, and different ports.
Thanks

Hello team! Thanks for the suggestions thus far. I have tried to Uninstall all com ports, and then uninstall drivers using CH341SER.EXE to install driver directly and for two or three tries, received, timed out waiting on header...then it went back to the OP error messages.

Serial monitor says "Port Monitor Error: Command 'open' failed. Invalid serial port. Could not connect to serial port. ((joking: I wonder if I throw some capt'n crunch at it if it will work - get it serial port))

I did notice that this error started to occur AFTER I tried to use OTA programming for a different board. This code I am trying DOES NOT have OTA, and I am selecting the COMx port.

I also tried to "Erase Flash: Erase All Board Content" and then started to get this error. Yet, that does not explain why other boards (never using Erase) also don't work.

sorry for threadjacking

No problem...I just hope we get an expert that can help us.

an update of the CH340 driver to ver. 3.8.2023.2 broke my com port.
did a rollback and now everything works again. had to disable auto updates for drivers, as the new driver version came back with next windows update.

3 Likes
update of the CH340 driver to ver. 3.8.2023.2 broke my com port. did a rollback

Advice is perfect and worked correctly! I went back to driver date 1/30/2019 version 3.5.2019.1.

I found a link to the back dated drivers at https://deviceinbox.com/devsearch/find.php?search=ch340

1 Like

The solution to my problem was found by ppp147. I marked it below and gave a link to the back dated drivers. Good luck!

Thanks for wrapping this up so nicely. I have experienced the same problem. The driver v.3.6.2021.12 from your link works fine with both the legacy (1.8.19) and the new (2.1.1) IDE. Interestingly, too old and too new driver versions only work with the legacy version, but not with the new IDE. There was an issue reported about this kind of problems (Include Windows device drives in IDE 2.0.x as in earlier versions Β· Issue #1663 Β· arduino/arduino-ide Β· GitHub) where it is mentioned that for 2.x.x IDE versions, driver dependencies should be handled by "maintainers of platforms for boards" at board installation time. Too bad that Windows updates seem to break this concept...