Then the board is no good, buy a new one.
But this time without the serial monitor? I know that the later IDE will disconnect Serial monitor, but just to have tried everything.
If this doesn't work, and your ESP board doesn't have some way to hard reset it, I'm afraid it's a goner.
Thank you so much for time in guiding me ,
Thanks a lot, i will buy new board
It happens now and then, I hope you have better luck with the new one.
Good idea
Fix this error
PermissionError
Hi @surya_221. I know you already mentioned the CH340 driver, but it is fairly common for us to see that people installed that driver per some instructions they found online even when their board has a different chip. So just to be certain, please tell us which USB to serial bridge chip your Arduino board has. This is a black chip near the USB socket.
The chip will usually be identified by writing on the top. This might say something like "WCH CH340G" or "SILABS CP2102".
Examples:
WCH CH340
There are some boards on the market that have a USB chip with the same IC package as the WCH CH340, and which are identified by the computer as a CH340. However, these chips don't have the "WCH CH340C ..." labeling like you see on the chip in the picture above:
These mysterious unlabeled chips have different characteristics than the labeled CH340 chips, so please let us know if yours is labeled or not.
Silicon Labs CP2102

If it isn't clear, alternatively you can provide the link to where you bought the board from and we'll see if we can determine the chip from the product listing.
Hii ptillisch,
I bought that board from some electronic shop in offline, like you mentioned it don't have any information about chip like you shown in figure but the board has backside ,
Install the CH340G driver
Use the 9600 bps
Connect to wifi
Regards
Surya
I'm not sure I understood correctly what you mean by this. Are you saying the chip looks exactly like the one in this picture, with 16 pins and no label?:
This "PermissionError(13, 'A device attached to the system is not functioning.', None, 31)" error you encountered occurs under the following conditions:
- The board has one of these mysterious unlabeled "CH340" chips
- You have version
3.8.2023.2or higher of the CH340 Windows driver installed
The workaround for the problem is to perform a "roll back" to an older version of the driver that is compatible with these problematic "CH340" chips. I'll provide instructions you can follow to do that:
- Click the following link to download the previous version of the driver from the chip manufacturer's website:
https://www.wch-ic.com/downloads/file/65.html?time=2023-03-16%2022:57:59 - Wait for the download to finish.
- Run the downloaded
CH341SER.EXEfile. - A "User Account Control" dialog may now appear asking "Do you want to allow this app to make changes to your device?". Click the "Yes" button.
- A "DriverSetup(X64)" dialog will open. Click the "INSTALL" button in the dialog.
- Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
- Click the "OK" button in the "Driver install success!" dialog.
The dialog will close. - Click the X icon at the top right of the "DriverSetup(X64)" dialog
The dialog will close. - Close Arduino IDE if it is running.
- Connect the Arduino board to your computer with a USB cable.
- Open the Windows Device Manager.
- Select View > Devices by type from the Device Manager menus.
- Open the "View" menu.
- If there is a ✓ to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
- Open the "Ports (COM & LPT)" section of the Device Manager tree.
- You should see a port identified as "USB-SERIAL CH340 (COMn)" under the "Ports (COM & LPT)" section (where "COMn" is some serial port e.g., COM4). Double click on that item.
The "USB-SERIAL CH340 (COMn) Properties" dialog will open. - Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
- You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
- Click the "Update driver" button.
An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open. - Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
- You should now see the driver installation wizard update the driver. Wait for the update to finish, as indicated by the message "Windows has successfully updated your drivers" in the dialog.
It is possible you will instead see the message "The best drivers are already installed". If so, please stop following the instructions here and reply on the forum thread to let me know. I'll provide alternative instructions you can follow. - Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
The dialog will close.
- Click the "Update driver" button.
- Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
The "Driver Package rollback" dialog will open. - Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
- Click the "Yes" button.
The "Driver Package rollback" dialog will close. - Click the "Close" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error. Hopefully this time you will not encounter that "PermissionError(13, 'A device attached to the system is not functioning.', None, 31)" error during the sketch upload.
I get a 404 on that link, on even on the basic .com URL. However, this site has what purports to be the 2019 version:
https://www.visualmicro.com/downloads/tools/CH340-Driver/CH341SER.zip
But that's the ZIP file, so installation would be a bit different. That same site has some instructions.
https://www.visualmicro.com/page/CH340-Driver-Fix-Installation.aspx
link not opening., i installed latest version on my pc
https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all
from the above link
Maybe it's time to buy the original. It's bad when the Chinese even pirate the Chinese...
It works for me now. It was probably a transient outage of the site.
The link I provided downloads version 3.7.2022.01, which is the last version before the incompatibility was introduced in version 3.8.2023.2.
I'm sure the 2019 version serve as a workaround for this problem. However, I do think it is best to use the newest possible version.
The links on that page do not provide the latest version. They instead provide 3.4.2014.08, from 2014.
As with the 2019 version, I'm sure the 2014 version will serve as a workaround. I originally suggested the use of this source of the driver when supporting the users affected by this problem, before I later found a way to get the newer 3.7.2022.01 right from the manufacturer's website.
Is there a question in post #36?
You want to downgrade the driver so should replace the newer version with the older version. So I would click "yes".
Hi,
I got the "The best drivers are already installed" as stated under the (18.3) instructions above on my Windows11.
Any tips on how to fix that?
Hi @runnin. I have found that when the driver installation gets into this state, it can be solved by uninstalling and then reinstalling the drivers. After that, the "roll back" option should be enabled.
I'll provide instructions you can follow to do that:
- Close Arduino IDE if it is running.
- Connect the Arduino board to your computer with a USB cable.
- Open the Windows Device Manager.
- Select View > Devices by type from the Device Manager menus.
- Open the "View" menu.
- If there is a ✓ to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
- Open the "Ports (COM & LPT)" section of the Device Manager tree.
- You should see a port identified as "USB-SERIAL CH340 (COMn)" under the "Ports (COM & LPT)" section (where "COMn" is some serial port e.g., COM4). Double click on that item.
The "USB-SERIAL CH340 (COMn) Properties" dialog will open. - Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
- Click the "Uninstall Device" button.
The "Uninstall Device" dialog will open. - Check the box next to "☐ Attempt to remove the driver for this device.".
- Click the "Uninstall" button.
The "Uninstall Device" and "USB-SERIAL CH340 (COMn) Properties" dialogs will close. - Disconnect the USB cable of the Arduino board from your computer.
- Reconnect the USB cable of the Arduino board to your computer.
- Wait for the "USB-SERIAL CH340 (COMn)" device to appear under the "Ports (COM & LPT)" section of the Device Manager tree.
This will take a couple of minutes as Windows must first automatically reinstall the driver.
It might appear first as a "USB2.0-Serial" device under the "Other devices section of the tree. Just wait for a little longer and it will appear in its final place under the "Ports (COM & LPT)" section. - Click the following link to download the previous version of the driver from the chip manufacturer's website:
https://www.wch-ic.com/downloads/file/65.html?time=2023-03-16%2022:57:59 - Wait for the download to finish.
- Run the downloaded
CH341SER.EXEfile. - A "User Account Control" dialog may now appear asking "Do you want to allow this app to make changes to your device?". Click the "Yes" button.
- A "DriverSetup(X64)" dialog will open. Click the "INSTALL" button in the dialog.
- Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
- Click the "OK" button in the "Driver install success!" dialog.
The dialog will close. - Click the X icon at the top right of the "DriverSetup(X64)" dialog.
The dialog will close. - Switch back to the Windows "Device Manager".
- Double click on the "USB-SERIAL CH340 (COMn)" device under the "Ports (COM & LPT)" section.
The "USB-SERIAL CH340 (COMn) Properties" dialog will open. - Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
- Click the "Update driver" button.
An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open. - Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
- You should now see the driver installation wizard update the driver. Wait for the update to finish, as indicated by the message "Windows has successfully updated your drivers" in the dialog.
- Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
The dialog will close. - Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
The "Driver Package rollback" dialog will open. - Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
- Click the "Yes" button.
The "Driver Package rollback" dialog will close. - Click the "Close" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
Now start Arduino IDE again and repeat whatever you were doing before when you encountered that error before. Hopefully this time you will not encounter that "can't set com-state" error during the sketch upload.
Hello Surya_221 and everyone, the same thing happened to me using a Generic ESP8266 with CH340 and this error:
A fatal esptool.py error occurred: Cannot configure port, something went wrong. PermissionError(13, 'A device attached to the system is not functioning.', None, 31)
To fix it I followed these steps:
- In Device Manager I verified that a COM port associated with the CH340 appeared. If it didn’t, I changed the USB cable and port.
- I uninstalled the old driver (checking “Delete the driver software”), restarted Windows, and installed the latest CH340 driver version.
- I ran the Arduino IDE as administrator (right-click → Run as administrator).
- In “Tools > Board” I selected “Generic ESP8266 Module”, set Flash Size to 1 MB and Upload Speed to 115200.
- I closed any program that might be using the same COM port (PuTTY, other serial monitors, IoT hubs).
- Before uploading the sketch I tested in PowerShell:
esptool.py --port COM3 flash_id
and then, confirmed the chip responded!
After that I was able to upload the Blink sketch without issues. I hope this helps.
Best Regards!



