I'm running IDE 2.3.6 on Windows 11. The target is an Adafruit Pro Trinket 5V. I'm uploading via an FTDI cable. I've had no problem with this setup for years, but this is my first Arduino project since moving to Windows 11. I've found that using FTDI sometimes results in a normal upload and sometimes produces this error:
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\xxx\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM3
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can't open device "\\.\COM3": Access is denied.
avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
Naturally, this erratic behavior is very frustrating. I've tried unplugging/replugging the cable, uploading without the cable (i.e. with no connection to the target); sometimes I can subsequently upload, sometimes I can't. Any suggestions greatly appreciated.
Good points. I wasn't specifically questioning the cable, but it's certainly possible that the PC's USB 3.2 ports aren't sufficiently backwards-compatible with the cable's USB 2.0 logic. Unfortunately, there are no USB 2.0 ports on this system (only 3.2 and Thunderbolt). FTDI cables are at least available with USB C termination (though not specifically USB 3.2), however, so I'll buy one of those and see if it works any better.
From what I understand, people had success with hubs. I can imagine that hub are more generic so newer USB hardware have no problem talking to them, and the USB 2 devices connected to that hub. But it's of course what you prefer. Good luck!
I ask because there are other actions that you might consider to be "closing" Serial Monitor, but it is only by clicking that X icon that you will prevent Serial Monitor from interfering with the upload and causing it to fail with the "Access is denied" error.
I dug out an old USB 2.0 hub (powered) and plugged it into one of the USB 3.2 ports, then plugged the FTDI cable into the hub. I got two or three uneventful uploads that way, then it reverted to the same problem I've been having.