Why is my Leonardo/Uno not recognized?

Hi guys 'n galls,

I have 2 Arduino's set up, with the intention to get them to communicate.
OK, I'm still far from that because I have issues with programming the Uno.

Telling the system it is an Uno, it gives an error.
Telling the system it is a Leonardo, it keeps telling me it is uploading while in fact there is nothing happening.
The other Arduino, (Mega) however, can be programmed without issues

What I have been excluding:
-Switching the USB cables to exclude those and the USB switch. No results.
-Trying to exclude the Mega in case they are interfeering. No differance.
-Trying another Uno. No results.
-renaming the Uno (it says Uno, but I've heard that cheeper Uno's are in fact Leonardo's or whatever so I was advised to program them as being Leonardo's. This however gave no results as well.
-Even though the Arduino's need to be hooked up eventualy, I disconnected all equipment and only connected the USB cable. No result. (I also did that with the spare Uno I had.)

The code of the Mega and the Uno were programmed and tested succesfully.
It is not the code because compiling goes without any complications.

Besides... Even though the IDE has provided other COM ports automaticly, IDE says there is no connection with the device.
avrdude: ser_open(): can't open device "\.\COM9": access denied.

What is it that is causing this error?

COM9 is used by some other task.

Which error. The one at the end of your post?

So the Mega and the Uno are not connected.

Whoever told you that should no longer be your friend. And if it was a website I would blacklist it. Ultimate rubbish. Stick to Uno.

If you're using IDE 2.x, close the serial monitor before you upload.

I cannot imagine.
It is a new laptop and there are only 2 Arduino's connected. One using Com 5 and the other Com 9 (which used to be Com 6, which also failed to work)

No, this one:
You're Dutch, so you'll get it, I assume... :wink:

Sketch uses 3956 bytes (12%) of program storage space. Maximum is 32256 bytes.
Global variables use 379 bytes (18%) of dynamic memory, leaving 1669 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\.\COM9": Toegang geweigerd.

Failed uploading: uploading error: exit status 1

No, I'm still far from that. I need to control the Master Arduino (UNO) first.
Programming it is OK. But the upload into the Uno gives the errors

I do not recall. But if I stick to the settings to be an Uno (which it saying to be on the PCB) there is no result eighter. IOW The upload jams or it gives a error.

No, I haven't got the serial monitors opened

Start making one Arduino being recognized.
Operating 2 Arduinos, use 2 different instances of the IDE.

1 Like

Oh, I excluded that as being a problem a long time ago :wink:
I disconnected the Mega electronicly as well as physicly.

I even disconnected everything but that one Uno and tried a completely differend "Blink a led" program, without any positive result.

What do you get if you connet your board and select 'get board info' from the tools menu?

You will have to sort out the "access denied". There is a Windows tool that can tell you which application keeps a lock on a file; as far as I know I can also report on COM ports. windows which application has a file in use - Google Search

I've once read that Bluetooth might be the culprit and disabling Bluetooth in Windows can sort the problem out.

Is your Uno an original or a clone with CH340?

image

Just this message...
(Only the Uno was connected. Not the Mega, to exclude that as an error)

I downloaded a program to determine all activities of my laptop, but handling that is way above my knowledge.

I do not know what I have.
Likely a clone, at least I think because I ordered them by Ali Express.
But I once received a few from someone for helping him out with unrelated stuff and he knew I was into Arduino's.

The PCB says UNO, but I'm not sure if that is valid of course.

So you have a clone with a CH340 USB-Serial converter.

I guess so, MicroBahner...

Is there a way to determine that?

Yes, from the ouput of 'Board Info' you showed in #10. VID and PID show the manufacturer and type of the USB device, and 0x1A86 / 0x7523 is the CH340.

You can check that from this site. Type in VID and PID, and it shows you manufacturer and device type.

1 Like

I do not know what you did download. I think that Process Explorer - Sysinternals | Microsoft Learn is what was referring to (currently not a Windows user).

I guess that that is the last help that I can give.

@MicroBahner, I usually use https://devicehunt.com/ to check VIDs and PIDs. So FTMZ now has two sites :slight_smile:

1 Like

Guys, Thank you very much for the provided help.
Even though I did not get my issues solved, I learned quite a bit.

I downloaded Process Explorer, to finisch that question.

I try to look further for a solution.

And me too :grinning:

Guys, I got the solution.

There were several people who've encounterd this issue.

It seems it is not an old CH340 driver causing the issues, rather then a newer one.

I read in an older treath that installing an older version of the CH340 (or CH341) would do the trick.

I copied the solution, which already was a copy, but as long as it works, what the heck. :slight_smile:


Here are the instructions for installing an older version of the driver I've been sharing with affected users. Most of them have reported that it solves the "can't set com-state" error:

  1. Open this tutorial from SparkFun in your browser:
    https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#drivers-if-you-need-them
    2.* 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.
  2. Click the "Windows (EXE)" link you see in red under the "Drivers (If You Need Them)" section of the tutorial.
  3. Wait for the download to finish.
  4. Run the downloaded CH341SER.EXE file.
  5. 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.
  6. A "DriverSetup(X64)" dialog will appear. Click the "INSTALL" button in the dialog.
  7. Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
  8. Click the "OK" button in the "Driver install success!" dialog.
  9. Click the X icon at the top right of the "DriverSetup(X64)" dialog to close it.
  10. Close Arduino IDE if it is running.
  11. Connect the Arduino board to your computer with a USB cable.
  12. Open the Windows Device Manager .
  13. Select View > Devices by type from the Device Manager menus.
  14. Open the "View" menu.
  15. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  16. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  17. 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). Right click on that item.
    A context menu will open.
  18. Select the "Drivers" tab of the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
  19. You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
  20. Select "Update driver" from the context menu.
    An "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog will open.
  21. Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog.
  22. 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.
    :exclamation: 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.
  23. Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COM_n_)" dialog.
  24. Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COM_n_) Properties" dialog.
    The "Driver Package rollback" dialog will open.
  25. Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
  26. Click the "Yes" button.
  27. 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 "can't set com-state" error during the sketch upload.


All seems to work right now.
Maybe relevant to mention... I have a brand new laptop. My older system had issues but it worked fine concerning Arduino's

You did not have the "set com-state" error :wink:

I'm glad that the instructions by @ptillisch solved your problem.

1 Like

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