The second problem, sometimes if you recognize it, a message appears asking you to reset.
> "Leaving... Hard resetting via RTS pin..."
I do the following procedure to connect to the computer, there is a button on the right side of the esp8266, when I connect to the computer I keep it pressed until Windows beeps and goes into recording mode, which sometimes recognizes it and sometimes doesn't.
I moved your topic to an appropriate forum category @pqkess.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Posting screenshots of fragments of text is very unhelpful.
I'm going to ask you to post the full verbose output from an upload attempt.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Uncheck the box next to Show verbose output during: ☑ compilation in the "Preferences" dialog.
Check the box next to Show verbose output during: ☐ upload.
Click the "OK" button.
Attempt an upload, as you did before.
Wait for the upload to fail.
You will see a "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
Open a forum reply here by clicking the "Reply" button.
Click the <CODE/> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press Ctrl+V.
This will paste the error output from the upload into the code block.
Move the cursor outside of the code tags before you add any additional text to your reply.
Click the "Reply" button to post the output.
That message is not requesting you to do anything. It is only telling you what the esptool upload tool is doing automatically. You don't need to take any action at all when you see that message.
I have the same esptool error, which started here about a month ago with a new batch of Wemos D1 mini boards. I uninstall the CH340 driver (with a CH340 driver installer I got off the net). Then I install the driver with the same installer, after which I can use my WemosD1 mini again.
It eventually stops working, e.g. the next day or after switching to an AVR board.
Leo..
Hi @Wawa. There were some previous reports of this "PermissionError(13, 'A device attached to the system is not functioning.', None, 31)" error occurring specifically when uploading to the boards that use the WCH CH340 USB chip (and apparently only specific batches of those chips). The problem only occurs when using the latest version of the CH340 driver.
The affected users have reported that doing a "roll back" to an older version of the driver was an effective workaround. You can give that a try.
I'll provide instructions:
Open this tutorial from SparkFun in your browser: https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#drivers-if-you-need-them ⓘ We are using this tutorial as a source for an older version of the CH340 drivers. Generally I recommend only obtaining drivers from the manufacturer of the device, but WCH does not provide older versions of their drivers and SparkFun is trustworthy.
Click the "Windows (EXE)" link you see in red under the "Drivers (If You Need Them)" section of the tutorial.
Wait for the download to finish.
Run the downloaded CH341SER.EXE file.
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 appear. 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.
Click the X icon at the top right of the "DriverSetup(X64)" dialog to close it.
Close Arduino IDE if it is running.
Connect the Arduino board to your computer with a USB cable.
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). Right click on that item.
The "USB-SERIAL CH340 (COMn) Properties" dialog will open.
Select the "Drivers" 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.
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.
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 "PermissionError(13, 'A device attached to the system is not functioning.', None, 31)" error during the sketch upload.
I was planning to provide these instructions to @pqkess two days ago, but I wanted to wait until they had shown the respect to actually provide the necessary information in a form usable by the helpers here.
Thank you for the detailed instructions.
I will certainly try this when I have to use the Wemos again.
Off for a trip around the world soon, so it might be a month or so.
Leo..
Hi well traveled @Wawa. I hope your trip was nice. Did you ever get the chance to try the procedure I described in post #5? If so, did it solve the upload error persistently?
I ask because, although I have a lot of experience recommending this procedure when supporting users affected by what I believe is the equivalent error from AVRDUDE (avrdude: ser_open(): can't set com-state for "\.\COM_x_"), I have only used it twice while supporting the "PermissionError(13, 'A device attached to the system is not functioning.', None, 31) " from esptool and haven't received much feedback on how well it worked as a fix for that error. I am not able to reproduce the error personally so I can only operate vicariously in this case.
@pqkess if you are listening I would also be interested to know whether the procedure solved the problem for you.