Uploading to NodeMCU fails, Nano and ESP32 ok

Since a short time I can not get my serial ports (WIN11 PC, IDE 1.8.19) to work anymore with NodeMCU/ESP8266. I always get the message

`PermissionError(13, 'A device attached to the system is not functioning.', None, 31)

I re-installed the CH340 driver but keep getting the message. (I press the boot button on the NODEMCU and reset it before uploading.)

Also I tried switching of MS defender and firewall, nothing helps. I also deleted all hidden COM port definitons, did a full power down of my PC and tried the latest IDE.

I had this more often and a PC reboot used to help, but recently not anymore

It seems to be an issue related to NodeMCU, as I tried an Arduino nano (CH340) and ESP32dev (CH340) that both worked just fine

But when I try NodeMCU, the upload fails.
Anyone seen that too and found a solution? I'm getting desperate because I need to update some projects.

Hi @reinierdevlaam. One of the possible causes of this error is the port being open in another application. Only one application can have a serial port open at a time so Arduino IDE can't perform an upload under these conditions.

Check to see whether you have any applications running on your computer that might use the port. If they are, close them and then try the upload again.

I've tried several NodeMCU's, they all fail

The problem I mentioned above is not caused by the hardware, but rather by the software applications running on your computer.

You can follow the instructions in this Arduino Help Center article to check whether an application is opening the port of the NodeMCU boards:

If the "Process Explorer" tool mentioned in that article doesn't identify any application, reply here to let us know and we'll investigate the problem further.

Interresting

If I do that, I get USB_SERIAL CH340 (COM5) as device name
The details also give USB-SERIAL CH340

And there are no processes connected to it (Arduino IDE is running...)

I have this programmer board for ESP8266...amazingly it works, I can upload code to it.
But still NodeMCU fails. Both have CH340 driver chip, both identify as USB-SERIAL CH340

What could be different that causes the NodeMCU to fail and the programmer to work.
I tried specifying NodeMCU as generic 8266, like I do with the programmer baord: fail.

I'm flabbergasted

SOLUTION
re-installation of driver
Weird, that is doesn't work for NodeMCU, but does for other devices with CH340driver. And everybody telling me reinstallation of the driver when deleting greyed-out ports wasn't necessary

Nice work on finding a solution. The driver was next possible cause of the error I was planning to check after eliminating the possibility of an access conflict, but you were one step ahead!

The problem of uploads failing when the latest version of the CH340 driver is installed is common when using Arduino boards obtained from unreliable sources (e.g., random sellers on eBay, Amazon, Aliexpress). The problematic boards typically have a CH340 chip that is not marked (the good chips have "WCH CH340G" written on the top), which appears to be the case with the board on the left in your picture.

It is possible the problem will come back after Windows updates the driver back to the problematic version. If so, comment here and I'll provide instructions you can follow to make a persistent installation of the compatible driver version.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.