Upload using programmer fails without USB

I have a few Uno boards with bad FTDI chips so I can't program them using the normal upload process. My programs don't need the virtual serial connection so I'd like to program them using a USBtinyISP and the Upload Using Programmer feature in 1.8.13 of the IDE. When I try this I get the following:

Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"
Sketch uses 1970 bytes (6%) of program storage space. Maximum is 32256 bytes.
Global variables use 50 bytes (2%) of dynamic memory, leaving 1998 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM4 -b115200 -D -Uflash:w:C:\Users\Doug\AppData\Local\Temp\arduino_build_167363/ServoTrigger.ino.hex:i

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:\Program Files 

x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200

avrdude: ser_open(): can't open device "\.\COM4": The system cannot find the file specified.

avrdude done. Thank you.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
processing.app.SerialException: Error opening serial port 'COM4'.
at processing.app.Serial.(Serial.java:152)
at processing.app.Serial.(Serial.java:82)
at processing.app.SerialMonitor$2.(SerialMonitor.java:132)
at processing.app.SerialMonitor.open(SerialMonitor.java:132)
at processing.app.AbstractMonitor.resume(AbstractMonitor.java:132)
at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2120)
at processing.app.Editor.access$1300(Editor.java:117)
at processing.app.Editor$UploadHandler.run(Editor.java:2089)
at java.lang.Thread.run(Thread.java:748)
Caused by: jssc.SerialPortException: Port name - COM4; Method name - openPort(); Exception type - Port not found.

at jssc.SerialPort.openPort(SerialPort.java:167)
at processing.app.Serial.<init>(Serial.java:141)
... 8 more

Error opening serial port 'COM4'.

I can successfully program the bootloader without the USB port on the target board connected but using an ISP programmer to upload a sketch appears to also require the USB connection to the target board to also work. I would have thought that, if I can program the bootloader using just an ISP, I should also be able to program a sketch. Any insight into why this isn't true would be greatly appreciated.

Thanks

The output you posted indicates you're attempting a standard upload. Try using The Arduino IDE"s Sketch > Upload Using Programmer menu item.

Sorry about that. After I turned on the verbose output I did the wrong upload type. When I did it correctly I now realize that programming actually worked but the IDE tried to open the target's USB serial port after programming and that failed. When not in verbose mode, only the failure gets reported so it looks like it failed and made me think that programming wasn't working when it actually was. Is there a reason to open the serial port after programming? If not, I suggest that should be changed in the IDE. Here's the log:

Sketch uses 1970 bytes (6%) of program storage space. Maximum is 32256 bytes.
Global variables use 50 bytes (2%) of dynamic memory, leaving 1998 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cusbtiny -Uflash:w:C:\Users\Doug\AppData\Local\Temp\arduino_build_167363/ServoTrigger.ino.hex:i

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:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

     Using Port                    : usb
     Using Programmer              : usbtiny

avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\.\libusb0-0001--0x1781-0x0c9f
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : USBtiny
     Description     : USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp

avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: Using SCK period of 10 usec
avrdude: reading input file "C:\Users\Doug\AppData\Local\Temp\arduino_build_167363/ServoTrigger.ino.hex"
avrdude: writing flash (1970 bytes):

Writing | ################################################## | 100% 6.40s

avrdude: 1970 bytes of flash written
avrdude: verifying flash memory against C:\Users\Doug\AppData\Local\Temp\arduino_build_167363/ServoTrigger.ino.hex:
avrdude: load data flash data from input file C:\Users\Doug\AppData\Local\Temp\arduino_build_167363/ServoTrigger.ino.hex:
avrdude: input file C:\Users\Doug\AppData\Local\Temp\arduino_build_167363/ServoTrigger.ino.hex contains 1970 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.34s

avrdude: verifying ...
avrdude: 1970 bytes of flash verified

avrdude done. Thank you.

processing.app.SerialException: Error opening serial port 'COM4'.
at processing.app.Serial.(Serial.java:152)
at processing.app.Serial.(Serial.java:82)
at processing.app.SerialMonitor$2.(SerialMonitor.java:132)
at processing.app.SerialMonitor.open(SerialMonitor.java:132)
at processing.app.AbstractMonitor.resume(AbstractMonitor.java:132)
at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2120)
at processing.app.Editor.access$1300(Editor.java:117)
at processing.app.Editor$UploadHandler.run(Editor.java:2089)
at java.lang.Thread.run(Thread.java:748)
Caused by: jssc.SerialPortException: Port name - COM4; Method name - openPort(); Exception type - Port not found.
at jssc.SerialPort.openPort(SerialPort.java:167)
at processing.app.Serial.(Serial.java:141)
... 8 more
Error opening serial port 'COM4'.

Do you have Serial Monitor open?

I did have the serial monitor open. When I closed it and tried again, the error is no longer reported. I must have left it open while I was verifying that the USB port on the board was bad.

Thanks for the help!

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