Burn bootloader - Nano is brick due to bad cable

Hello,

I know there are a lot of discussions like this already, I’ve read them over but I still don’t know the solution to my issue. I use a clone USB Asp programmer (fischl compatible), it worked in the past, but today it dropped a verification error during bootloader burning; and all further try to burn the boot loader was failed (see below). I tried different settings and I bricked another 2 Nano dev boards, when the 4th worked. I was happy and as a counter-test, I tried a 5th one that also went wrong. Then I realised the root cause is the faulty (loose) connector to the ICSP. I replaced it and bootloader burning works again. The question is if I can save the 4 boards that I bricked? I hope someone can tell me from the outputs below. I’m afraid the value of the fuses (at least, hfuse and lfuse) is zero.

First run (Tools -> Burn bootloader menu in Arduino 1.8.13):

/home/mr0wl/.arduino15/packages/MiniCore/tools/avrdude/7.2-arduino.1/bin/avrdude -C/home/mr0wl/.arduino15/packages/MiniCore/hardware/avr/3.0.0/avrdude.conf -v -patmega328p -cusbasp -e -Ulock:w:0xff:m -Uefuse:w:0b11111101:m -Uhfuse:w:0xd7:m -Ulfuse:w:0b11110111:m

avrdude: Version 7.2-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /home/mr0wl/.arduino15/packages/MiniCore/hardware/avr/3.0.0/avrdude.conf
         User configuration file is /home/mr0wl/.avrduderc
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

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

         Programmer Type : usbasp
         Description     : USBasp ISP and TPI programmer
avrdude: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update

avrdude: processing -U lock:w:0xff:m
avrdude: reading input file 0xff for lock
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0xff
avrdude: 1 byte of lock verified

avrdude: processing -U efuse:w:0b11111101:m
avrdude: reading input file 0b11111101 for efuse
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte efuse ...
avrdude: 1 byte of efuse written
avrdude: verifying efuse memory against 0b11111101
avrdude: 1 byte of efuse verified

avrdude: processing -U hfuse:w:0xd7:m
avrdude: reading input file 0xd7 for hfuse
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte hfuse ...
 ***failed;
avrdude: 1 byte of hfuse written
avrdude: verifying hfuse memory against 0xd7
avrdude avr_verify() warning: verification mismatch
        device 0x00 != input 0xd7 at addr 0x0000 (error)
avrdude do_op() error: verification mismatch

avrdude done.  Thank you.

Further runs:

/home/mr0wl/.arduino15/packages/MiniCore/tools/avrdude/7.2-arduino.1/bin/avrdude -C/home/mr0wl/.arduino15/packages/MiniCore/hardware/avr/3.0.0/avrdude.conf -v -patmega328p -cusbasp -e -Ulock:w:0xff:m -Uefuse:w:0b11111101:m -Uhfuse:w:0xd7:m -Ulfuse:w:0b11110111:m

avrdude: Version 7.2-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /home/mr0wl/.arduino15/packages/MiniCore/hardware/avr/3.0.0/avrdude.conf
         User configuration file is /home/mr0wl/.avrduderc
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

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

         Programmer Type : usbasp
         Description     : USBasp ISP and TPI programmer
avrdude: auto set sck period (because given equals null)
avrdude usbasp_spi_set_sck_period() error: cannot set sck period; please check for usbasp firmware update
avrdude usbasp_spi_program_enable() error: program enable: target does not answer (0x01)
avrdude main() error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower the bit clock frequency, e.g. -B 125kHz
        - use -F to override this check

avrdude done.  Thank you.

The external 16Mhz resonator is given on the Nano board, I also tried to connect a 16MHz crystal to xtal1 pin, with no luck.

Is there anything that I can try or should I give up…?

Thank you!

The fuses may be set to values that disable ISP programming. If you have the patience for it you can try using high voltage programming to reset the fuses. Here is a post I made a while back on how to do that. HV Rescue Simple : 5 Steps - Instructables

On a Nano you’ll have to tack flying lead on the MCU, XTAL1 pin. Instructables member douggorgen wrote in the comments section at the bottom of the post about using this high voltage programming successfully on a Nano.

1 Like

Thank you! I’ll definitely try to recover those Nanos.

Please tell us the outcome, and show pictures of your wiring for recovering the fuses, it will help others who read this thread in the future.

1 Like

I checked the hv rescue page, but honestly, I couldn't find my way on the circuit diagram. That huge number of cables in the photos doesn't help, either. If someone could create a list how to connect two Nano proto boards, pin to pin with the names as it was printed to the pcb, that would be a huge leap forward; but honestly I don't count on that. Sorry…

Check out Nick Gammons website (Gammon.au).

I think he covers HV programming and is always very thorough.

Why did you mark it as the 'solution'?
I agree - pictures are insufficient.

@tigger
gammon.com.au

My error/laziness

gammon.au.high.voltage takes you there, Google search.

gammon.com.au involves a bit more digging around.

I'll remember next time, thanks.

Sorry, that didn't work.
I'll shut up.
Just put gammon.au.high voltage in the search box, not the address.

There are some things about Mr. Gammon’s sketches and high voltage transistor circuit that are pretty great.

https://www.gammon.com.au/forum/?id=12898

He has 3 sketches that will use high voltage programming if you enable it inside the sketch. The wiring is similar to what I do in HV Rescue Simple, but uses one less pin on the programmer arduino. The page shows the wiring for the DIP version of the ATmega328P, and it’s talking about the pin numbers on the chip, not the common “Arduino” pin numbers such as digital 1-13 and analog 0-5. And so does the HV Rescue Simple instructable. So with either schetch and circuit you need to translate. Both schematics give the pin functions in addition to MCU pin numbers, so you can use those to translate DIP to SMD pin numbers. The pin functions are designations like PC0, PC1, PC2, PD1, PD2, etc.

So you have to get out the datasheet and figure out which pins of the ATmega328P on the Nano you need to connect to, and how they tranlate to the header pins on the Nano by studying the Nano schematic. One of the pins XTAL1 does not go to the header pins, you have to hold or tack with solder a wire onto the tiny pin of the chip. Instructables member douggorgen wrote in the comments about holding a wire to that pin during programming. And he mentioned overcoming the on-board Nano reset 1K pullup resistor by changing the resistor sending 12V to the reset pin with a 150 ohm one. I’m not sure I would take that approach, I would probably just temporarily desolder and remove the Nano’s pull up resistor.

If you have a clone Nano here is info/schematic/board layout:

http://actrl.cz/blog/wp-content/uploads/nano_ch340_schematics-rev1.pdf

https://www.instructables.com/Arduino-Nano-ATmega238PCH340G-v30-PCB-layout/

This would take a lot of patience. Is it worth it? I don’t know if I would recover a SMD MCU. It’s a lot of wires, almost all of the connections on the headers plus the XTAL1 pin directly on the MCU and tiny desoldering/soldering. It would be educational, and something to brag about for sure.

And check this out, a pinout diagram that gives the Arduino pin number, pin function, and TQFP pin numbers all in one place. https://www.reddit.com/r/arduino/comments/gyrdii/atmega328p_tqfp32_pinout/