This is on a laptop running Windows 10. I use the Arduino Create web IDE. My Arduino is a Chinese clone (not the CH340 variety; it looks identical to a genuine Arduino). My problem: I am often unable to upload sketches. The behaviour is erratic, and I am not sure which action results in success (replugging the USB cable, changing the COM baud rate, disabling the COM port, uninstalling the COM port, restarting the IDE, and combinations thereof). How can I troubleshoot this?
A few details.
Yesterday I uploaded sketches to the Arduino to my heart's content. I put my PC to sleep (not hibernate), and this morning, when I want to upload a sketch, I get
Flashing with command:C:/Users/Bernd/.arduino-create/arduino/avrdude/6.3.0-arduino9/bin/avrdude.exe -CC:/Users/Bernd/.arduino-create/arduino/avrdude/6.3.0-arduino9/etc/avrdude.conf -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:/Users/Bernd/AppData/Local/Temp/arduino-create-agent618469230/STOP.hex:i
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x2f
I open Device Manager and find that COM3 is set to 9600 BAUD. OK, setting it to 115200 should fix this, right? Unfortunately not:
Flashing with command:C:/Users/Bernd/.arduino-create/arduino/avrdude/6.3.0-arduino9/bin/avrdude.exe -CC:/Users/Bernd/.arduino-create/arduino/avrdude/6.3.0-arduino9/etc/avrdude.conf -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:/Users/Bernd/AppData/Local/Temp/arduino-create-agent927259637/STOP.hex:i
avrdude: ser_open(): can't open device "\.COM3": Access is denied.
avrdude done. Thank you.
I quit and re-run the IDE, but still "access denied".
I then disable, then re-enable COM3 in device manager. This brings me back to the error "programmer not responding".
I then uninstall COM3 in device manager. It tells me that the change requires restarting the PC. Before I do that, I unplug the USB cable and plug it in again. Run the IDE, and to my great surprise, I can upload the sketch.
However, trying to upload the sketch a second time gives me "programmer is not responding" again. Un- and replugging the USB cable sometimes enables me to upload a sketch, sometimes not.
Using the IDE installed on my PC, the error is similar:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avrdude -CC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\Bernd\AppData\Local\Temp\arduino_build_226199/sketch_may06a.ino.hex:i
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.10.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM3
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x60
Unplug, replug, and now I can upload the sketch. Trying a second time, and I can upload it again. Trying upload the Blink sketch, and it succeeds. Trying the web IDE again, and it succeeds. So far, all further attempts were successful.
EDIT: I see LEDs on the Arduino flashing when avrdude reports programmer is not responding. First the "L" LED a few times very rapidly, then the Tx and Rx LEDs also a few times very rapidly. Thus, some communication between PC and Arduino must be going on.