Burning bootloader on ATMEGA328P-AN using Arduino Uno

Hi, i've seen couple topics on this forum about this problem but none of them helped me.

I'm trying to burn bootloader on my Atmega328-P chip on my custom board. Firstly i was trying with some fake arduino board which gave me error while burning bootloader with device signature (it was something like 0x000000).
I changed board for original arduino uno and coupled grounds and with good connections i was getting device signature 0x808080 (better than 0x000000 or 0xffffff but still not it). I will post full message while burning butloader below:

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

     Using Port                    : COM4
     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 = 0x808080
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

Why do you need to replace the factory-installed bootloader?

I mean i want to install the arduino bootloader so i can upload arduino projects on this chip

Do you have a bare chip or something like an UNO

Did you follow the advice given by avrdude? Use the -F option.

Picked…

  1. the right port?
  2. right programmer?

Also highly recommended is to not choose an Arduino (Uno, Nano etc) boot loader but install Minicore and use that instead.

Could brick something.

Override usually only works in movies :slight_smile:

if we're talking about this chip on which i want to install bootloader it is on some kind of board with relayes, diodes etc (project made by me)

port and programmer are fine, i've checked port on device manager and i'm using this arduino as isp option with isp program loaded on uno. I will try with minicore tommorow and let you know if this helped.

I suspect that your custom design is bad.

I installed minicore and i'm still getting same error. You can see my settings below. I think they are okay.

It is possible but i dont know what can be wrong with my board

Could be a hundred different things but without seeing a schematic and PCB layout we can't help

Is it possible that your 328P is a fake one?

It doesn't seem this is right for Arduino as ISP.

There are 2 things that are different from layout:

  • i didn't checked oscillators pinout and had to "repair" it (oscillator is diagonal when you're looking on his pins and i have horizontal on layout),
  • i made a little change to part of circuit which turns on/off relays but i don't think it would interfere microcontrolers work (the change is not on schematic).


i don't think so because i bought it from TME (it is good source for me)

what do you mean by that?

I don't see an ICSP connector.
How were you connecting the programmer?

In the v1.8 IDE, before clicking on Burn Bootloader, on the line immediately above that, I have to set the Programmer to be "Arduino as ISP" if that's what I'm using.

I also use a GUI front-end for AVRdude called AVRdudess. Using it to read out the contents of a Nano into a hex file, it produces this:

>>>: avrdude.exe -c arduino_as_isp -p m328p -P COM3 -v -U flash:r:"C:\Users\Owner\Downloads\fred.hex":i 
Avrdude version 8.0
Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

System wide configuration file is C:\Arduino\AVRDudess\avrdude.conf

Using port            : COM3
Using programmer      : arduino_as_isp
Programmer baud rate  : 19200
AVR part              : ATmega328P
Programming modes     : SPM, ISP, HVPP, debugWIRE
Programmer type       : STK500
Description           : AVR as programmer with Arduino-as-ISP FW
HW Version            : 2
FW Version            : 1.18
Topcard               : Unknown
SCK period            : 0.0 us
XTAL frequency        : 7.372800 MHz

AVR device initialized and ready to accept instructions
Device signature = 1E 95 0F (ATmega328P, ATA6614Q, LGT8F328P)
Reading flash memory ...
Reading | ################################################## | 100% 19.75s
Writing 32670 bytes to output file fred.hex

Avrdude done.  Thank you.

I don't know if Arduino as ISP is different from STK500.