# Uploading to ESP8266 - "A device attached to the system is not functioning"

**URL:** <https://forum.arduino.cc/t/uploading-to-esp8266-a-device-attached-to-the-system-is-not-functioning/1334635>\
**Category:** IDE 2.x\
**Created:** [December 22, 2024, 12:50am UTC](https://forum.arduino.cc/t/uploading-to-esp8266-a-device-attached-to-the-system-is-not-functioning/1334635 "2024-12-22T00:50:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SabatM](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sabatm/32/1127224_2.png) [@SabatM](https://forum.arduino.cc/u/SabatM)\
**Post date:** [December 22, 2024, 12:50am UTC](https://forum.arduino.cc/t/uploading-to-esp8266-a-device-attached-to-the-system-is-not-functioning/1334635/1 "2024-12-22T00:50:52Z")

</div>

Hi guys, idk why the hell this could happen, but neither of my computers can upload to an ESP thru the esptool.py, which gives out an error, stating: `could not open port 'COM5': PermissionError(13, 'A device attached to the system is not functioning.', None, 31)`. Tried reinstalling drivers, downgrading them to a 2023 version, none helped. (it's the CH340 serial chip), also tried uploading to Generic ESP8266, D1 mini (clone) and a Generic ESP32 C3. None worked. Port selection also correct, as an ESP8266 is displayed on boards list when connected, and only one single port is opened when i connect it on my laptop. Any ideas?

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [December 22, 2024, 1:29am UTC](https://forum.arduino.cc/t/uploading-to-esp8266-a-device-attached-to-the-system-is-not-functioning/1334635/2 "2024-12-22T01:29:37Z")

</div>

Hi @SabatM.

> [@SabatM](#):
>
> Tried reinstalling drivers, downgrading them to a 2023 version, none helped.

I think you were on the right track, but you just didn't install an old enough version of the driver.

This "`PermissionError(13, 'A device attached to the system is not functioning.', None, 31)`" error can occur when uploading to the boards that use specific batches of the [WCH CH340 USB chip](http://www.wch-ic.com/products/CH340.html). The problem only occurs when using the versions of the CH340 driver from 2023 and after.

The affected users have reported that doing a "roll back" to an older version of the driver from 2022 was an effective workaround. You can give that a try.

I'll provide instructions you can follow to do that:

1. 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](https://www.wch-ic.com/downloads/file/65.html?time=2023-03-16%2022:57:59)
2. Wait for the download to finish.
3. Run the downloaded `CH341SER.EXE` file.
4. 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.
5. A "**DriverSetup(X64)**" dialog will open. Click the " **INSTALL**" button in the dialog.
6. Wait for the driver installation to finish, as indicated by the appearance of a " **Driver install success!**" dialog.
7. Click the " **OK**" button in the " **Driver install success!**" dialog.  
The dialog will close.
8. Click the **X** icon at the top right of the "**DriverSetup(X64)**" dialog  
The dialog will close.
9. Close Arduino IDE if it is running.
10. Connect the Arduino board to your computer with a USB cable.
11. Open the [Windows **Device Manager**](https://support.microsoft.com/en-us/windows/open-device-manager-a7f2db46-faaf-24f0-8b7b-9e4a6032fc8c).
12. Select **View \> Devices by type** from the **Device Manager** menus.
13. Open the " **View**" menu.
14. If there is a **✓** to the left of the " **Show hidden devices**" menu item, click on " **Show hidden devices**" to disable it.
15. Open the "**Ports (COM & LPT)**" section of the **Device Manager** tree.
16. You should see a port identified as "**USB-SERIAL CH340 (COM_n_)**" under the "**Ports (COM & LPT)**" section (where "COM_n_" is some serial port e.g., COM4). Double click on that item.  
The "**USB-SERIAL CH340 (COM_n_) Properties**" dialog will open.
17. Select the " **Driver**" tab of the "**USB-SERIAL CH340 (COM_n_) Properties**" dialog.
18. You will see a " **Roll Back Driver**" button in the dialog. If it is not clickable, perform the following instructions:
  1. Click the " **Update driver**" button.  
An "**Update Drivers Device - USB-SERIAL CH340 (COM_n_)**" dialog will open.
  2. Click on " **Search automatically for drivers**" in the "**Update Drivers Device - USB-SERIAL CH340 (COM_n_)**" dialog.
  3. 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.
  4. Click the " **Close**" button in the "**Update Drivers Device - USB-SERIAL CH340 (COM_n_)**" dialog.  
The dialog will close.

19. Click the " **Roll Back Driver**" button in the "**USB-SERIAL CH340 (COM_n_) Properties**" dialog.  
The " **Driver Package rollback**" dialog will open.
20. Click the radio button next to " **My apps don't work with this driver**" in the " **Driver Package rollback**" dialog .
21. Click the " **Yes**" button.  
The " **Driver Package rollback**" dialog will close.
22. Click the " **Close**" button in the "**USB-SERIAL CH340 (COM_n_) 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 "`PermissionError(13, 'A device attached to the system is not functioning.', None, 31)`" error during the sketch upload.

---

<div class="post-metadata">

**Author:** ![SabatM](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sabatm/32/1127224_2.png) [@SabatM](https://forum.arduino.cc/u/SabatM)\
**Post date:** [December 22, 2024, 1:36am UTC](https://forum.arduino.cc/t/uploading-to-esp8266-a-device-attached-to-the-system-is-not-functioning/1334635/3 "2024-12-22T01:36:16Z")

</div>

Just when you wrote that, i found a post on a forum that had 2014 drivers - it works! Thanks for making me sure to go for the older ones. Have a nice day! 😃

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [December 22, 2024, 1:42am UTC](https://forum.arduino.cc/t/uploading-to-esp8266-a-device-attached-to-the-system-is-not-functioning/1334635/4 "2024-12-22T01:42:05Z")

</div>

You are welcome. I'm glad it is working now.

For the benefit of anyone else with the same problem who finds this forum topic through their research, I'll add a note that, even though I'm sure the 2014 driver will work, installing such an old version is not required. The last compatible driver version is `3.7.2022.01`, which is the version you get from following the instructions I provided. The incompatibility was introduced in the next version of the driver after that: `3.8.2023.2`.

Regards, Per

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 20, 2025, 1:42am UTC](https://forum.arduino.cc/t/uploading-to-esp8266-a-device-attached-to-the-system-is-not-functioning/1334635/5 "2025-06-20T01:42:14Z")

</div>

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