Upload via ISP working, but not via USB

I have a box of seamingly bricked Nanos (originals, derivates and cheap clones). It was easier to use a new one then debugging. I currently preparing "programming sets" for our repair cafe and would like to include refurbished boards rather than new ones.

My setup is a original Uno as a programmer (https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/). The UNO has the ISP-Sketch loaded and the IDE is set to "Arduino as ISP".

Testsetup: Port select via USB
My recovery steps:

  1. Connect programmer using USB port
  2. connect target using ICSP pins and jumper
  3. Set "Arduino as ISP"
  4. Select target board (Nano "old bootloader", Nano, Uno)
  5. "Burn bootloader"

Depending on the chip one of the target configuration works

"...\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-C...\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -cstk500v1 -PCOM10 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

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 "...\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM10
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         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 : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

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

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

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

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xDA"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDA:
avrdude: load data hfuse data from input file 0xDA:
avrdude: input file 0xDA contains 1 bytes
avrdude: reading on-chip hfuse data:

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

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

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

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.

"...\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-C...\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -cstk500v1 -PCOM10 -b19200 "-Uflash:w:...\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:i" -Ulock:w:0x0F:m

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 ...\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM10
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         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 : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

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: reading input file "...\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex"
avrdude: writing flash (32670 bytes):

Writing | ################################################## | 100% -0.00s

avrdude: 32670 bytes of flash written
avrdude: verifying flash memory against ...\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: load data flash data from input file ...\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: input file ...\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex contains 32670 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 32670 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:

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

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

Uploading a sketch results in a common response:

Bootloader Nano (old bootloader):
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x8f
avrdude: ser_drain(): read error: Zugriff verweigert

Bootloader Nano:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x26

Bootloader Uno:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x1e

Trying different bootloader with different boards selected does also not working (grasping at straws, but worth a shot).

Testsetup: Upload using Programmer

Keep UNO with Nano connected as seen above.

  1. Select port of UNO
  2. "Arduino as ISP"
  3. Processor: Nano, Nano (old bootloader), UNO
  4. "Upload using Programmer"

Processor: Nano (old bootloader)
Success!

Processor: Nano
Success!

Processor: Uno
Success!

For comparison, the output of the upload process for the UNO testcase

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 "...\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM10
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         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 : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "...\Temp\arduino\sketches\72D5A2A0535C2704105F0A7A9BB79CEA/Blink.ino.hex"
avrdude: writing flash (1960 bytes):

Writing | ################################################## | 100% 0.33s

avrdude: 1960 bytes of flash written

avrdude done.  Thank you.

Questions:
How can I debug the USB serial connection?
Does the processor selection only affect the bootloader instructions?

  • The chip on the UNO and Nano is the AT328P

Does the USB-controller need separate resets or firmware?
Is the USB connection just lost for some pieces?

Success rate:
The original Nanos were all salvagable with standard "burn bootloader" configuration. Some clones needed a "clean" reset: Upload sketch via Programmer -> Burn new bootloader -> Upload sketch via USB. Some clones also worked with the standard "burn bootloader" configuration.

The first question would be if your boards are detected by your operating system when you connect them.
If yes, you can run the loop back test for Nanos that use the FT232. The test results of the loop back test for board with CH340 are non-conclusive.

You can also check the 3.3V pin on Nanos; that voltage is generated by the serial-to-usb converter.

The old boot loader communicates at 57600 with the PC when uploading a sketch via USB. The Nano and Uno boot loaders communicate at 115200 for the same purpose.
Further there is no difference between the different boot loaders except flash size.

No

If you can't upload via USB after loading the boot loader there is a good chance that the serial-to-usb converter is damaged.

You can load a basic sketch via ICSP that prints something to serial and check if it is received in serial monitor. If so, you can load another sketch via ICSP that can echo something received from the PC back to the PC.

I will provide an answer based on the information I already have:

Would it be "cleaner" if I flash all Arduinos to the new bootloader or was there also a chip revision?

I already tried this in my original post and its working

No chip revision. Advantage/disadvantage of the different boot loaders:

  1. Uno boot loader would be the best as it will free some flash memory; after that you will always have to program the board as Uno over USB.
  2. 328P boot loader. Wastes memory because Arduino created a half baked solution; it's actually the same boot loader as for the Uno but Arduin forgot to change the fuses so it has the same flash usage as the old boot loader.
  3. Old boot loader. Advantage is that it's basically the standard for all clones. Disadvantage (compared to Uno boot loader) is the additional flash memory that it chews.

If you want to pass them on to other people, just add a note to it which boot loader was used so people don't get confused.

In that case I'm not sure what the problem will be. If your Nanos have the CH340, maybe roll back the driver.

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