Struggling to successfully burn bootloader to chip with arduino as ISP

I am not getting anywhere with installing a bootloader onto a atmega328p chip I have in circuit on a pcb, using an arduino nano clone as a ISP programmer.

Arduino IDE 2.3.1

My circuit and on board programming connector is shown below in the diagram.
Confirmed necessary pins are connected with multi meter between both programmer ship and target chip.

Confirmed nano clone working -blink sketch uploaded and working.

Because my custom PCB is based on a nano schematic at the core I have tried using both setting Tools>Board to Arduino nano, and tried minicore>atmega328

arduino as ISP, Upload sketch to nano
Processor to ATmega328P
Connect target board with OBP connector
Set programmer to arduino as ISP
Burn bootloader

Recieve a failed chip erase, outut below.

Using Port                    : /dev/ttyUSB2
         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 = 0xffffe0
avrdude: Expected signature for ATmega328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Failed chip erase: uploading error: exit status 1

Selecting board as minicore>ATmega328
Burn bootloader
-baudrate-default
-BOD 2.7v
-bootloader - yes(UART0)
-16mhz external crystal
-eeprom retained
-LTO enabled
-Variant-328p

programmer as ISP
Burn Bootloader

recieve an invalid device signature.

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/brian/.arduino15/packages/MiniCore/hardware/avr/3.0.1/avrdude.conf
         User configuration file is /home/brian/.avrduderc
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB2
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         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 : 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
avrdude: device signature = 0xffffff (probably .xmega) (retrying)
avrdude: device signature = 0xffffff (probably .xmega) (retrying)
avrdude: device signature = 0xffffff (probably .xmega)
avrdude main() error: Yikes!  Invalid device signature.
avrdude main() error: expected signature for ATmega328P is 1E 95 0F
        Double check connections and try again, or use -F to override
        this check.


avrdude done.  Thank you.

Failed chip erase: uploading error: exit status 1

I am completely lost as to what to do next.

Looks like you're confusing the I2C SCL line with the SPI CLK line. They're not the same. Connect PB5 (pin 17 on your Atmega) to pin 4 on your SPI header and give it another go.

I have connected SPI clock, atmega pin 17 on programmer nano to target atmega pin 17 but I am still getting a failed bootloader burn. Strangely the device signtature is different again but still not correct.


avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Failed chip erase: uploading error: exit status 1

IIRC a 0x0 signature is often associated with a reset problem. Verify wiring between your ISP programmer and the target device, in particular the RST line.

Btw, I always prefer to use an USBASP programmer; they are cheap and very convenient to use. If you're working with virgin ATMega chips from time to time, I'd recommend getting one of those. It removes a couple of uncertainties from the process.

CHecked with a multimeter that I have a pretty solid connection between RST pins of both boards and no shorts to anywhere else.
Have I messed up with using the 10k resistor between RST and 5V? it is wired so the programmer bypasses it

You don't connect to the RST pin of the programmer board, the RST of the target chip goes to a digital output of the programmer, generally pin 10 but depends on the code you are using. The RST of the programmer board may need a capacitor to GND to prevent the programmer itself from resetting.

No, that's fine.

However, I agree with what @BrianBoru said: the RST pin of the target device should not be connected with the RST pin of the microcontroller that acts as the ISP device.
Please refer to this document (for instance) for some notes on the RST pin: https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/
Specifically this bit:

Note the yellow connection from D10 of the programmer to RESET of the target. On MKR family of boards, you can't use D10 for reset; we suggest D6 and you must remember to change the line 73 of the ArduinoISP sketch - #define RESET 10 - putting "6" instead of 10.

THanks both of you!
your totally right, connecting to RST to pin 10 sorted it out. Got the bootloader and a sketch onto the board. Although I have a problem with my sketch freezing, The scope of this thread is resolved.

Much appreicated for your help on this!

2 Likes

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